vrembem 4.0.0-next.33 → 4.0.0-next.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dev/index.umd.cjs CHANGED
@@ -2,41 +2,44 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.vrembem = {}));
3
3
  })(this, (function(exports2) {
4
4
  "use strict";
5
- const u = ":not([inert])", f$2 = ':not([tabindex^="-"])', m$2 = ":not(:disabled)", C$2 = [
6
- `a[href]${u}${f$2}`,
7
- `area[href]${u}${f$2}`,
8
- `input:not([type="hidden"]):not([type="radio"])${u}${f$2}${m$2}`,
9
- `input[type="radio"]${u}${f$2}${m$2}`,
10
- `select${u}${f$2}${m$2}`,
11
- `textarea${u}${f$2}${m$2}`,
12
- `button${u}${f$2}${m$2}`,
13
- `details${u} > summary:first-of-type${f$2}`,
14
- `iframe${u}${f$2}`,
15
- `audio[controls]${u}${f$2}`,
16
- `video[controls]${u}${f$2}`,
17
- `[contenteditable]${u}${f$2}`,
18
- `[tabindex]${u}${f$2}`
5
+ const l$2 = ":not([inert])", u$2 = ':not([tabindex^="-"])', m$2 = ":not(:disabled)", C$2 = [
6
+ `a[href]${l$2}${u$2}`,
7
+ `area[href]${l$2}${u$2}`,
8
+ `input:not([type="hidden"]):not([type="radio"])${l$2}${u$2}${m$2}`,
9
+ `input[type="radio"]${l$2}${u$2}${m$2}`,
10
+ `select${l$2}${u$2}${m$2}`,
11
+ `textarea${l$2}${u$2}${m$2}`,
12
+ `button${l$2}${u$2}${m$2}`,
13
+ `details${l$2} > summary:first-of-type${u$2}`,
14
+ `iframe${l$2}${u$2}`,
15
+ `audio[controls]${l$2}${u$2}`,
16
+ `video[controls]${l$2}${u$2}`,
17
+ `[contenteditable]${l$2}${u$2}`,
18
+ `[tabindex]${l$2}${u$2}`
19
19
  ];
20
- function k$3(n, t = "config") {
21
- const s = (n.getAttribute(`data-${t}`) || "").replace(/'/g, '"');
22
- return s ? JSON.parse(s) : {};
20
+ function x$2(i, t = "config") {
21
+ const o = (i.getAttribute(`data-${t}`) || "").replace(/'/g, '"');
22
+ return o ? JSON.parse(o) : {};
23
23
  }
24
- function E$3(n) {
25
- if (typeof n == "string") {
26
- const t = document.getElementById(n);
24
+ function v$2(i) {
25
+ if (typeof i == "string") {
26
+ const t = document.getElementById(i);
27
27
  if (t) return t;
28
- throw new Error(`Element not found with ID: "${n}"`);
29
- } else if (n instanceof HTMLElement) {
30
- if (!n.id)
28
+ throw new Error(`Element not found with ID: "${i}"`);
29
+ } else if (i instanceof HTMLElement) {
30
+ if (!i.id)
31
31
  throw new Error("HTMLElement must have an ID");
32
- return n;
32
+ return i;
33
33
  } else
34
34
  throw new Error("Invalid argument: query must be a string or HTMLElement");
35
35
  }
36
- async function g$1(n, t, ...e) {
37
- t in n && typeof n[t] == "function" && await n[t](...e);
36
+ function h$2(i, ...t) {
37
+ return typeof i == "function" ? i(...t) : i;
38
+ }
39
+ async function g$2(i, t, ...e) {
40
+ t in i && typeof i[t] == "function" && await i[t](...e);
38
41
  }
39
- function x$2(n, t, e) {
42
+ function k$3(i, t, e) {
40
43
  if (typeof t == "string") {
41
44
  const r2 = document.querySelector(t);
42
45
  if (!r2)
@@ -46,121 +49,143 @@
46
49
  throw new Error(`Not a valid teleport reference: '${t}'`);
47
50
  if (typeof t[e] != "function")
48
51
  throw new Error(`Not a valid teleport method: '${e}'`);
49
- let s = document.createComment(
50
- "teleported #" + n.id
52
+ let o = document.createComment(
53
+ "teleported #" + i.id
51
54
  );
52
- return n.before(s), t[e](n), () => {
53
- s && (s.after(n), s.remove(), s = null);
55
+ return i.before(o), t[e](i), () => {
56
+ o && (o.after(i), o.remove(), o = null);
54
57
  };
55
58
  }
56
- function v$2(n) {
57
- return n.split("-").map(
59
+ function R$1(i) {
60
+ return i.split("-").map(
58
61
  (t, e) => e === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)
59
62
  ).join("");
60
63
  }
61
- function $$2(n) {
62
- return n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
64
+ function M$2(i) {
65
+ return i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
63
66
  }
64
- function S$2(n) {
65
- if (typeof n == "number")
66
- return n;
67
- const t = parseFloat(n);
67
+ function A$3(i) {
68
+ if (typeof i == "number")
69
+ return i;
70
+ const t = parseFloat(i);
68
71
  if (!Number.isNaN(t)) {
69
- const e = n.includes("ms");
72
+ const e = i.includes("ms");
70
73
  return t * (e ? 1 : 1e3);
71
74
  }
72
- throw new Error(`Could not convert value to milliseconds: ${n}`);
75
+ throw new Error(`Could not convert value to milliseconds: ${i}`);
73
76
  }
74
- function J$1(n, t, e, s, r2 = 0) {
75
- return new Promise((a2) => {
76
- n.classList.remove(t), n.classList.add(e), setTimeout(() => {
77
- n.classList.add(s), n.classList.remove(e), a2(n);
78
- }, S$2(r2));
77
+ function W$1(i, t, e, o, r2 = 0) {
78
+ return new Promise((n) => {
79
+ i.classList.remove(t), i.classList.add(e), setTimeout(() => {
80
+ i.classList.add(o), i.classList.remove(e), n(i);
81
+ }, A$3(r2));
79
82
  });
80
83
  }
81
- function R$2(n, t = {}) {
84
+ function S$3(i, t = {}) {
82
85
  const e = {
83
86
  fallback: null,
84
87
  element: document.body,
85
88
  ...t
86
89
  };
87
- if (!n.startsWith("--")) {
90
+ if (!i.startsWith("--")) {
88
91
  const r2 = y$2();
89
- r2 && (n = `${r2}${n}`), n = `--${n}`;
92
+ r2 && (i = `${r2}${i}`), i = `--${i}`;
90
93
  }
91
- const s = getComputedStyle(e.element).getPropertyValue(n).trim();
92
- if (s)
93
- return s;
94
+ const o = getComputedStyle(e.element).getPropertyValue(i).trim();
95
+ if (o)
96
+ return o;
94
97
  if (e.fallback)
95
98
  return e.fallback;
96
- throw new Error(`CSS variable "${n}" was not found!`);
99
+ throw new Error(`CSS variable "${i}" was not found!`);
97
100
  }
98
- async function h$1(n, t, e) {
99
- await g$1(t, n, e), e && await g$1(e, n);
100
- for (const s of t.plugins)
101
- await g$1(s, n, { plugin: s, parent: t, entry: e });
102
- await t.emit(n, e);
101
+ async function d$1(i, t, e) {
102
+ await g$2(t, i, e), e && await g$2(e, i);
103
+ for (const o of t.plugins)
104
+ await g$2(o, i, { parent: t, entry: e });
105
+ await t.emit(i, { parent: t, entry: e });
103
106
  }
104
- function M$2(n) {
105
- const t = getComputedStyle(n.el), e = {}, s = n.getSetting("customProps");
106
- for (let r2 = 0; r2 < s.length; r2++) {
107
- const a2 = y$2(), o = n.parent.module.toLowerCase(), i = $$2(s[r2]), c2 = t.getPropertyValue(`--${a2}${o}-${i}`).trim();
108
- c2 && (e[i] = c2);
107
+ function b$2(i) {
108
+ const t = getComputedStyle(i.el), e = {}, o = i.config.get("customProps");
109
+ for (let r2 = 0; r2 < o.length; r2++) {
110
+ const n = y$2(), s = i.parent.name.toLowerCase(), c2 = M$2(o[r2]), a2 = t.getPropertyValue(`--${n}${s}-${c2}`).trim();
111
+ a2 && (e[R$1(c2)] = a2);
109
112
  }
110
113
  return e;
111
114
  }
112
115
  function y$2() {
113
116
  return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
114
117
  }
115
- function P$3(n, t, e = "camel") {
116
- return t = e === "camel" ? v$2(t) : $$2(t), n.split(".").concat(t).reduce((s, r2) => s?.[r2], this);
117
- }
118
- function A$2(n, t = {}) {
119
- const {
120
- fallback: e,
121
- props: s = ["dataConfig", "customProps", "settings", "parent.settings"]
122
- } = t;
123
- for (const r2 of s) {
124
- const a2 = r2 !== "customProps" ? "camel" : "kebab", o = P$3.call(this, r2, n, a2);
125
- if (o !== void 0)
126
- return o;
127
- }
128
- if (e !== void 0)
129
- return e;
130
- throw new Error(`${this.parent.module} setting does not exist: ${n}`);
131
- }
132
- function T$3(n, t) {
133
- t && document.querySelectorAll(t).forEach((s) => {
134
- n ? s.style.overflow = "hidden" : s.style.removeProperty("overflow");
118
+ function P$3(i, t) {
119
+ t && document.querySelectorAll(t).forEach((o) => {
120
+ i ? o.style.overflow = "hidden" : o.style.removeProperty("overflow");
135
121
  });
136
122
  }
137
- function I$3(n, t) {
138
- t && document.querySelectorAll(t).forEach((s) => {
139
- s.inert = n;
123
+ function T$2(i, t) {
124
+ t && document.querySelectorAll(t).forEach((o) => {
125
+ o.inert = i;
140
126
  });
141
127
  }
142
- function G(n, t, e) {
143
- I$3(!!n, t), T$3(!!n, e);
128
+ function Z(i, t, e) {
129
+ T$2(!!i, t), P$3(!!i, e);
144
130
  }
145
- const L$2 = {
146
- events: {},
147
- on(n, t, ...e) {
148
- this.events[n] || (this.events[n] = []), this.events[n].some(
149
- (r2) => r2.listener === t
150
- ) || this.events[n].push({ listener: t, args: e });
151
- },
152
- off(n, t) {
153
- this.events[n] && (this.events[n] = this.events[n].filter(
154
- (e) => e.listener !== t
131
+ let I$3 = class I {
132
+ #t;
133
+ #e;
134
+ constructor() {
135
+ this.#t = {}, this.#e = [];
136
+ }
137
+ get(t, e) {
138
+ const { fallback: o, source: r2 } = e ?? {};
139
+ if (r2) {
140
+ const n = this.#t?.[r2]?.[t];
141
+ if (n !== void 0)
142
+ return n;
143
+ } else
144
+ for (const n of this.#e) {
145
+ const s = this.#t?.[n]?.[t];
146
+ if (s !== void 0)
147
+ return s;
148
+ }
149
+ if (o !== void 0)
150
+ return o;
151
+ throw new Error(`Config does not exist: ${t}`);
152
+ }
153
+ set(t, e = {}) {
154
+ let o, r2;
155
+ return typeof t == "string" ? (o = t, r2 = e) : (o = "entry", r2 = t), this.#t[o] ? Object.assign(this.#t[o], r2) : (this.#e.unshift(o), this.#t[o] = r2), this.#t[o];
156
+ }
157
+ remove(t) {
158
+ const e = this.#e.indexOf(t);
159
+ e !== -1 && this.#e.splice(e, 1), delete this.#t[t];
160
+ }
161
+ setSourceOrder(t) {
162
+ const e = Object.keys(this.#t).reverse(), o = t.filter((r2) => e.includes(r2));
163
+ for (const r2 of e)
164
+ o.includes(r2) || o.push(r2);
165
+ return this.#e = o;
166
+ }
167
+ };
168
+ let L$2 = class L {
169
+ constructor() {
170
+ this.events = {};
171
+ }
172
+ on(t, e, ...o) {
173
+ this.events[t] || (this.events[t] = []), this.events[t].some(
174
+ (n) => n.listener === e
175
+ ) || this.events[t].push({ listener: e, args: o });
176
+ }
177
+ off(t, e) {
178
+ this.events[t] && (this.events[t] = this.events[t].filter(
179
+ (o) => o.listener !== e
155
180
  ));
156
- },
157
- async emit(n, t) {
158
- if (n = n.startsWith("on") ? n.slice(2, 3).toLowerCase() + n.slice(3) : n, !!this.events[n])
159
- for (const { listener: e, args: s } of this.events[n])
160
- await e(t, ...s);
181
+ }
182
+ async emit(t, ...e) {
183
+ if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
184
+ for (const { listener: o, args: r2 } of this.events[t])
185
+ await o(...e, ...r2);
161
186
  }
162
187
  };
163
- let O$2 = class O extends Array {
188
+ let U$1 = class U extends Array {
164
189
  constructor(t = null) {
165
190
  super(), this.el = t, this.el && this.set();
166
191
  }
@@ -177,70 +202,70 @@
177
202
  this.length = 0;
178
203
  }
179
204
  };
180
- let U$2 = class U {
205
+ let D$2 = class D {
181
206
  constructor(t = null) {
182
- this.el = t, this.focusable = new O$2(), this.handleFocusTrap = D$3.bind(this);
207
+ this.el = t, this.focusable = new U$1(), this.handleFocusTrap = O$2.bind(this);
183
208
  }
184
209
  on(t = this.el) {
185
- this.focusable.set(t), this.focusable.length ? document.addEventListener("keydown", this.handleFocusTrap) : document.addEventListener("keydown", b$2);
210
+ this.focusable.set(t), this.focusable.length ? document.addEventListener("keydown", this.handleFocusTrap) : document.addEventListener("keydown", $$2);
186
211
  }
187
212
  off() {
188
- this.focusable.clear(), document.removeEventListener("keydown", this.handleFocusTrap), document.removeEventListener("keydown", b$2);
213
+ this.focusable.clear(), document.removeEventListener("keydown", this.handleFocusTrap), document.removeEventListener("keydown", $$2);
189
214
  }
190
215
  };
191
- function b$2(n) {
192
- (n.key === "Tab" || n.keyCode === 9) && n.preventDefault();
216
+ function $$2(i) {
217
+ (i.key === "Tab" || i.keyCode === 9) && i.preventDefault();
193
218
  }
194
- function D$3(n) {
195
- if (n.key !== "Tab" && n.keyCode !== 9) return;
196
- const { activeElement: t } = document, { el: e, focusable: s } = this, r2 = n.shiftKey, a2 = t === s.first || t === e, o = t === s.last || t === e;
197
- if (r2 && a2 || !r2 && o) {
198
- n.preventDefault();
199
- const i = r2 ? s.last : s.first;
200
- i && typeof i.focus == "function" && i.focus();
219
+ function O$2(i) {
220
+ if (i.key !== "Tab" && i.keyCode !== 9) return;
221
+ const { activeElement: t } = document, { el: e, focusable: o } = this, r2 = i.shiftKey, n = t === o.first || t === e, s = t === o.last || t === e;
222
+ if (r2 && n || !r2 && s) {
223
+ i.preventDefault();
224
+ const c2 = r2 ? o.last : o.first;
225
+ c2 && typeof c2.focus == "function" && c2.focus();
201
226
  }
202
227
  }
203
- function w$2(n, t = true) {
204
- const e = localStorage.getItem(n), s = e ? JSON.parse(e) : {};
228
+ function w$2(i, t = true) {
229
+ const e = localStorage.getItem(i), o = e ? JSON.parse(e) : {};
205
230
  return {
206
- get(r2, a2) {
207
- return r2 ? r2 in s ? s[r2] : a2 : s;
231
+ get(r2, n) {
232
+ return r2 ? r2 in o ? o[r2] : n : o;
208
233
  },
209
- set(r2, a2) {
210
- return a2 ? s[r2] = a2 : delete s[r2], t && localStorage.setItem(n, JSON.stringify(s)), s;
234
+ set(r2, n) {
235
+ return n ? o[r2] = n : delete o[r2], t && localStorage.setItem(i, JSON.stringify(o)), o;
211
236
  }
212
237
  };
213
238
  }
214
- let H$3 = class H extends Array {
239
+ class H extends Array {
215
240
  constructor(t = {}) {
216
241
  super(), this.presets = t;
217
242
  }
218
- applySettings(t) {
219
- const e = t?.defaults || {}, s = this.presets?.[t.name] || {}, r2 = t?.options || {};
220
- t.settings = { ...e, ...s, ...r2 };
243
+ #t(t) {
244
+ const e = this.presets?.[t.name] || {}, o = t?.options || {};
245
+ t.config = { ...t.config, ...e, ...o };
221
246
  }
222
- validate(t) {
247
+ #e(t) {
223
248
  return !("name" in t) || typeof t.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
224
249
  }
225
250
  get(t) {
226
- return this.find((e) => e.name === t);
251
+ return this.find((e) => e.name === t) || null;
227
252
  }
228
253
  add(t) {
229
254
  if (Array.isArray(t))
230
255
  t.forEach((e) => this.add(e));
231
- else if (this.applySettings(t), this.validate(t)) {
232
- const e = this.findIndex((s) => s.name === t.name);
256
+ else if (this.#t(t), this.#e(t)) {
257
+ const e = this.findIndex((o) => o.name === t.name);
233
258
  ~e ? this[e] = t : this.push(t);
234
259
  }
235
260
  }
236
261
  remove(t) {
237
- const e = this.findIndex((s) => s.name === t);
262
+ const e = this.findIndex((o) => o.name === t);
238
263
  ~e && this.splice(e, 1);
239
264
  }
240
- };
241
- class W extends Array {
265
+ }
266
+ class _ extends Array {
242
267
  constructor(t = {}) {
243
- super(), this.settings = t;
268
+ super(), this.config = t;
244
269
  }
245
270
  get copy() {
246
271
  return [...this];
@@ -252,49 +277,104 @@
252
277
  updateIndex() {
253
278
  this.forEach((t, e) => {
254
279
  t.el.style.zIndex = "";
255
- const s = getComputedStyle(t.el)["z-index"];
256
- t.el.style.zIndex = String(parseInt(s, 10) + e + 1);
280
+ const o = getComputedStyle(t.el).getPropertyValue("z-index"), r2 = parseInt(o, 10), n = String((Number.isNaN(r2) ? 0 : r2) + e + 1);
281
+ t.el.style.zIndex = n;
257
282
  });
258
283
  }
259
284
  onChange() {
260
- this.updateIndex(), typeof this.settings.onChange == "function" && this.settings.onChange();
285
+ this.updateIndex(), typeof this.config.onChange == "function" && this.config.onChange();
261
286
  }
262
287
  add(t) {
263
288
  this.push(t), this.onChange();
264
289
  }
265
290
  remove(t) {
266
- const e = this.findIndex((s) => s.id === t.id);
291
+ const e = this.findIndex((o) => o.id === t.id);
267
292
  ~e && (t.el.style.zIndex = "", this.splice(e, 1), this.onChange());
268
293
  }
269
294
  moveToTop(t) {
270
- const e = this.findIndex((s) => s.id === t.id);
295
+ const e = this.findIndex((o) => o.id === t.id);
271
296
  ~e && (this.splice(e, 1), this.add(t));
272
297
  }
273
298
  }
274
299
  const N$1 = {
300
+ attr: "config",
301
+ sourceKey: "attr"
302
+ };
303
+ function X$1(i = {}) {
304
+ return { ...{
305
+ name: "attrConfig",
306
+ config: N$1,
307
+ options: i
308
+ }, ...{
309
+ onCreateEntry({ entry: o }) {
310
+ const r2 = x$2(o.el, this.config.attr);
311
+ o.config.set(this.config.sourceKey, r2);
312
+ },
313
+ onDestroyEntry({ entry: o }) {
314
+ o.config.remove(this.config.sourceKey);
315
+ }
316
+ } };
317
+ }
318
+ const K$1 = {
319
+ sourceKey: "css"
320
+ };
321
+ function Y$1(i = {}) {
322
+ const t = {
323
+ name: "cssConfig",
324
+ config: K$1,
325
+ options: i
326
+ }, e = {
327
+ setup(r2) {
328
+ r2.on("updateCustomProps", o, this);
329
+ },
330
+ teardown(r2) {
331
+ r2.off("updateCustomProps", o);
332
+ },
333
+ onCreateEntry({ entry: r2 }) {
334
+ const n = b$2(r2);
335
+ r2.config.set(this.config.sourceKey, n);
336
+ },
337
+ onDestroyEntry({ entry: r2 }) {
338
+ r2.config.remove(this.config.sourceKey);
339
+ }
340
+ };
341
+ function o(r2, n) {
342
+ const s = b$2(r2);
343
+ r2.config.set(n.config.sourceKey, s);
344
+ }
345
+ return { ...t, ...e };
346
+ }
347
+ const Q = {
275
348
  condition: true
276
- }, Q = {
349
+ }, q$2 = {
277
350
  primary: "hsl(152deg 60% 50%)",
278
351
  secondary: "hsl(214deg 50% 50%)",
279
352
  neutral: "hsl(214deg 20% 50%)",
280
353
  important: "hsl(0deg 80% 50%)"
281
354
  };
282
- function Z(n = {}) {
355
+ function tt$1(i = {}) {
283
356
  const t = {
284
357
  name: "debug",
285
- defaults: N$1,
286
- options: n
358
+ config: Q,
359
+ options: i
287
360
  };
288
- function e(o, i = [], c2 = ["primary", "secondary"]) {
289
- const l = c2.map((d2) => `color: ${Q[d2]}`);
290
- console.log(`%c📡 DEBUG: %c${o}`, ...l, ...i);
291
- }
292
- function s(o, ...i) {
293
- return typeof o == "function" ? o(...i) : o;
361
+ function e(n, s = [], c2 = ["primary", "secondary"]) {
362
+ const a2 = c2.map((f2) => `color: ${q$2[f2]}`);
363
+ console.log(`%c📡 DEBUG: %c${n}`, ...a2, ...s);
294
364
  }
295
- const r2 = {
296
- beforeMountRef: e.bind(null, "Event > beforeMount()"),
297
- afterMountRef: e.bind(null, "Event > afterMount()"),
365
+ const o = {
366
+ beforeMountRef: e.bind(
367
+ null,
368
+ "Event > beforeMount()",
369
+ [],
370
+ ["primary", "secondary"]
371
+ ),
372
+ afterMountRef: e.bind(
373
+ null,
374
+ "Event > afterMount()",
375
+ [],
376
+ ["primary", "secondary"]
377
+ ),
298
378
  beforeUnmountRef: e.bind(
299
379
  null,
300
380
  "Event > beforeUnmount()",
@@ -307,33 +387,33 @@
307
387
  [],
308
388
  ["important", "neutral"]
309
389
  ),
310
- createEntryRef: (o, { parent: i, plugin: c2 }) => {
311
- if (s(c2.settings.condition, o)) {
312
- const l = i.collection.length;
313
- e(`Event > createEntry() > [${l}] #${o.id}`);
390
+ createEntryRef: ({ parent: n, entry: s }, c2) => {
391
+ if (h$2(c2.config.condition, s)) {
392
+ const a2 = n.collection.length;
393
+ e(`Event > createEntry() > [${a2}] #${s.id}`);
314
394
  }
315
395
  },
316
- registerEntryRef: (o, { parent: i, plugin: c2 }) => {
317
- if (s(c2.settings.condition, o)) {
318
- const l = i.collection.length;
319
- e(`Event > registerEntry() > [${l}] #${o.id}`);
396
+ registerEntryRef: ({ parent: n, entry: s }, c2) => {
397
+ if (h$2(c2.config.condition, s)) {
398
+ const a2 = n.collection.length;
399
+ e(`Event > registerEntry() > [${a2}] #${s.id}`);
320
400
  }
321
401
  },
322
- destroyEntryRef: (o, { parent: i, plugin: c2 }) => {
323
- if (s(c2.settings.condition, o)) {
324
- const l = i.collection.length;
402
+ destroyEntryRef: ({ parent: n, entry: s }, c2) => {
403
+ if (h$2(c2.config.condition, s)) {
404
+ const a2 = n.collection.length;
325
405
  e(
326
- `Event > destroyEntry() > [${l}] #${o.id}`,
406
+ `Event > destroyEntry() > [${a2}] #${s.id}`,
327
407
  [],
328
408
  ["important", "neutral"]
329
409
  );
330
410
  }
331
411
  },
332
- deregisterEntryRef: (o, { parent: i, plugin: c2 }) => {
333
- if (s(c2.settings.condition, o)) {
334
- const l = i.collection.length;
412
+ deregisterEntryRef: ({ parent: n, entry: s }, c2) => {
413
+ if (h$2(c2.config.condition, s)) {
414
+ const a2 = n.collection.length;
335
415
  e(
336
- `Event > deregisterEntry() > [${l}]`,
416
+ `Event > deregisterEntry() > [${a2}]`,
337
417
  [],
338
418
  ["important", "neutral"]
339
419
  );
@@ -342,39 +422,33 @@
342
422
  };
343
423
  return { ...t, ...{
344
424
  // Plugin setup/teardown methods
345
- setup({ parent: o }) {
346
- e("Plugin > setup()", Array.from(arguments), ["secondary", "neutral"]), o.on("beforeMount", r2.beforeMountRef), o.on("createEntry", r2.createEntryRef, { parent: o, plugin: this }), o.on("registerEntry", r2.registerEntryRef, {
347
- parent: o,
348
- plugin: this
349
- }), o.on("afterMount", r2.afterMountRef), o.on("beforeUnmount", r2.beforeUnmountRef), o.on("destroyEntry", r2.destroyEntryRef, { parent: o, plugin: this }), o.on("deregisterEntry", r2.deregisterEntryRef, {
350
- parent: o,
351
- plugin: this
352
- }), o.on("afterUnmount", r2.afterUnmountRef);
425
+ setup(n) {
426
+ e("Plugin > setup()", Array.from(arguments), ["secondary", "neutral"]), n.on("beforeMount", o.beforeMountRef), n.on("createEntry", o.createEntryRef, this), n.on("registerEntry", o.registerEntryRef, this), n.on("afterMount", o.afterMountRef), n.on("beforeUnmount", o.beforeUnmountRef), n.on("destroyEntry", o.destroyEntryRef, this), n.on("deregisterEntry", o.deregisterEntryRef, this), n.on("afterUnmount", o.afterUnmountRef);
353
427
  },
354
- teardown({ parent: o }) {
428
+ teardown(n) {
355
429
  e("Plugin > teardown()", Array.from(arguments), [
356
430
  "secondary",
357
431
  "neutral"
358
- ]), o.off("beforeMount", r2.beforeMountRef), o.off("createEntry", r2.createEntryRef), o.off("registerEntry", r2.registerEntryRef), o.off("afterMount", r2.afterMountRef), o.off("beforeUnmount", r2.beforeUnmountRef), o.off("destroyEntry", r2.destroyEntryRef), o.off("deregisterEntry", r2.deregisterEntryRef), o.off("afterUnmount", r2.afterUnmountRef);
432
+ ]), n.off("beforeMount", o.beforeMountRef), n.off("createEntry", o.createEntryRef), n.off("registerEntry", o.registerEntryRef), n.off("afterMount", o.afterMountRef), n.off("beforeUnmount", o.beforeUnmountRef), n.off("destroyEntry", o.destroyEntryRef), n.off("deregisterEntry", o.deregisterEntryRef), n.off("afterUnmount", o.afterUnmountRef);
359
433
  },
360
434
  // Mount lifecycle hooks
361
435
  beforeMount() {
362
436
  e("Hook > beforeMount()", Array.from(arguments));
363
437
  },
364
- onCreateEntry({ parent: o, entry: i }) {
365
- if (s(this.settings.condition, i)) {
366
- const c2 = o.collection.length;
438
+ onCreateEntry({ parent: n, entry: s }) {
439
+ if (h$2(this.config.condition, s)) {
440
+ const c2 = n.collection.length;
367
441
  e(
368
- `Hook > onCreateEntry() > [${c2}] #${i.id}`,
442
+ `Hook > onCreateEntry() > [${c2}] #${s.id}`,
369
443
  Array.from(arguments)
370
444
  );
371
445
  }
372
446
  },
373
- onRegisterEntry({ parent: o, entry: i }) {
374
- if (s(this.settings.condition, i)) {
375
- const c2 = o.collection.length - 1;
447
+ onRegisterEntry({ parent: n, entry: s }) {
448
+ if (h$2(this.config.condition, s)) {
449
+ const c2 = n.collection.length - 1;
376
450
  e(
377
- `Hook > onRegisterEntry() > [${c2}] #${i.id}`,
451
+ `Hook > onRegisterEntry() > [${c2}] #${s.id}`,
378
452
  Array.from(arguments)
379
453
  );
380
454
  }
@@ -389,19 +463,19 @@
389
463
  "neutral"
390
464
  ]);
391
465
  },
392
- onDestroyEntry({ parent: o, entry: i }) {
393
- if (s(this.settings.condition, i)) {
394
- const c2 = o.collection.length - 1;
466
+ onDestroyEntry({ parent: n, entry: s }) {
467
+ if (h$2(this.config.condition, s)) {
468
+ const c2 = n.collection.length - 1;
395
469
  e(
396
- `Hook > onDestroyEntry() > [${c2}] #${i.id}`,
470
+ `Hook > onDestroyEntry() > [${c2}] #${s.id}`,
397
471
  Array.from(arguments),
398
472
  ["important", "neutral"]
399
473
  );
400
474
  }
401
475
  },
402
- onDeregisterEntry({ parent: o, entry: i }) {
403
- if (s(this.settings.condition, i)) {
404
- const c2 = o.collection.length;
476
+ onDeregisterEntry({ parent: n, entry: s }) {
477
+ if (h$2(this.config.condition, s)) {
478
+ const c2 = n.collection.length;
405
479
  e(`Hook > onDeregisterEntry() > [${c2}]`, Array.from(arguments), [
406
480
  "important",
407
481
  "neutral"
@@ -416,43 +490,40 @@
416
490
  }
417
491
  } };
418
492
  }
419
- const q$3 = {
493
+ const F$1 = {
420
494
  condition: true
421
495
  };
422
- function _$1(n = {}) {
496
+ function et$1(i = {}) {
423
497
  const t = {
424
498
  name: "focusTrap",
425
- defaults: q$3,
426
- options: n
499
+ config: F$1,
500
+ options: i
427
501
  }, e = {
428
- setup({ parent: o }) {
429
- o.on("opened", r2, this), o.on("closed", a2, this);
502
+ setup(n) {
503
+ n.on("opened", o, this), n.on("closed", r2, this);
430
504
  },
431
- teardown({ parent: o }) {
432
- o.off("opened", r2), o.off("closed", a2);
505
+ teardown(n) {
506
+ n.off("opened", o), n.off("closed", r2);
433
507
  },
434
- onCreateEntry({ entry: o }) {
435
- o.focusTrap = new U$2();
508
+ onCreateEntry({ entry: n }) {
509
+ n.focusTrap = new D$2();
436
510
  }
437
511
  };
438
- function s(o, ...i) {
439
- return typeof o == "function" ? o(...i) : o;
512
+ function o(n, s) {
513
+ const c2 = { plugin: s, parent: n.parent, entry: n };
514
+ n.focusTrap && h$2(s.config.condition, c2) && n.focusTrap.on(n.dialog);
440
515
  }
441
- function r2(o, i) {
442
- const c2 = { plugin: i, parent: o.parent, entry: o };
443
- s(i.settings.condition, c2) && o.focusTrap?.on(o.dialog);
444
- }
445
- function a2(o, i) {
446
- const c2 = { plugin: i, parent: o.parent, entry: o };
447
- s(i.settings.condition, c2) && o.focusTrap?.off();
516
+ function r2(n, s) {
517
+ const c2 = { plugin: s, parent: n.parent, entry: n };
518
+ n.focusTrap && h$2(s.config.condition, c2) && n.focusTrap.off();
448
519
  }
449
520
  return { ...t, ...e };
450
521
  }
451
- const F$2 = {
522
+ const V = {
452
523
  // The data attributes to get the breakpoint values from
453
- dataBreakpoint: "breakpoint",
524
+ attrBreakpoint: "breakpoint",
454
525
  // The data attributes to get the media query value from
455
- dataMediaQuery: "media-query",
526
+ attrMediaQuery: "media-query",
456
527
  // The string token to replace in the media query string
457
528
  token: "{{BP}}",
458
529
  // Sets a global breakpoint. Can be overridden by setting a data attribute
@@ -473,47 +544,47 @@
473
544
  onChange: () => {
474
545
  }
475
546
  };
476
- function X$1(n = {}) {
547
+ function ot$1(i = {}) {
477
548
  const t = {
478
549
  name: "mediaQuery",
479
- defaults: F$2,
480
- options: n
550
+ config: V,
551
+ options: i
481
552
  }, e = {
482
553
  // Run when an entry is created
483
554
  // Sets up the MediaQueryList and event listener
484
- onCreateEntry({ entry: i }) {
485
- a2.call(this, i);
555
+ onCreateEntry({ entry: c2 }) {
556
+ n.call(this, c2);
486
557
  },
487
558
  // Run when an entry is destroyed
488
559
  // Removes the MediaQueryList and event listener
489
- onDestroyEntry({ entry: i }) {
490
- o(i);
560
+ onDestroyEntry({ entry: c2 }) {
561
+ s(c2);
491
562
  }
492
563
  };
493
- function s(i) {
494
- const c2 = i.el.getAttribute(`data-${this.settings.dataMediaQuery}`);
495
- return !c2 && i.id in this.settings.mediaQueries ? this.settings.mediaQueries[i.id] : c2 || void 0;
496
- }
497
- function r2(i) {
498
- let c2 = i.el.getAttribute(`data-${this.settings.dataBreakpoint}`);
499
- return !c2 && i.id in this.settings.breakpoints && (c2 = this.settings.breakpoints[i.id]), c2 && c2 in this.settings.breakpoints && (c2 = this.settings.breakpoints[c2]), c2 && (c2 = getComputedStyle(document.body).getPropertyValue(`--${y$2()}breakpoint-${c2}`).trim() || c2), c2 || this.settings.breakpoint;
500
- }
501
- function a2(i) {
502
- let c2 = s.call(this, i);
503
- const l = r2.call(this, i);
504
- if (!l && !c2) return;
505
- l && !c2 && (c2 = this.settings.mediaQuery);
506
- const d2 = c2.replace(new RegExp(`${this.settings.token}`, "g"), l);
507
- i.mql = window.matchMedia(d2), i.mql.onchange = (p2) => {
508
- this.settings.onChange(p2, i);
509
- }, this.settings.onChange(i.mql, i);
510
- }
511
- function o(i) {
512
- i.mql && (i.mql.onchange = null, i.mql = null);
564
+ function o(c2) {
565
+ const a2 = c2.el.getAttribute(`data-${this.config.attrMediaQuery}`);
566
+ return !a2 && c2.id in this.config.mediaQueries ? this.config.mediaQueries[c2.id] : a2 || void 0;
567
+ }
568
+ function r2(c2) {
569
+ let a2 = c2.el.getAttribute(`data-${this.config.attrBreakpoint}`);
570
+ return !a2 && c2.id in this.config.breakpoints && (a2 = this.config.breakpoints[c2.id]), a2 && a2 in this.config.breakpoints && (a2 = this.config.breakpoints[a2]), a2 && (a2 = getComputedStyle(document.body).getPropertyValue(`--${y$2()}breakpoint-${a2}`).trim() || a2), a2 || this.config.breakpoint;
571
+ }
572
+ function n(c2) {
573
+ const a2 = r2.call(this, c2);
574
+ if (!a2) return;
575
+ let f2 = o.call(this, c2) || this.config.mediaQuery;
576
+ if (!f2) return;
577
+ const p2 = f2.replace(new RegExp(`${this.config.token}`, "g"), a2);
578
+ c2.mql = window.matchMedia(p2), c2.mql.onchange = (E2) => {
579
+ this.config.onChange(E2, c2);
580
+ }, this.config.onChange(c2.mql, c2);
581
+ }
582
+ function s(c2) {
583
+ c2.mql && (c2.mql.onchange = null, c2.mql = null);
513
584
  }
514
585
  return { ...t, ...e };
515
586
  }
516
- const V$1 = {
587
+ const B = {
517
588
  // The property on entry objects to watch
518
589
  prop: "state",
519
590
  // The default value or a function to compute the initial value
@@ -529,289 +600,251 @@
529
600
  onChange() {
530
601
  }
531
602
  };
532
- function Y$1(n = {}) {
603
+ function nt$1(i = {}) {
533
604
  const t = {
534
605
  name: "propStore",
535
- defaults: V$1,
536
- options: n,
606
+ config: B,
607
+ options: i,
537
608
  store: null
538
609
  }, e = {
539
- setup({ parent: i }) {
540
- this.store = w$2(o.call(this, i.module));
610
+ setup(s) {
611
+ this.store = w$2(n.call(this, s.name));
541
612
  },
542
- async onCreateEntry({ entry: i }) {
543
- await s.call(this, i);
613
+ async onCreateEntry({ entry: s }) {
614
+ await o.call(this, s);
544
615
  },
545
- onDestroyEntry({ entry: i }) {
546
- a2.call(this, i);
616
+ onDestroyEntry({ entry: s }) {
617
+ r2.call(this, s);
547
618
  }
548
619
  };
549
- async function s(i) {
550
- let c2 = i[this.settings.prop] || null;
551
- const l = { plugin: this, parent: i.parent, entry: i };
552
- Object.defineProperty(i, this.settings.prop, {
620
+ async function o(s) {
621
+ let c2 = s[this.config.prop] || null;
622
+ const a2 = { plugin: this, parent: s.parent, entry: s };
623
+ Object.defineProperty(s, this.config.prop, {
553
624
  configurable: true,
554
625
  get() {
555
626
  return c2;
556
627
  },
557
- set: async (d2) => {
558
- if (c2 === d2) return;
628
+ set: async (f2) => {
629
+ if (c2 === f2) return;
559
630
  const p2 = c2;
560
- c2 = d2, r2(
561
- this.settings.condition,
562
- l,
563
- d2,
631
+ c2 = f2, h$2(
632
+ this.config.condition,
633
+ a2,
634
+ f2,
564
635
  p2
565
- ) && this.store.set(i.id, d2), await this.settings.onChange(l, d2, p2);
636
+ ) && this.store?.set(s.id, f2), await this.config.onChange(a2, f2, p2);
566
637
  }
567
- }), Object.defineProperty(i, "store", {
638
+ }), Object.defineProperty(s, "store", {
568
639
  configurable: true,
569
- get: () => this.store.get(i.id),
570
- set: (d2) => {
571
- i[this.settings.prop] = d2;
640
+ get: () => this.store?.get(s.id),
641
+ set: (f2) => {
642
+ s[this.config.prop] = f2;
572
643
  }
573
- }), i[this.settings.prop] = await r2(this.settings.value, l) || i[this.settings.prop];
574
- }
575
- function r2(i, ...c2) {
576
- return typeof i == "function" ? i(...c2) : i;
644
+ }), s[this.config.prop] = await h$2(this.config.value, a2) || s[this.config.prop];
577
645
  }
578
- async function a2(i) {
579
- const c2 = i[this.settings.prop];
580
- delete i[this.settings.prop], i[this.settings.prop] = c2, this.store.set(i.id, null);
646
+ async function r2(s) {
647
+ const c2 = s[this.config.prop];
648
+ delete s[this.config.prop], s[this.config.prop] = c2, this.store?.set(s.id, null);
581
649
  }
582
- function o(i) {
583
- const c2 = this.settings.prop.charAt(0).toUpperCase() + this.settings.prop.slice(1), l = this.settings.key || i + c2;
584
- return this.settings.keyPrefix + l;
650
+ function n(s) {
651
+ const c2 = this.config.prop.charAt(0).toUpperCase() + this.config.prop.slice(1), a2 = this.config.key || s + c2;
652
+ return this.config.keyPrefix + a2;
585
653
  }
586
654
  return { ...t, ...e };
587
655
  }
588
- const B = {
656
+ const j$1 = {
589
657
  where: null,
590
658
  how: "append"
591
659
  };
592
- function tt$1(n = {}) {
660
+ function it$1(i = {}) {
593
661
  const t = {
594
662
  name: "teleport",
595
- defaults: B,
596
- options: n
663
+ config: j$1,
664
+ options: i
597
665
  }, e = {
598
- onCreateEntry({ plugin: a2, entry: o }) {
599
- s(a2, o);
666
+ onCreateEntry({ entry: n }) {
667
+ o(this, n);
600
668
  },
601
- onDestroyEntry({ plugin: a2, entry: o }) {
602
- r2(a2, o);
669
+ onDestroyEntry({ entry: n }) {
670
+ r2(this, n);
603
671
  }
604
672
  };
605
- function s(a2, o) {
606
- o.teleport = () => {
607
- typeof o.teleportReturn == "function" && o.teleportReturn(), o.teleportReturn = x$2(
608
- o.el,
609
- o.getSetting("teleport", { fallback: a2.settings.where }),
610
- o.getSetting("teleportMethod", { fallback: a2.settings.how })
673
+ function o(n, s) {
674
+ s.teleport = () => {
675
+ typeof s.teleportReturn == "function" && s.teleportReturn(), s.teleportReturn = k$3(
676
+ s.el,
677
+ s.config.get("teleport", { fallback: n.config.where }),
678
+ s.config.get("teleportMethod", { fallback: n.config.how })
611
679
  );
612
- }, o.teleport(), o.parent.emit("teleport", { plugin: a2, parent: o.parent, entry: o });
680
+ }, s.teleport(), s.parent.emit("teleport", { plugin: n, parent: s.parent, entry: s });
613
681
  }
614
- function r2(a2, o) {
615
- typeof o.teleportReturn == "function" && o.teleportReturn(), o.parent.emit("teleportReturn", {
616
- plugin: a2,
617
- parent: o.parent,
618
- entry: o
682
+ function r2(n, s) {
683
+ typeof s.teleportReturn == "function" && s.teleportReturn(), s.parent.emit("teleportReturn", {
684
+ plugin: n,
685
+ parent: s.parent,
686
+ entry: s
619
687
  });
620
688
  }
621
689
  return { ...t, ...e };
622
690
  }
623
- const j$3 = {
624
- dataConfig: "config",
625
- customProps: []
626
- };
627
- let z$2 = class z {
628
- constructor(t, e, s = {}) {
629
- this.parent = t, this.el = E$3(e), this.settings = { ...s }, this.dataConfig = {}, this.customProps = {};
630
- }
631
- get id() {
632
- return this.el.id;
633
- }
634
- applySettings(t) {
635
- return Object.assign(this.settings, t);
636
- }
637
- getSetting(t, e) {
638
- return A$2.call(this, t, e);
639
- }
640
- buildDataConfig() {
641
- return Object.assign(
642
- this.dataConfig,
643
- k$3(this.el, this.getSetting("dataConfig"))
644
- );
645
- }
646
- buildCustomProps() {
647
- return Object.assign(this.customProps, M$2(this));
648
- }
649
- async init(t = {}) {
650
- this.applySettings(t), this.buildDataConfig(), this.buildCustomProps();
651
- }
652
- async destroy() {
653
- Object.getOwnPropertyNames(this).forEach((t) => {
654
- delete this[t];
655
- });
691
+ let z$1 = class z {
692
+ constructor(t, e) {
693
+ this.config = new I$3(), this.parent = t, this.el = v$2(e), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
656
694
  }
657
695
  };
658
- let et$1 = class et {
696
+ const J$1 = {
697
+ selector: "",
698
+ plugins: [],
699
+ presets: {}
700
+ };
701
+ let st$1 = class st {
659
702
  constructor(t = {}) {
660
- this.module = this.constructor.name, this.collection = [], this.entryClass = z$2, this.settings = { ...j$3, ...t }, this.plugins = new H$3(this.settings.presets), this.events = {}, Object.assign(this, L$2);
703
+ this.#t = new L$2(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = z$1, this.name = this.constructor.name, this.config = { ...J$1, ...t }, this.plugins = new H(this.config.presets);
661
704
  }
705
+ #t;
662
706
  get(t, e = "id") {
663
- return this.collection.find((s) => s[e] === t);
707
+ return this.collection.find((o) => o[e] === t);
664
708
  }
665
709
  getOrThrow(t, e = "id") {
666
- const s = this.get(t, e);
667
- if (s)
668
- return s;
710
+ const o = this.get(t, e);
711
+ if (o)
712
+ return o;
669
713
  throw new Error(
670
- `${this.module} entry not found in collection with ${e} of "${t}"`
714
+ `${this.name} entry not found in collection with ${String(e)} of "${t}"`
671
715
  );
672
716
  }
673
- applySettings(t) {
674
- return Object.assign(this.settings, t);
717
+ updateConfig(t = {}) {
718
+ return Object.assign(this.config, t);
675
719
  }
676
- async createEntry(t, e) {
677
- const s = new this.entryClass(this, t, e);
678
- return await g$1(s, "init"), await h$1("onCreateEntry", this, s), s;
720
+ async createEntry(t) {
721
+ const e = new this.entryClass(this, t);
722
+ return await g$2(e, "init"), await d$1("onCreateEntry", this, e), e;
679
723
  }
680
724
  async destroyEntry(t) {
681
- return await h$1("onDestroyEntry", this, t), await g$1(t, "destroy"), t;
682
- }
683
- async register(t, e = {}) {
684
- const s = E$3(t), r2 = this.collection.findIndex((a2) => a2.id === s.id);
685
- if (~r2) {
686
- const a2 = this.collection[r2];
687
- return a2.el = s, typeof a2.init == "function" && await a2.init(e), a2;
688
- } else {
689
- const a2 = await this.createEntry(s, e);
690
- return this.collection.push(a2), await h$1("onRegisterEntry", this, a2), a2;
691
- }
725
+ return await d$1("onDestroyEntry", this, t), await g$2(t, "destroy"), t;
726
+ }
727
+ async register(t) {
728
+ const e = this.collection.findIndex((o) => o.id === t.id);
729
+ return ~e ? this.collection[e] = t : this.collection.push(t), await d$1("onRegisterEntry", this, t), t;
692
730
  }
693
731
  async deregister(t) {
694
- const e = this.collection.findIndex((s) => s.id === t);
732
+ const e = this.collection.findIndex((o) => o.id === t.id);
695
733
  if (~e) {
696
- const s = await this.destroyEntry(this.collection[e]);
697
- return await h$1(
734
+ await d$1(
698
735
  "onDeregisterEntry",
699
736
  this,
700
737
  this.collection[e]
701
- ), this.collection.splice(e, 1), s;
738
+ );
739
+ const [o] = this.collection.splice(e, 1);
702
740
  }
703
- return null;
741
+ return t;
704
742
  }
705
- async mount(t = {}) {
706
- this.applySettings(t);
707
- for (const s of this.settings?.plugins || [])
708
- this.plugins.add(s);
709
- for (const s of this.plugins)
710
- await g$1(s, "setup", { plugin: s, parent: this });
711
- await h$1("beforeMount", this);
712
- const e = document.querySelectorAll(this.settings.selector);
713
- for (const s of e)
714
- await this.register(s);
715
- return await h$1("afterMount", this), this;
716
- }
717
- async unmount() {
718
- for (await h$1("beforeUnmount", this); this.collection.length > 0; )
719
- await this.deregister(this.collection[0].id);
720
- await h$1("afterUnmount", this);
721
- for (const t of this.plugins)
722
- await g$1(t, "teardown", { plugin: t, parent: this });
723
- for (const t of [...this.plugins])
724
- this.plugins.remove(t.name);
743
+ async mount(t = (e) => e) {
744
+ for (const e of this.config?.plugins || [])
745
+ this.plugins.add(e);
746
+ for (const e of this.plugins)
747
+ await g$2(e, "setup", this);
748
+ if (await d$1("beforeMount", this), this.config.selector) {
749
+ const e = document.querySelectorAll(this.config.selector);
750
+ for (const o of e)
751
+ await this.createEntry(o).then((r2) => t(r2)).then((r2) => this.register(r2));
752
+ }
753
+ return await d$1("afterMount", this), this;
754
+ }
755
+ async unmount(t = (e) => e) {
756
+ for (await d$1("beforeUnmount", this); this.collection.length > 0; )
757
+ await this.destroyEntry(this.collection[0]).then((e) => t(e)).then((e) => this.deregister(e));
758
+ await d$1("afterUnmount", this);
759
+ for (const e of this.plugins)
760
+ await g$2(e, "teardown", this);
761
+ for (const e of [...this.plugins])
762
+ this.plugins.remove(e.name);
725
763
  return this;
726
764
  }
727
765
  };
728
- function nt$1(n = {}) {
729
- const t = {
730
- prefix: R$2("prefix-themes", { fallback: "vb-theme-" }),
731
- themes: ["root", "light", "dark"],
732
- storeKey: "VB:Profile"
733
- };
734
- for (const [a2] of Object.entries(t))
735
- n && n[a2] && (t[a2] = n[a2]);
736
- const e = {
737
- onInit() {
738
- },
739
- onChange() {
740
- }
741
- };
742
- for (const [a2] of Object.entries(e))
743
- n && n[a2] && (e[a2] = n[a2]);
744
- const s = w$2(t.storeKey), r2 = {
745
- // Store our settings in the API
746
- settings: t,
766
+ const G = {
767
+ prefix: S$3("theme-prefix", { fallback: "vb-theme-" }),
768
+ storeKey: "VB:Profile",
769
+ fallback: "root",
770
+ themes: ["root", "light", "dark"],
771
+ onInit() {
772
+ },
773
+ onChange() {
774
+ }
775
+ };
776
+ function rt$1(i = {}) {
777
+ const t = { ...G, ...i };
778
+ function e(n) {
779
+ t[n].call(r2);
780
+ }
781
+ const o = w$2(t.storeKey), r2 = {
782
+ // Store our config in the API
783
+ config: t,
747
784
  // Actions
748
- add(a2) {
749
- t.themes.push(a2);
750
- },
751
- remove(a2) {
752
- const o = t.themes.indexOf(a2);
753
- ~o && t.themes.splice(o, 1);
785
+ add(n) {
786
+ t.themes.push(n);
754
787
  },
755
- callback(a2) {
756
- e[a2].call(this);
788
+ remove(n) {
789
+ const s = t.themes.indexOf(n);
790
+ ~s && t.themes.splice(s, 1);
757
791
  },
758
792
  // Getters
759
793
  get class() {
760
794
  return `${t.prefix}${this.theme}`;
761
795
  },
762
796
  get classes() {
763
- return t.themes.map((a2) => `${t.prefix}${a2}`);
797
+ return t.themes.map((n) => `${t.prefix}${n}`);
764
798
  },
765
799
  get themes() {
766
800
  return t.themes;
767
801
  },
768
802
  // Setup the theme get and set methods
769
803
  get theme() {
770
- return s.get("theme") || "root";
804
+ return o.get("theme") || t.fallback;
771
805
  },
772
- set theme(a2) {
773
- t.themes.includes(a2) ? this.theme != a2 && (s.set("theme", a2), document.documentElement.classList.remove(...this.classes), document.documentElement.classList.add(`${t.prefix}${a2}`), this.callback("onChange")) : console.error(`Not a valid theme value: "${a2}"`);
806
+ set theme(n) {
807
+ t.themes.includes(n) ? this.theme != n && (o.set("theme", n), document.documentElement.classList.remove(...this.classes), document.documentElement.classList.add(`${t.prefix}${n}`), e("onChange")) : console.error(`Not a valid theme value: "${n}"`);
774
808
  }
775
809
  };
776
- return r2.callback("onInit"), r2;
810
+ return e("onInit"), r2;
777
811
  }
778
812
  const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
779
813
  __proto__: null,
780
- Collection: et$1,
781
- CollectionEntry: z$2,
782
- FocusTrap: U$2,
783
- FocusableArray: O$2,
784
- PluginsArray: H$3,
785
- StackArray: W,
786
- cssVar: R$2,
787
- debug: Z,
788
- dispatchLifecycleHook: h$1,
789
- eventEmitter: L$2,
790
- focusTrap: _$1,
814
+ Collection: st$1,
815
+ CollectionEntry: z$1,
816
+ ConfigManager: I$3,
817
+ EventEmitter: L$2,
818
+ FocusTrap: D$2,
819
+ FocusableArray: U$1,
820
+ PluginArray: H,
821
+ StackArray: _,
822
+ attrConfig: X$1,
823
+ cssConfig: Y$1,
824
+ cssVar: S$3,
825
+ debug: tt$1,
826
+ dispatchLifecycleHook: d$1,
827
+ focusTrap: et$1,
791
828
  focusableSelectors: C$2,
792
- getCustomProps: M$2,
793
- getDataConfig: k$3,
794
- getElement: E$3,
829
+ getAttrData: x$2,
830
+ getCustomProps: b$2,
831
+ getElement: v$2,
795
832
  getPrefix: y$2,
796
- getSetting: A$2,
833
+ getValue: h$2,
797
834
  localStore: w$2,
798
- maybeRunMethod: g$1,
799
- mediaQuery: X$1,
800
- propStore: Y$1,
801
- setGlobalState: G,
802
- teleport: tt$1,
803
- teleportElement: x$2,
804
- themeStore: nt$1,
805
- toCamel: v$2,
806
- toKebab: $$2,
807
- toMilliseconds: S$2,
808
- transition: J$1
835
+ maybeRunMethod: g$2,
836
+ mediaQuery: ot$1,
837
+ propStore: nt$1,
838
+ setGlobalState: Z,
839
+ teleport: it$1,
840
+ teleportElement: k$3,
841
+ themeStore: rt$1,
842
+ toCamel: R$1,
843
+ toKebab: M$2,
844
+ toMilliseconds: A$3,
845
+ transition: W$1
809
846
  }, Symbol.toStringTag, { value: "Module" }));
810
- function E$2(t, e = "config") {
811
- const s = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
812
- return s ? JSON.parse(s) : {};
813
- }
814
- function f$1(t) {
847
+ function p$1(t) {
815
848
  if (typeof t == "string") {
816
849
  const e = document.getElementById(t);
817
850
  if (e) return e;
@@ -826,15 +859,7 @@
826
859
  async function r$1(t, e, ...s) {
827
860
  e in t && typeof t[e] == "function" && await t[e](...s);
828
861
  }
829
- function b$1(t) {
830
- return t.split("-").map(
831
- (e, s) => s === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)
832
- ).join("");
833
- }
834
- function p$1(t) {
835
- return t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
836
- }
837
- function C$1(t) {
862
+ function w$1(t) {
838
863
  if (typeof t == "number")
839
864
  return t;
840
865
  const e = parseFloat(t);
@@ -844,96 +869,127 @@
844
869
  }
845
870
  throw new Error(`Could not convert value to milliseconds: ${t}`);
846
871
  }
847
- function m$1(t, e, s, i, n = 0) {
848
- return new Promise((o) => {
872
+ function f(t, e, s, i, o = 0) {
873
+ return new Promise((n) => {
849
874
  t.classList.remove(e), t.classList.add(s), setTimeout(() => {
850
- t.classList.add(i), t.classList.remove(s), o(t);
851
- }, C$1(n));
875
+ t.classList.add(i), t.classList.remove(s), n(t);
876
+ }, w$1(o));
852
877
  });
853
878
  }
879
+ function v$1(t, e = {}) {
880
+ const s = {
881
+ fallback: null,
882
+ element: document.body,
883
+ ...e
884
+ };
885
+ if (!t.startsWith("--")) {
886
+ const o = E$1();
887
+ o && (t = `${o}${t}`), t = `--${t}`;
888
+ }
889
+ const i = getComputedStyle(s.element).getPropertyValue(t).trim();
890
+ if (i)
891
+ return i;
892
+ if (s.fallback)
893
+ return s.fallback;
894
+ throw new Error(`CSS variable "${t}" was not found!`);
895
+ }
854
896
  async function a$1(t, e, s) {
855
897
  await r$1(e, t, s), s && await r$1(s, t);
856
898
  for (const i of e.plugins)
857
- await r$1(i, t, { plugin: i, parent: e, entry: s });
858
- await e.emit(t, s);
899
+ await r$1(i, t, { parent: e, entry: s });
900
+ await e.emit(t, { parent: e, entry: s });
859
901
  }
860
- function O$1(t) {
861
- const e = getComputedStyle(t.el), s = {}, i = t.getSetting("customProps");
862
- for (let n = 0; n < i.length; n++) {
863
- const o = L$1(), l = t.parent.module.toLowerCase(), h2 = p$1(i[n]), u2 = e.getPropertyValue(`--${o}${l}-${h2}`).trim();
864
- u2 && (s[h2] = u2);
865
- }
866
- return s;
867
- }
868
- function L$1() {
902
+ function E$1() {
869
903
  return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
870
904
  }
871
- function $$1(t, e, s = "camel") {
872
- return e = s === "camel" ? b$1(e) : p$1(e), t.split(".").concat(e).reduce((i, n) => i?.[n], this);
873
- }
874
- function M$1(t, e = {}) {
875
- const {
876
- fallback: s,
877
- props: i = ["dataConfig", "customProps", "settings", "parent.settings"]
878
- } = e;
879
- for (const n of i) {
880
- const o = n !== "customProps" ? "camel" : "kebab", l = $$1.call(this, n, t, o);
881
- if (l !== void 0)
882
- return l;
883
- }
884
- if (s !== void 0)
885
- return s;
886
- throw new Error(`${this.parent.module} setting does not exist: ${t}`);
887
- }
888
- function P$2(t, e) {
905
+ function b$1(t, e) {
889
906
  e && document.querySelectorAll(e).forEach((s) => {
890
907
  t ? s.style.overflow = "hidden" : s.style.removeProperty("overflow");
891
908
  });
892
909
  }
893
- function T$2(t, e) {
910
+ function C$1(t, e) {
894
911
  e && document.querySelectorAll(e).forEach((s) => {
895
912
  s.inert = t;
896
913
  });
897
914
  }
898
915
  function c$1(t, e, s) {
899
- T$2(!!t, e), P$2(!!t, s);
916
+ C$1(!!t, e), b$1(!!t, s);
900
917
  }
901
- const x$1 = {
902
- events: {},
903
- on(t, e, ...s) {
904
- this.events[t] || (this.events[t] = []), this.events[t].some(
905
- (i) => i.listener === e
906
- ) || this.events[t].push({ listener: e, args: s });
907
- },
908
- off(t, e) {
909
- this.events[t] && (this.events[t] = this.events[t].filter(
910
- (s) => s.listener !== e
918
+ let S$2 = class S {
919
+ #t;
920
+ #e;
921
+ constructor() {
922
+ this.#t = {}, this.#e = [];
923
+ }
924
+ get(e, s) {
925
+ const { fallback: i, source: o } = s ?? {};
926
+ if (o) {
927
+ const n = this.#t?.[o]?.[e];
928
+ if (n !== void 0)
929
+ return n;
930
+ } else
931
+ for (const n of this.#e) {
932
+ const d2 = this.#t?.[n]?.[e];
933
+ if (d2 !== void 0)
934
+ return d2;
935
+ }
936
+ if (i !== void 0)
937
+ return i;
938
+ throw new Error(`Config does not exist: ${e}`);
939
+ }
940
+ set(e, s = {}) {
941
+ let i, o;
942
+ return typeof e == "string" ? (i = e, o = s) : (i = "entry", o = e), this.#t[i] ? Object.assign(this.#t[i], o) : (this.#e.unshift(i), this.#t[i] = o), this.#t[i];
943
+ }
944
+ remove(e) {
945
+ const s = this.#e.indexOf(e);
946
+ s !== -1 && this.#e.splice(s, 1), delete this.#t[e];
947
+ }
948
+ setSourceOrder(e) {
949
+ const s = Object.keys(this.#t).reverse(), i = e.filter((o) => s.includes(o));
950
+ for (const o of s)
951
+ i.includes(o) || i.push(o);
952
+ return this.#e = i;
953
+ }
954
+ };
955
+ let O$1 = class O {
956
+ constructor() {
957
+ this.events = {};
958
+ }
959
+ on(e, s, ...i) {
960
+ this.events[e] || (this.events[e] = []), this.events[e].some(
961
+ (o) => o.listener === s
962
+ ) || this.events[e].push({ listener: s, args: i });
963
+ }
964
+ off(e, s) {
965
+ this.events[e] && (this.events[e] = this.events[e].filter(
966
+ (i) => i.listener !== s
911
967
  ));
912
- },
913
- async emit(t, e) {
914
- if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
915
- for (const { listener: s, args: i } of this.events[t])
916
- await s(e, ...i);
968
+ }
969
+ async emit(e, ...s) {
970
+ if (e = e.startsWith("on") ? e.slice(2, 3).toLowerCase() + e.slice(3) : e, !!this.events[e])
971
+ for (const { listener: i, args: o } of this.events[e])
972
+ await i(...s, ...o);
917
973
  }
918
974
  };
919
- let y$1 = class y extends Array {
975
+ let L$1 = class L extends Array {
920
976
  constructor(e = {}) {
921
977
  super(), this.presets = e;
922
978
  }
923
- applySettings(e) {
924
- const s = e?.defaults || {}, i = this.presets?.[e.name] || {}, n = e?.options || {};
925
- e.settings = { ...s, ...i, ...n };
979
+ #t(e) {
980
+ const s = this.presets?.[e.name] || {}, i = e?.options || {};
981
+ e.config = { ...e.config, ...s, ...i };
926
982
  }
927
- validate(e) {
983
+ #e(e) {
928
984
  return !("name" in e) || typeof e.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
929
985
  }
930
986
  get(e) {
931
- return this.find((s) => s.name === e);
987
+ return this.find((s) => s.name === e) || null;
932
988
  }
933
989
  add(e) {
934
990
  if (Array.isArray(e))
935
991
  e.forEach((s) => this.add(s));
936
- else if (this.applySettings(e), this.validate(e)) {
992
+ else if (this.#t(e), this.#e(e)) {
937
993
  const s = this.findIndex((i) => i.name === e.name);
938
994
  ~s ? this[s] = e : this.push(e);
939
995
  }
@@ -943,45 +999,21 @@
943
999
  ~s && this.splice(s, 1);
944
1000
  }
945
1001
  };
946
- const A$1 = {
947
- dataConfig: "config",
948
- customProps: []
949
- };
950
- let w$1 = class w {
951
- constructor(e, s, i = {}) {
952
- this.parent = e, this.el = f$1(s), this.settings = { ...i }, this.dataConfig = {}, this.customProps = {};
953
- }
954
- get id() {
955
- return this.el.id;
956
- }
957
- applySettings(e) {
958
- return Object.assign(this.settings, e);
959
- }
960
- getSetting(e, s) {
961
- return M$1.call(this, e, s);
962
- }
963
- buildDataConfig() {
964
- return Object.assign(
965
- this.dataConfig,
966
- E$2(this.el, this.getSetting("dataConfig"))
967
- );
968
- }
969
- buildCustomProps() {
970
- return Object.assign(this.customProps, O$1(this));
971
- }
972
- async init(e = {}) {
973
- this.applySettings(e), this.buildDataConfig(), this.buildCustomProps();
974
- }
975
- async destroy() {
976
- Object.getOwnPropertyNames(this).forEach((e) => {
977
- delete this[e];
978
- });
1002
+ let g$1 = class g {
1003
+ constructor(e, s) {
1004
+ this.config = new S$2(), this.parent = e, this.el = p$1(s), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
979
1005
  }
980
1006
  };
981
- let D$2 = class D {
1007
+ const M$1 = {
1008
+ selector: "",
1009
+ plugins: [],
1010
+ presets: {}
1011
+ };
1012
+ let x$1 = class x {
982
1013
  constructor(e = {}) {
983
- this.module = this.constructor.name, this.collection = [], this.entryClass = w$1, this.settings = { ...A$1, ...e }, this.plugins = new y$1(this.settings.presets), this.events = {}, Object.assign(this, x$1);
1014
+ this.#t = new O$1(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = g$1, this.name = this.constructor.name, this.config = { ...M$1, ...e }, this.plugins = new L$1(this.config.presets);
984
1015
  }
1016
+ #t;
985
1017
  get(e, s = "id") {
986
1018
  return this.collection.find((i) => i[s] === e);
987
1019
  }
@@ -990,65 +1022,60 @@
990
1022
  if (i)
991
1023
  return i;
992
1024
  throw new Error(
993
- `${this.module} entry not found in collection with ${s} of "${e}"`
1025
+ `${this.name} entry not found in collection with ${String(s)} of "${e}"`
994
1026
  );
995
1027
  }
996
- applySettings(e) {
997
- return Object.assign(this.settings, e);
1028
+ updateConfig(e = {}) {
1029
+ return Object.assign(this.config, e);
998
1030
  }
999
- async createEntry(e, s) {
1000
- const i = new this.entryClass(this, e, s);
1001
- return await r$1(i, "init"), await a$1("onCreateEntry", this, i), i;
1031
+ async createEntry(e) {
1032
+ const s = new this.entryClass(this, e);
1033
+ return await r$1(s, "init"), await a$1("onCreateEntry", this, s), s;
1002
1034
  }
1003
1035
  async destroyEntry(e) {
1004
1036
  return await a$1("onDestroyEntry", this, e), await r$1(e, "destroy"), e;
1005
1037
  }
1006
- async register(e, s = {}) {
1007
- const i = f$1(e), n = this.collection.findIndex((o) => o.id === i.id);
1008
- if (~n) {
1009
- const o = this.collection[n];
1010
- return o.el = i, typeof o.init == "function" && await o.init(s), o;
1011
- } else {
1012
- const o = await this.createEntry(i, s);
1013
- return this.collection.push(o), await a$1("onRegisterEntry", this, o), o;
1014
- }
1038
+ async register(e) {
1039
+ const s = this.collection.findIndex((i) => i.id === e.id);
1040
+ return ~s ? this.collection[s] = e : this.collection.push(e), await a$1("onRegisterEntry", this, e), e;
1015
1041
  }
1016
1042
  async deregister(e) {
1017
- const s = this.collection.findIndex((i) => i.id === e);
1043
+ const s = this.collection.findIndex((i) => i.id === e.id);
1018
1044
  if (~s) {
1019
- const i = await this.destroyEntry(this.collection[s]);
1020
- return await a$1(
1045
+ await a$1(
1021
1046
  "onDeregisterEntry",
1022
1047
  this,
1023
1048
  this.collection[s]
1024
- ), this.collection.splice(s, 1), i;
1049
+ );
1050
+ const [i] = this.collection.splice(s, 1);
1025
1051
  }
1026
- return null;
1052
+ return e;
1027
1053
  }
1028
- async mount(e = {}) {
1029
- this.applySettings(e);
1030
- for (const i of this.settings?.plugins || [])
1031
- this.plugins.add(i);
1032
- for (const i of this.plugins)
1033
- await r$1(i, "setup", { plugin: i, parent: this });
1034
- await a$1("beforeMount", this);
1035
- const s = document.querySelectorAll(this.settings.selector);
1036
- for (const i of s)
1037
- await this.register(i);
1054
+ async mount(e = (s) => s) {
1055
+ for (const s of this.config?.plugins || [])
1056
+ this.plugins.add(s);
1057
+ for (const s of this.plugins)
1058
+ await r$1(s, "setup", this);
1059
+ if (await a$1("beforeMount", this), this.config.selector) {
1060
+ const s = document.querySelectorAll(this.config.selector);
1061
+ for (const i of s)
1062
+ await this.createEntry(i).then((o) => e(o)).then((o) => this.register(o));
1063
+ }
1038
1064
  return await a$1("afterMount", this), this;
1039
1065
  }
1040
- async unmount() {
1066
+ async unmount(e = (s) => s) {
1041
1067
  for (await a$1("beforeUnmount", this); this.collection.length > 0; )
1042
- await this.deregister(this.collection[0].id);
1068
+ await this.destroyEntry(this.collection[0]).then((s) => e(s)).then((s) => this.deregister(s));
1043
1069
  await a$1("afterUnmount", this);
1044
- for (const e of this.plugins)
1045
- await r$1(e, "teardown", { plugin: e, parent: this });
1046
- for (const e of [...this.plugins])
1047
- this.plugins.remove(e.name);
1070
+ for (const s of this.plugins)
1071
+ await r$1(s, "teardown", this);
1072
+ for (const s of [...this.plugins])
1073
+ this.plugins.remove(s.name);
1048
1074
  return this;
1049
1075
  }
1050
1076
  };
1051
- const I$2 = {
1077
+ v$1("theme-prefix", { fallback: "vb-theme-" });
1078
+ const T$1 = {
1052
1079
  focusTrap: {
1053
1080
  condition: ({ entry: t }) => t.state === "closed" || t.state === "opened" && t.mode === "modal"
1054
1081
  },
@@ -1063,11 +1090,11 @@
1063
1090
  condition: ({ entry: t }) => ["opened", "closed", "indeterminate"].includes(t.state),
1064
1091
  onChange: ({ entry: t }) => t.applyState()
1065
1092
  }
1066
- }, k$2 = {
1067
- presets: I$2,
1068
- dataOpen: "drawer-open",
1069
- dataClose: "drawer-close",
1070
- dataToggle: "drawer-toggle",
1093
+ }, $$1 = {
1094
+ presets: T$1,
1095
+ attrOpen: "drawer-open",
1096
+ attrClose: "drawer-close",
1097
+ attrToggle: "drawer-toggle",
1071
1098
  selector: ".drawer",
1072
1099
  selectorDialog: ".drawer__dialog",
1073
1100
  selectorScreen: ".drawer",
@@ -1086,93 +1113,93 @@
1086
1113
  transition: true,
1087
1114
  transitionDuration: 300
1088
1115
  };
1089
- function j$2(t) {
1116
+ function k$2(t) {
1090
1117
  switch (t.mode) {
1091
1118
  case "inline":
1092
- return q$2(t);
1119
+ return D$1(t);
1093
1120
  case "modal":
1094
- return H$2(t);
1121
+ return I$2(t);
1095
1122
  default:
1096
1123
  throw new Error(`"${t.mode}" is not a valid drawer mode.`);
1097
1124
  }
1098
1125
  }
1099
- async function q$2(t) {
1100
- return t.el.classList.remove(t.getSetting("classModal")), t.dialog.removeAttribute("aria-modal"), c$1(
1126
+ async function D$1(t) {
1127
+ return t.el.classList.remove(t.config.get("classModal")), t.dialog.removeAttribute("aria-modal"), c$1(
1101
1128
  false,
1102
- t.getSetting("selectorInert"),
1103
- t.getSetting("selectorOverflow")
1129
+ t.config.get("selectorInert"),
1130
+ t.config.get("selectorOverflow")
1104
1131
  ), t.applyState(), t.el.dispatchEvent(
1105
- new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
1132
+ new CustomEvent(t.config.get("customEventPrefix") + "switchMode", {
1106
1133
  detail: t.parent,
1107
1134
  bubbles: true
1108
1135
  })
1109
1136
  ), await t.parent.emit("switchMode", t), t;
1110
1137
  }
1111
- async function H$2(t) {
1112
- return t.el.classList.add(t.getSetting("classModal")), t.dialog.setAttribute("aria-modal", "true"), await t.close(false, false), t.el.dispatchEvent(
1113
- new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
1138
+ async function I$2(t) {
1139
+ return t.el.classList.add(t.config.get("classModal")), t.dialog.setAttribute("aria-modal", "true"), await t.close(false, false), t.el.dispatchEvent(
1140
+ new CustomEvent(t.config.get("customEventPrefix") + "switchMode", {
1114
1141
  detail: t.parent,
1115
1142
  bubbles: true
1116
1143
  })
1117
1144
  ), await t.parent.emit("switchMode", t), t;
1118
1145
  }
1119
- function S$1(t) {
1120
- t.dialog && t.state === "opened" ? (t.dialog.querySelector(t.parent.settings.selectorFocus) || t.dialog).focus() : t.trigger && (t.trigger.focus(), t.trigger = null);
1146
+ function u$1(t) {
1147
+ t.dialog && t.state === "opened" ? (t.dialog.querySelector(t.config.get("selectorFocus")) || t.dialog).focus() : t.trigger && (t.trigger.focus(), t.trigger = null);
1121
1148
  }
1122
- async function d$1(t, e, s = true) {
1123
- return (t.state === "closed" || t.state === "indeterminate" || t.state === null) && (t.setState("opening"), e ?? t.getSetting("transition") ? await m$1(
1149
+ async function l$1(t, e, s = true) {
1150
+ return (t.state === "closed" || t.state === "indeterminate" || t.state === null) && (t.setState("opening"), e ?? t.config.get("transition") ? await f(
1124
1151
  t.el,
1125
- t.getSetting("stateClosed"),
1126
- t.getSetting("stateOpening"),
1127
- t.getSetting("stateOpened"),
1128
- t.getSetting("transitionDuration")
1129
- ) : (t.el.classList.add(t.getSetting("stateOpened")), t.el.classList.remove(t.getSetting("stateClosed"))), t.setState("opened"), t.mode === "modal" && c$1(
1152
+ t.config.get("stateClosed"),
1153
+ t.config.get("stateOpening"),
1154
+ t.config.get("stateOpened"),
1155
+ t.config.get("transitionDuration")
1156
+ ) : (t.el.classList.add(t.config.get("stateOpened")), t.el.classList.remove(t.config.get("stateClosed"))), t.setState("opened"), t.mode === "modal" && c$1(
1130
1157
  true,
1131
- t.getSetting("selectorInert"),
1132
- t.getSetting("selectorOverflow")
1133
- ), s && S$1(t), t.el.dispatchEvent(
1134
- new CustomEvent(t.getSetting("customEventPrefix") + "opened", {
1158
+ t.config.get("selectorInert"),
1159
+ t.config.get("selectorOverflow")
1160
+ ), s && u$1(t), t.el.dispatchEvent(
1161
+ new CustomEvent(t.config.get("customEventPrefix") + "opened", {
1135
1162
  detail: t.parent,
1136
1163
  bubbles: true
1137
1164
  })
1138
1165
  ), await t.parent.emit("opened", t)), t;
1139
1166
  }
1140
- async function g(t, e, s = true) {
1141
- return (t.state === "opened" || t.state === "indeterminate" || t.state === null) && (t.setState("closing"), document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), e ?? t.getSetting("transition") ? await m$1(
1167
+ async function h$1(t, e, s = true) {
1168
+ return (t.state === "opened" || t.state === "indeterminate" || t.state === null) && (t.setState("closing"), document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), e ?? t.config.get("transition") ? await f(
1142
1169
  t.el,
1143
- t.getSetting("stateOpened"),
1144
- t.getSetting("stateClosing"),
1145
- t.getSetting("stateClosed"),
1146
- t.getSetting("transitionDuration")
1147
- ) : (t.el.classList.add(t.getSetting("stateClosed")), t.el.classList.remove(t.getSetting("stateOpened"))), t.setState("closed"), t.mode === "modal" && c$1(
1170
+ t.config.get("stateOpened"),
1171
+ t.config.get("stateClosing"),
1172
+ t.config.get("stateClosed"),
1173
+ t.config.get("transitionDuration")
1174
+ ) : (t.el.classList.add(t.config.get("stateClosed")), t.el.classList.remove(t.config.get("stateOpened"))), t.setState("closed"), t.mode === "modal" && c$1(
1148
1175
  false,
1149
- t.getSetting("selectorInert"),
1150
- t.getSetting("selectorOverflow")
1151
- ), s && S$1(t), t.el.dispatchEvent(
1152
- new CustomEvent(t.getSetting("customEventPrefix") + "closed", {
1176
+ t.config.get("selectorInert"),
1177
+ t.config.get("selectorOverflow")
1178
+ ), s && u$1(t), t.el.dispatchEvent(
1179
+ new CustomEvent(t.config.get("customEventPrefix") + "closed", {
1153
1180
  detail: t.parent,
1154
1181
  bubbles: true
1155
1182
  })
1156
1183
  ), await t.parent.emit("closed", t)), t;
1157
1184
  }
1158
- async function v$1(t, e, s) {
1159
- return t.state === "closed" ? d$1(t, e, s) : g(t, e, s);
1185
+ async function m$1(t, e, s) {
1186
+ return t.state === "closed" ? l$1(t, e, s) : h$1(t, e, s);
1160
1187
  }
1161
- class N extends w$1 {
1188
+ let A$2 = class A extends g$1 {
1162
1189
  #t;
1163
- constructor(e, s, i = {}) {
1164
- super(e, s, i), this.#t = "indeterminate", this.dialog = this.el.querySelector(this.getSetting("selectorDialog")) || this.el, this.trigger = null, this.state = null, this.inlineState = null;
1190
+ constructor(e, s) {
1191
+ super(e, s), this.#t = "indeterminate", this.dialog = this.el.querySelector(this.config.get("selectorDialog")) || this.el, this.trigger = null, this.state = null, this.inlineState = null;
1165
1192
  }
1166
1193
  get mode() {
1167
1194
  return this.#t;
1168
1195
  }
1169
1196
  set mode(e) {
1170
- this.#t !== e && (this.#t = e, j$2(this));
1197
+ this.#t !== e && (this.#t = e, k$2(this));
1171
1198
  }
1172
1199
  setState(e) {
1173
1200
  this.state = e;
1174
1201
  const s = ["opening", "closing"];
1175
- this.mode === "inline" && !s.includes(e) && (this.inlineState = e), e === "indeterminate" && (this.el.classList.remove(this.getSetting("stateOpened")), this.el.classList.remove(this.getSetting("stateOpening")), this.el.classList.remove(this.getSetting("stateClosed")), this.el.classList.remove(this.getSetting("stateClosing")));
1202
+ this.mode === "inline" && !s.includes(e) && (this.inlineState = e), e === "indeterminate" && (this.el.classList.remove(this.config.get("stateOpened")), this.el.classList.remove(this.config.get("stateOpening")), this.el.classList.remove(this.config.get("stateClosed")), this.el.classList.remove(this.config.get("stateClosing")));
1176
1203
  }
1177
1204
  async applyState() {
1178
1205
  if (this.mode === "modal") return this;
@@ -1181,86 +1208,86 @@
1181
1208
  if (this.inlineState === "closed")
1182
1209
  return await this.close(false, false);
1183
1210
  if (this.state === null) {
1184
- if (this.el.classList.contains(this.getSetting("stateOpened")))
1211
+ if (this.el.classList.contains(this.config.get("stateOpened")))
1185
1212
  return await this.open(false, false);
1186
- if (this.el.classList.contains(this.getSetting("stateClosed")))
1213
+ if (this.el.classList.contains(this.config.get("stateClosed")))
1187
1214
  return await this.close(false, false);
1188
1215
  }
1189
1216
  return this.setState("indeterminate"), this;
1190
1217
  }
1191
1218
  async open(e, s) {
1192
- return d$1(this, e, s);
1219
+ return l$1(this, e, s);
1193
1220
  }
1194
1221
  async close(e, s) {
1195
- return g(this, e, s);
1222
+ return h$1(this, e, s);
1196
1223
  }
1197
1224
  async toggle(e, s) {
1198
- return v$1(this, e, s);
1225
+ return m$1(this, e, s);
1199
1226
  }
1200
1227
  async deregister() {
1201
- return this.parent.deregister(this.id);
1228
+ return this.parent.deregister(this);
1202
1229
  }
1203
1230
  async onCreateEntry() {
1204
- this.getSetting("setTabindex") && this.dialog && this.dialog.setAttribute("tabindex", "-1"), await this.applyState(), this.inlineState = this.state, this.mode = this.el && this.el.classList.contains(this.getSetting("classModal")) ? "modal" : "inline";
1231
+ this.config.get("setTabindex") && this.dialog && this.dialog.setAttribute("tabindex", "-1"), await this.applyState(), this.inlineState = this.state, this.mode = this.el && this.el.classList.contains(this.config.get("classModal")) ? "modal" : "inline";
1205
1232
  }
1206
1233
  async onDestroyEntry() {
1207
1234
  this.mode === "modal" && this.state === "opened" && await this.close(false);
1208
1235
  }
1209
- }
1210
- async function F$1(t) {
1236
+ };
1237
+ async function P$2(t) {
1211
1238
  const e = t.target;
1212
1239
  if (e) {
1213
1240
  const s = e.closest(`
1214
- [data-${this.settings.dataOpen}],
1215
- [data-${this.settings.dataToggle}],
1216
- [data-${this.settings.dataClose}]
1241
+ [data-${this.config.attrOpen}],
1242
+ [data-${this.config.attrToggle}],
1243
+ [data-${this.config.attrClose}]
1217
1244
  `);
1218
1245
  if (s) {
1219
- t.preventDefault(), s.matches(`[data-${this.settings.dataToggle}]`) && s.getAttribute(`data-${this.settings.dataToggle}`)?.trim().split(" ")?.forEach((n) => {
1220
- const o = this.getOrThrow(n);
1221
- return o.trigger = s, o.toggle();
1222
- }), s.matches(`[data-${this.settings.dataOpen}]`) && s.getAttribute(`data-${this.settings.dataOpen}`)?.trim().split(" ")?.forEach((n) => {
1223
- const o = this.getOrThrow(n);
1224
- return o.trigger = s, o.open();
1225
- }), s.matches(`[data-${this.settings.dataClose}]`) && s.getAttribute(`data-${this.settings.dataClose}`)?.trim().split(" ")?.forEach((n) => {
1226
- if (n) {
1227
- const o = this.getOrThrow(n);
1228
- return o.trigger = s, o.close();
1246
+ t.preventDefault(), s.matches(`[data-${this.config.attrToggle}]`) && s.getAttribute(`data-${this.config.attrToggle}`)?.trim().split(" ")?.forEach((o) => {
1247
+ const n = this.getOrThrow(o);
1248
+ return n.trigger = s, n.toggle();
1249
+ }), s.matches(`[data-${this.config.attrOpen}]`) && s.getAttribute(`data-${this.config.attrOpen}`)?.trim().split(" ")?.forEach((o) => {
1250
+ const n = this.getOrThrow(o);
1251
+ return n.trigger = s, n.open();
1252
+ }), s.matches(`[data-${this.config.attrClose}]`) && s.getAttribute(`data-${this.config.attrClose}`)?.trim().split(" ")?.forEach((o) => {
1253
+ if (o) {
1254
+ const n = this.getOrThrow(o);
1255
+ return n.trigger = s, n.close();
1229
1256
  } else {
1230
- const o = e.closest(this.settings.selector);
1231
- if (o) return this.close(o.id);
1257
+ const n = e.closest(this.config.selector);
1258
+ if (n) return this.close(n.id);
1232
1259
  }
1233
1260
  });
1234
1261
  return;
1235
1262
  }
1236
- if (this.activeModal && e.matches(this.settings.selectorScreen))
1263
+ if (this.activeModal && e.matches(this.config.selectorScreen))
1237
1264
  return this.close(this.activeModal.id);
1238
1265
  }
1239
1266
  }
1240
- function U$1(t) {
1267
+ function y$1(t) {
1241
1268
  if (t.key === "Escape" && this.activeModal)
1242
1269
  return this.close(this.activeModal.id);
1243
1270
  }
1244
- class _ extends D$2 {
1245
- #t;
1246
- #e;
1271
+ let q$1 = class q extends x$1 {
1247
1272
  constructor(e) {
1248
- super({ ...k$2, ...e }), this.module = "Drawer", this.entryClass = N, this.#t = F$1.bind(this), this.#e = U$1.bind(this);
1273
+ super({ ...$$1, ...e }), this.entryClass = A$2, this.name = "Drawer", this.#t = P$2.bind(this), this.#e = y$1.bind(this);
1249
1274
  }
1275
+ #t;
1276
+ #e;
1250
1277
  get activeModal() {
1251
1278
  return this.collection.find((e) => e.state === "opened" && e.mode === "modal");
1252
1279
  }
1253
1280
  async open(e, s, i) {
1254
- const n = this.getOrThrow(e);
1255
- return d$1(n, s, i);
1281
+ const o = this.getOrThrow(e);
1282
+ return l$1(o, s, i);
1256
1283
  }
1257
1284
  async close(e, s, i) {
1258
- const n = this.getOrThrow(e);
1259
- return g(n, s, i);
1285
+ const o = this.getOrThrow(e);
1286
+ return h$1(o, s, i);
1260
1287
  }
1261
1288
  async toggle(e, s, i) {
1262
- const n = this.getOrThrow(e);
1263
- return v$1(n, s, i);
1289
+ const o = this.getOrThrow(e);
1290
+ return m$1(o, s, i);
1264
1291
  }
1265
1292
  async afterMount() {
1266
1293
  document.addEventListener("click", this.#t, false), document.addEventListener("keydown", this.#e, false);
@@ -1268,146 +1295,165 @@
1268
1295
  async afterUnmount() {
1269
1296
  document.removeEventListener("click", this.#t, false), document.removeEventListener("keydown", this.#e, false);
1270
1297
  }
1271
- }
1272
- function y(e, t = "config") {
1273
- const s = (e.getAttribute(`data-${t}`) || "").replace(/'/g, '"');
1274
- return s ? JSON.parse(s) : {};
1275
- }
1276
- function f(e) {
1277
- if (typeof e == "string") {
1278
- const t = document.getElementById(e);
1298
+ };
1299
+ function p(s) {
1300
+ if (typeof s == "string") {
1301
+ const t = document.getElementById(s);
1279
1302
  if (t) return t;
1280
- throw new Error(`Element not found with ID: "${e}"`);
1281
- } else if (e instanceof HTMLElement) {
1282
- if (!e.id)
1303
+ throw new Error(`Element not found with ID: "${s}"`);
1304
+ } else if (s instanceof HTMLElement) {
1305
+ if (!s.id)
1283
1306
  throw new Error("HTMLElement must have an ID");
1284
- return e;
1307
+ return s;
1285
1308
  } else
1286
1309
  throw new Error("Invalid argument: query must be a string or HTMLElement");
1287
1310
  }
1288
- async function r(e, t, ...s) {
1289
- t in e && typeof e[t] == "function" && await e[t](...s);
1290
- }
1291
- function C(e) {
1292
- return e.split("-").map(
1293
- (t, s) => s === 0 ? t : t.charAt(0).toUpperCase() + t.slice(1)
1294
- ).join("");
1295
- }
1296
- function p(e) {
1297
- return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1311
+ async function a(s, t, ...e) {
1312
+ t in s && typeof s[t] == "function" && await s[t](...e);
1298
1313
  }
1299
- function S(e) {
1300
- if (typeof e == "number")
1301
- return e;
1302
- const t = parseFloat(e);
1314
+ function m(s) {
1315
+ if (typeof s == "number")
1316
+ return s;
1317
+ const t = parseFloat(s);
1303
1318
  if (!Number.isNaN(t)) {
1304
- const s = e.includes("ms");
1305
- return t * (s ? 1 : 1e3);
1319
+ const e = s.includes("ms");
1320
+ return t * (e ? 1 : 1e3);
1306
1321
  }
1307
- throw new Error(`Could not convert value to milliseconds: ${e}`);
1322
+ throw new Error(`Could not convert value to milliseconds: ${s}`);
1308
1323
  }
1309
- function m(e, t, s, i, n = 0) {
1324
+ function u(s, t, e, i, n = 0) {
1310
1325
  return new Promise((o) => {
1311
- e.classList.remove(t), e.classList.add(s), setTimeout(() => {
1312
- e.classList.add(i), e.classList.remove(s), o(e);
1313
- }, S(n));
1326
+ s.classList.remove(t), s.classList.add(e), setTimeout(() => {
1327
+ s.classList.add(i), s.classList.remove(e), o(s);
1328
+ }, m(n));
1314
1329
  });
1315
1330
  }
1316
- async function a(e, t, s) {
1317
- await r(t, e, s), s && await r(s, e);
1318
- for (const i of t.plugins)
1319
- await r(i, e, { plugin: i, parent: t, entry: s });
1320
- await t.emit(e, s);
1321
- }
1322
- function E$1(e) {
1323
- const t = getComputedStyle(e.el), s = {}, i = e.getSetting("customProps");
1324
- for (let n = 0; n < i.length; n++) {
1325
- const o = b(), l = e.parent.module.toLowerCase(), u2 = p(i[n]), g2 = t.getPropertyValue(`--${o}${l}-${u2}`).trim();
1326
- g2 && (s[u2] = g2);
1331
+ function w(s, t = {}) {
1332
+ const e = {
1333
+ fallback: null,
1334
+ element: document.body,
1335
+ ...t
1336
+ };
1337
+ if (!s.startsWith("--")) {
1338
+ const n = v();
1339
+ n && (s = `${n}${s}`), s = `--${s}`;
1327
1340
  }
1328
- return s;
1329
- }
1330
- function b() {
1331
- return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
1341
+ const i = getComputedStyle(e.element).getPropertyValue(s).trim();
1342
+ if (i)
1343
+ return i;
1344
+ if (e.fallback)
1345
+ return e.fallback;
1346
+ throw new Error(`CSS variable "${s}" was not found!`);
1332
1347
  }
1333
- function O(e, t, s = "camel") {
1334
- return t = s === "camel" ? C(t) : p(t), e.split(".").concat(t).reduce((i, n) => i?.[n], this);
1348
+ async function r(s, t, e) {
1349
+ await a(t, s, e), e && await a(e, s);
1350
+ for (const i of t.plugins)
1351
+ await a(i, s, { parent: t, entry: e });
1352
+ await t.emit(s, { parent: t, entry: e });
1335
1353
  }
1336
- function x(e, t = {}) {
1337
- const {
1338
- fallback: s,
1339
- props: i = ["dataConfig", "customProps", "settings", "parent.settings"]
1340
- } = t;
1341
- for (const n of i) {
1342
- const o = n !== "customProps" ? "camel" : "kebab", l = O.call(this, n, e, o);
1343
- if (l !== void 0)
1344
- return l;
1345
- }
1346
- if (s !== void 0)
1347
- return s;
1348
- throw new Error(`${this.parent.module} setting does not exist: ${e}`);
1354
+ function v() {
1355
+ return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
1349
1356
  }
1350
- function L(e, t) {
1351
- t && document.querySelectorAll(t).forEach((s) => {
1352
- e ? s.style.overflow = "hidden" : s.style.removeProperty("overflow");
1357
+ function y(s, t) {
1358
+ t && document.querySelectorAll(t).forEach((e) => {
1359
+ s ? e.style.overflow = "hidden" : e.style.removeProperty("overflow");
1353
1360
  });
1354
1361
  }
1355
- function A(e, t) {
1356
- t && document.querySelectorAll(t).forEach((s) => {
1357
- s.inert = e;
1362
+ function E(s, t) {
1363
+ t && document.querySelectorAll(t).forEach((e) => {
1364
+ e.inert = s;
1358
1365
  });
1359
1366
  }
1360
- function $(e, t, s) {
1361
- A(!!e, t), L(!!e, s);
1367
+ function b(s, t, e) {
1368
+ E(!!s, t), y(!!s, e);
1362
1369
  }
1363
- const P$1 = {
1364
- events: {},
1365
- on(e, t, ...s) {
1366
- this.events[e] || (this.events[e] = []), this.events[e].some(
1367
- (i) => i.listener === t
1368
- ) || this.events[e].push({ listener: t, args: s });
1369
- },
1370
- off(e, t) {
1371
- this.events[e] && (this.events[e] = this.events[e].filter(
1372
- (s) => s.listener !== t
1370
+ class C {
1371
+ #t;
1372
+ #e;
1373
+ constructor() {
1374
+ this.#t = {}, this.#e = [];
1375
+ }
1376
+ get(t, e) {
1377
+ const { fallback: i, source: n } = e ?? {};
1378
+ if (n) {
1379
+ const o = this.#t?.[n]?.[t];
1380
+ if (o !== void 0)
1381
+ return o;
1382
+ } else
1383
+ for (const o of this.#e) {
1384
+ const f2 = this.#t?.[o]?.[t];
1385
+ if (f2 !== void 0)
1386
+ return f2;
1387
+ }
1388
+ if (i !== void 0)
1389
+ return i;
1390
+ throw new Error(`Config does not exist: ${t}`);
1391
+ }
1392
+ set(t, e = {}) {
1393
+ let i, n;
1394
+ return typeof t == "string" ? (i = t, n = e) : (i = "entry", n = t), this.#t[i] ? Object.assign(this.#t[i], n) : (this.#e.unshift(i), this.#t[i] = n), this.#t[i];
1395
+ }
1396
+ remove(t) {
1397
+ const e = this.#e.indexOf(t);
1398
+ e !== -1 && this.#e.splice(e, 1), delete this.#t[t];
1399
+ }
1400
+ setSourceOrder(t) {
1401
+ const e = Object.keys(this.#t).reverse(), i = t.filter((n) => e.includes(n));
1402
+ for (const n of e)
1403
+ i.includes(n) || i.push(n);
1404
+ return this.#e = i;
1405
+ }
1406
+ }
1407
+ class x {
1408
+ constructor() {
1409
+ this.events = {};
1410
+ }
1411
+ on(t, e, ...i) {
1412
+ this.events[t] || (this.events[t] = []), this.events[t].some(
1413
+ (n) => n.listener === e
1414
+ ) || this.events[t].push({ listener: e, args: i });
1415
+ }
1416
+ off(t, e) {
1417
+ this.events[t] && (this.events[t] = this.events[t].filter(
1418
+ (i) => i.listener !== e
1373
1419
  ));
1374
- },
1375
- async emit(e, t) {
1376
- if (e = e.startsWith("on") ? e.slice(2, 3).toLowerCase() + e.slice(3) : e, !!this.events[e])
1377
- for (const { listener: s, args: i } of this.events[e])
1378
- await s(t, ...i);
1379
1420
  }
1380
- };
1381
- let I$1 = class I extends Array {
1421
+ async emit(t, ...e) {
1422
+ if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
1423
+ for (const { listener: i, args: n } of this.events[t])
1424
+ await i(...e, ...n);
1425
+ }
1426
+ }
1427
+ class O extends Array {
1382
1428
  constructor(t = {}) {
1383
1429
  super(), this.presets = t;
1384
1430
  }
1385
- applySettings(t) {
1386
- const s = t?.defaults || {}, i = this.presets?.[t.name] || {}, n = t?.options || {};
1387
- t.settings = { ...s, ...i, ...n };
1431
+ #t(t) {
1432
+ const e = this.presets?.[t.name] || {}, i = t?.options || {};
1433
+ t.config = { ...t.config, ...e, ...i };
1388
1434
  }
1389
- validate(t) {
1435
+ #e(t) {
1390
1436
  return !("name" in t) || typeof t.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
1391
1437
  }
1392
1438
  get(t) {
1393
- return this.find((s) => s.name === t);
1439
+ return this.find((e) => e.name === t) || null;
1394
1440
  }
1395
1441
  add(t) {
1396
1442
  if (Array.isArray(t))
1397
- t.forEach((s) => this.add(s));
1398
- else if (this.applySettings(t), this.validate(t)) {
1399
- const s = this.findIndex((i) => i.name === t.name);
1400
- ~s ? this[s] = t : this.push(t);
1443
+ t.forEach((e) => this.add(e));
1444
+ else if (this.#t(t), this.#e(t)) {
1445
+ const e = this.findIndex((i) => i.name === t.name);
1446
+ ~e ? this[e] = t : this.push(t);
1401
1447
  }
1402
1448
  }
1403
1449
  remove(t) {
1404
- const s = this.findIndex((i) => i.name === t);
1405
- ~s && this.splice(s, 1);
1450
+ const e = this.findIndex((i) => i.name === t);
1451
+ ~e && this.splice(e, 1);
1406
1452
  }
1407
- };
1408
- let T$1 = class T extends Array {
1453
+ }
1454
+ class L extends Array {
1409
1455
  constructor(t = {}) {
1410
- super(), this.settings = t;
1456
+ super(), this.config = t;
1411
1457
  }
1412
1458
  get copy() {
1413
1459
  return [...this];
@@ -1416,137 +1462,108 @@
1416
1462
  return this[this.length - 1] || null;
1417
1463
  }
1418
1464
  updateIndex() {
1419
- this.forEach((t, s) => {
1465
+ this.forEach((t, e) => {
1420
1466
  t.el.style.zIndex = "";
1421
- const i = getComputedStyle(t.el)["z-index"];
1422
- t.el.style.zIndex = String(parseInt(i, 10) + s + 1);
1467
+ const i = getComputedStyle(t.el).getPropertyValue("z-index"), n = parseInt(i, 10), o = String((Number.isNaN(n) ? 0 : n) + e + 1);
1468
+ t.el.style.zIndex = o;
1423
1469
  });
1424
1470
  }
1425
1471
  onChange() {
1426
- this.updateIndex(), typeof this.settings.onChange == "function" && this.settings.onChange();
1472
+ this.updateIndex(), typeof this.config.onChange == "function" && this.config.onChange();
1427
1473
  }
1428
1474
  add(t) {
1429
1475
  this.push(t), this.onChange();
1430
1476
  }
1431
1477
  remove(t) {
1432
- const s = this.findIndex((i) => i.id === t.id);
1433
- ~s && (t.el.style.zIndex = "", this.splice(s, 1), this.onChange());
1478
+ const e = this.findIndex((i) => i.id === t.id);
1479
+ ~e && (t.el.style.zIndex = "", this.splice(e, 1), this.onChange());
1434
1480
  }
1435
1481
  moveToTop(t) {
1436
- const s = this.findIndex((i) => i.id === t.id);
1437
- ~s && (this.splice(s, 1), this.add(t));
1438
- }
1439
- };
1440
- const k$1 = {
1441
- dataConfig: "config",
1442
- customProps: []
1443
- };
1444
- class w {
1445
- constructor(t, s, i = {}) {
1446
- this.parent = t, this.el = f(s), this.settings = { ...i }, this.dataConfig = {}, this.customProps = {};
1447
- }
1448
- get id() {
1449
- return this.el.id;
1450
- }
1451
- applySettings(t) {
1452
- return Object.assign(this.settings, t);
1453
- }
1454
- getSetting(t, s) {
1455
- return x.call(this, t, s);
1456
- }
1457
- buildDataConfig() {
1458
- return Object.assign(
1459
- this.dataConfig,
1460
- y(this.el, this.getSetting("dataConfig"))
1461
- );
1462
- }
1463
- buildCustomProps() {
1464
- return Object.assign(this.customProps, E$1(this));
1465
- }
1466
- async init(t = {}) {
1467
- this.applySettings(t), this.buildDataConfig(), this.buildCustomProps();
1482
+ const e = this.findIndex((i) => i.id === t.id);
1483
+ ~e && (this.splice(e, 1), this.add(t));
1468
1484
  }
1469
- async destroy() {
1470
- Object.getOwnPropertyNames(this).forEach((t) => {
1471
- delete this[t];
1472
- });
1485
+ }
1486
+ class d {
1487
+ constructor(t, e) {
1488
+ this.config = new C(), this.parent = t, this.el = p(e), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
1473
1489
  }
1474
1490
  }
1475
- class M {
1491
+ const k$1 = {
1492
+ selector: "",
1493
+ plugins: [],
1494
+ presets: {}
1495
+ };
1496
+ let A$1 = class A {
1476
1497
  constructor(t = {}) {
1477
- this.module = this.constructor.name, this.collection = [], this.entryClass = w, this.settings = { ...k$1, ...t }, this.plugins = new I$1(this.settings.presets), this.events = {}, Object.assign(this, P$1);
1498
+ this.#t = new x(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = d, this.name = this.constructor.name, this.config = { ...k$1, ...t }, this.plugins = new O(this.config.presets);
1478
1499
  }
1479
- get(t, s = "id") {
1480
- return this.collection.find((i) => i[s] === t);
1500
+ #t;
1501
+ get(t, e = "id") {
1502
+ return this.collection.find((i) => i[e] === t);
1481
1503
  }
1482
- getOrThrow(t, s = "id") {
1483
- const i = this.get(t, s);
1504
+ getOrThrow(t, e = "id") {
1505
+ const i = this.get(t, e);
1484
1506
  if (i)
1485
1507
  return i;
1486
1508
  throw new Error(
1487
- `${this.module} entry not found in collection with ${s} of "${t}"`
1509
+ `${this.name} entry not found in collection with ${String(e)} of "${t}"`
1488
1510
  );
1489
1511
  }
1490
- applySettings(t) {
1491
- return Object.assign(this.settings, t);
1512
+ updateConfig(t = {}) {
1513
+ return Object.assign(this.config, t);
1492
1514
  }
1493
- async createEntry(t, s) {
1494
- const i = new this.entryClass(this, t, s);
1495
- return await r(i, "init"), await a("onCreateEntry", this, i), i;
1515
+ async createEntry(t) {
1516
+ const e = new this.entryClass(this, t);
1517
+ return await a(e, "init"), await r("onCreateEntry", this, e), e;
1496
1518
  }
1497
1519
  async destroyEntry(t) {
1498
- return await a("onDestroyEntry", this, t), await r(t, "destroy"), t;
1520
+ return await r("onDestroyEntry", this, t), await a(t, "destroy"), t;
1499
1521
  }
1500
- async register(t, s = {}) {
1501
- const i = f(t), n = this.collection.findIndex((o) => o.id === i.id);
1502
- if (~n) {
1503
- const o = this.collection[n];
1504
- return o.el = i, typeof o.init == "function" && await o.init(s), o;
1505
- } else {
1506
- const o = await this.createEntry(i, s);
1507
- return this.collection.push(o), await a("onRegisterEntry", this, o), o;
1508
- }
1522
+ async register(t) {
1523
+ const e = this.collection.findIndex((i) => i.id === t.id);
1524
+ return ~e ? this.collection[e] = t : this.collection.push(t), await r("onRegisterEntry", this, t), t;
1509
1525
  }
1510
1526
  async deregister(t) {
1511
- const s = this.collection.findIndex((i) => i.id === t);
1512
- if (~s) {
1513
- const i = await this.destroyEntry(this.collection[s]);
1514
- return await a(
1527
+ const e = this.collection.findIndex((i) => i.id === t.id);
1528
+ if (~e) {
1529
+ await r(
1515
1530
  "onDeregisterEntry",
1516
1531
  this,
1517
- this.collection[s]
1518
- ), this.collection.splice(s, 1), i;
1532
+ this.collection[e]
1533
+ );
1534
+ const [i] = this.collection.splice(e, 1);
1519
1535
  }
1520
- return null;
1536
+ return t;
1537
+ }
1538
+ async mount(t = (e) => e) {
1539
+ for (const e of this.config?.plugins || [])
1540
+ this.plugins.add(e);
1541
+ for (const e of this.plugins)
1542
+ await a(e, "setup", this);
1543
+ if (await r("beforeMount", this), this.config.selector) {
1544
+ const e = document.querySelectorAll(this.config.selector);
1545
+ for (const i of e)
1546
+ await this.createEntry(i).then((n) => t(n)).then((n) => this.register(n));
1547
+ }
1548
+ return await r("afterMount", this), this;
1521
1549
  }
1522
- async mount(t = {}) {
1523
- this.applySettings(t);
1524
- for (const i of this.settings?.plugins || [])
1525
- this.plugins.add(i);
1526
- for (const i of this.plugins)
1527
- await r(i, "setup", { plugin: i, parent: this });
1528
- await a("beforeMount", this);
1529
- const s = document.querySelectorAll(this.settings.selector);
1530
- for (const i of s)
1531
- await this.register(i);
1532
- return await a("afterMount", this), this;
1533
- }
1534
- async unmount() {
1535
- for (await a("beforeUnmount", this); this.collection.length > 0; )
1536
- await this.deregister(this.collection[0].id);
1537
- await a("afterUnmount", this);
1538
- for (const t of this.plugins)
1539
- await r(t, "teardown", { plugin: t, parent: this });
1540
- for (const t of [...this.plugins])
1541
- this.plugins.remove(t.name);
1550
+ async unmount(t = (e) => e) {
1551
+ for (await r("beforeUnmount", this); this.collection.length > 0; )
1552
+ await this.destroyEntry(this.collection[0]).then((e) => t(e)).then((e) => this.deregister(e));
1553
+ await r("afterUnmount", this);
1554
+ for (const e of this.plugins)
1555
+ await a(e, "teardown", this);
1556
+ for (const e of [...this.plugins])
1557
+ this.plugins.remove(e.name);
1542
1558
  return this;
1543
1559
  }
1544
- }
1545
- const D$1 = {
1560
+ };
1561
+ w("theme-prefix", { fallback: "vb-theme-" });
1562
+ const I$1 = {
1546
1563
  // Data attributes
1547
- dataOpen: "modal-open",
1548
- dataClose: "modal-close",
1549
- dataReplace: "modal-replace",
1564
+ attrOpen: "modal-open",
1565
+ attrClose: "modal-close",
1566
+ attrReplace: "modal-replace",
1550
1567
  // Selectors
1551
1568
  selector: ".modal",
1552
1569
  selectorDialog: ".modal__dialog",
@@ -1560,149 +1577,153 @@
1560
1577
  stateOpening: "is-opening",
1561
1578
  stateClosing: "is-closing",
1562
1579
  stateClosed: "is-closed",
1563
- // Feature settings
1580
+ // Feature configurations
1564
1581
  customProps: ["transition-duration"],
1565
1582
  customEventPrefix: "modal:",
1566
1583
  setTabindex: true,
1567
1584
  transition: true,
1568
1585
  transitionDuration: 300
1569
1586
  };
1570
- function c(e) {
1571
- e.active ? (e.active.dialog.querySelector(e.settings.selectorFocus) || e.active.dialog).focus() : e.trigger && (e.trigger.focus(), e.trigger = null);
1572
- }
1573
- async function h(e, t, s = true) {
1574
- return e.parent.stack.moveToTop(e), e.state === "closed" && (e.state = "opening", e.parent.stack.add(e), t ?? e.getSetting("transition") ? await m(
1575
- e.el,
1576
- e.getSetting("stateClosed"),
1577
- e.getSetting("stateOpening"),
1578
- e.getSetting("stateOpened"),
1579
- e.getSetting("transitionDuration")
1580
- ) : (e.el.classList.add(e.getSetting("stateOpened")), e.el.classList.remove(e.getSetting("stateClosed"))), e.state = "opened"), s && c(e.parent), e.el.dispatchEvent(
1581
- new CustomEvent(e.getSetting("customEventPrefix") + "opened", {
1582
- detail: e.parent,
1587
+ function c(s) {
1588
+ if (s.active) {
1589
+ const t = s.active.dialog.querySelector(s.config.selectorFocus) || s.active.dialog;
1590
+ "focus" in t && typeof t.focus == "function" && t.focus();
1591
+ } else
1592
+ s.trigger && (s.trigger.focus(), s.trigger = null);
1593
+ }
1594
+ async function l(s, t, e = true) {
1595
+ return s.parent.stack.moveToTop(s), s.state === "closed" && (s.state = "opening", s.parent.stack.add(s), t ?? s.config.get("transition") ? await u(
1596
+ s.el,
1597
+ s.config.get("stateClosed"),
1598
+ s.config.get("stateOpening"),
1599
+ s.config.get("stateOpened"),
1600
+ s.config.get("transitionDuration")
1601
+ ) : (s.el.classList.add(s.config.get("stateOpened")), s.el.classList.remove(s.config.get("stateClosed"))), s.state = "opened"), e && c(s.parent), s.el.dispatchEvent(
1602
+ new CustomEvent(s.config.get("customEventPrefix") + "opened", {
1603
+ detail: s.parent,
1583
1604
  bubbles: true
1584
1605
  })
1585
- ), await e.parent.emit("opened", e), e;
1586
- }
1587
- async function d(e, t, s = true) {
1588
- return e && e.state === "opened" && (e.state = "closing", document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), t ?? e.getSetting("transition") ? await m(
1589
- e.el,
1590
- e.getSetting("stateOpened"),
1591
- e.getSetting("stateClosing"),
1592
- e.getSetting("stateClosed"),
1593
- e.getSetting("transitionDuration")
1594
- ) : (e.el.classList.add(e.getSetting("stateClosed")), e.el.classList.remove(e.getSetting("stateOpened"))), e.parent.stack.remove(e), e.state = "closed", s && c(e.parent), e.el.dispatchEvent(
1595
- new CustomEvent(e.getSetting("customEventPrefix") + "closed", {
1596
- detail: e.parent,
1606
+ ), await s.parent.emit("opened", s), s;
1607
+ }
1608
+ async function h(s, t, e = true) {
1609
+ return s && s.state === "opened" && (s.state = "closing", document.activeElement && document.activeElement instanceof HTMLElement && document.activeElement.blur(), t ?? s.config.get("transition") ? await u(
1610
+ s.el,
1611
+ s.config.get("stateOpened"),
1612
+ s.config.get("stateClosing"),
1613
+ s.config.get("stateClosed"),
1614
+ s.config.get("transitionDuration")
1615
+ ) : (s.el.classList.add(s.config.get("stateClosed")), s.el.classList.remove(s.config.get("stateOpened"))), s.parent.stack.remove(s), s.state = "closed", e && c(s.parent), s.el.dispatchEvent(
1616
+ new CustomEvent(s.config.get("customEventPrefix") + "closed", {
1617
+ detail: s.parent,
1597
1618
  bubbles: true
1598
1619
  })
1599
- ), await e.parent.emit("closed", e)), e;
1620
+ ), await s.parent.emit("closed", s)), s;
1600
1621
  }
1601
- async function v(e, t, s = true) {
1622
+ async function g(s, t, e = true) {
1602
1623
  let i, n;
1603
- return e.state === "opened" ? (i = e, n = await e.parent.closeAll(e.id, t)) : [n, i] = await Promise.all([
1604
- e.parent.closeAll("", t),
1605
- h(e, t, false)
1606
- ]), s && c(e.parent), { opened: i, closed: n };
1624
+ return s.state === "opened" ? (i = s, n = await s.parent.closeAll(s.id, t)) : [n, i] = await Promise.all([
1625
+ s.parent.closeAll("", t),
1626
+ l(s, t, false)
1627
+ ]), e && c(s.parent), { opened: i, closed: n };
1607
1628
  }
1608
- let q$1 = class q extends w {
1609
- constructor(t, s, i = {}) {
1610
- super(t, s, i), this.state = "closed", this.dialog = this.el.querySelector(this.getSetting("selectorDialog")) || this.el;
1629
+ class $ extends d {
1630
+ constructor(t, e) {
1631
+ super(t, e), this.state = "closed", this.dialog = this.el.querySelector(this.config.get("selectorDialog")) || this.el;
1611
1632
  }
1612
1633
  get isRequired() {
1613
- return this.dialog.matches(this.getSetting("selectorRequired"));
1634
+ return this.dialog.matches(this.config.get("selectorRequired"));
1614
1635
  }
1615
- async open(t, s) {
1616
- return h(this, t, s);
1636
+ async open(t, e) {
1637
+ return l(this, t, e);
1617
1638
  }
1618
- async close(t, s) {
1619
- return d(this, t, s);
1639
+ async close(t, e) {
1640
+ return h(this, t, e);
1620
1641
  }
1621
- async replace(t, s) {
1622
- return v(this, t, s);
1642
+ async replace(t, e) {
1643
+ return g(this, t, e);
1623
1644
  }
1624
1645
  async deregister() {
1625
- return this.parent.deregister(this.id);
1646
+ return this.parent.deregister(this);
1626
1647
  }
1627
1648
  async onCreateEntry() {
1628
- this.dialog.setAttribute("aria-modal", "true"), this.dialog.hasAttribute("role") || this.dialog.setAttribute("role", "dialog"), this.getSetting("setTabindex") && this.dialog.setAttribute("tabindex", "-1");
1649
+ this.dialog.setAttribute("aria-modal", "true"), this.dialog.hasAttribute("role") || this.dialog.setAttribute("role", "dialog"), this.config.get("setTabindex") && this.dialog.setAttribute("tabindex", "-1");
1629
1650
  }
1630
1651
  async onRegisterEntry() {
1631
- this.el.classList.contains(this.getSetting("stateOpened")) ? await this.open(false) : (this.el.classList.remove(this.getSetting("stateOpening")), this.el.classList.remove(this.getSetting("stateClosing")), this.el.classList.add(this.getSetting("stateClosed")));
1652
+ this.el.classList.contains(this.config.get("stateOpened")) ? await this.open(false) : (this.el.classList.remove(this.config.get("stateOpening")), this.el.classList.remove(this.config.get("stateClosing")), this.el.classList.add(this.config.get("stateClosed")));
1632
1653
  }
1633
1654
  async onDestroyEntry() {
1634
1655
  this.state === "opened" && await this.close(false);
1635
1656
  }
1636
- };
1637
- async function R$1(e) {
1638
- const t = e.target;
1657
+ }
1658
+ async function T(s) {
1659
+ const t = s.target;
1639
1660
  if (t) {
1640
- const s = t.closest(`
1641
- [data-${this.settings.dataOpen}],
1642
- [data-${this.settings.dataReplace}],
1643
- [data-${this.settings.dataClose}]
1661
+ const e = t.closest(`
1662
+ [data-${this.config.attrOpen}],
1663
+ [data-${this.config.attrReplace}],
1664
+ [data-${this.config.attrClose}]
1644
1665
  `);
1645
- if (s) {
1646
- if (e.preventDefault(), s.matches(`[data-${this.settings.dataOpen}]`)) {
1647
- const i = s.getAttribute(`data-${this.settings.dataOpen}`)?.trim(), n = this.getOrThrow(i);
1648
- return t.closest(this.settings.selector) || (this.trigger = s), n.open();
1666
+ if (e) {
1667
+ if (s.preventDefault(), e.matches(`[data-${this.config.attrOpen}]`)) {
1668
+ const i = e.getAttribute(`data-${this.config.attrOpen}`)?.trim(), n = this.getOrThrow(i);
1669
+ return t.closest(this.config.selector) || (this.trigger = e), n.open();
1649
1670
  }
1650
- if (s.matches(`[data-${this.settings.dataReplace}]`)) {
1651
- const i = s.getAttribute(`data-${this.settings.dataReplace}`)?.trim(), n = this.getOrThrow(i);
1652
- return t.closest(this.settings.selector) || (this.trigger = s), n.replace();
1671
+ if (e.matches(`[data-${this.config.attrReplace}]`)) {
1672
+ const i = e.getAttribute(`data-${this.config.attrReplace}`)?.trim(), n = this.getOrThrow(i);
1673
+ return t.closest(this.config.selector) || (this.trigger = e), n.replace();
1653
1674
  }
1654
- if (s.matches(`[data-${this.settings.dataClose}]`)) {
1655
- const i = s.getAttribute(`data-${this.settings.dataClose}`)?.trim();
1675
+ if (e.matches(`[data-${this.config.attrClose}]`)) {
1676
+ const i = e.getAttribute(`data-${this.config.attrClose}`)?.trim();
1656
1677
  return i === "*" ? this.closeAll() : this.close(i || "");
1657
1678
  }
1658
1679
  }
1659
- if (this.active && t.matches(this.settings.selectorScreen) && !this.active.isRequired)
1680
+ if (this.active && t.matches(this.config.selectorScreen) && !this.active.isRequired)
1660
1681
  return this.close();
1661
1682
  }
1662
1683
  }
1663
- function j$1(e) {
1664
- if (e.key === "Escape" && this.active && !this.active.dialog.matches(this.settings.selectorRequired))
1684
+ function S$1(s) {
1685
+ if (s.key === "Escape" && this.active && !this.active.dialog.matches(this.config.selectorRequired))
1665
1686
  return this.close();
1666
1687
  }
1667
- async function z$1(e = "", t) {
1668
- const s = [];
1688
+ async function M(s = "", t) {
1689
+ const e = [];
1669
1690
  return await Promise.all(
1670
1691
  this.stack.copy.map(async (i) => {
1671
- e && e === i.id || s.push(await d(i, t, false));
1692
+ s && s === i.id || e.push(await h(i, t, false));
1672
1693
  })
1673
- ), s;
1694
+ ), e;
1674
1695
  }
1675
- let H$1 = class H extends M {
1676
- #t;
1677
- #e;
1696
+ let P$1 = class P extends A$1 {
1678
1697
  constructor(t) {
1679
- super({ ...D$1, ...t }), this.module = "Modal", this.entryClass = q$1, this.trigger = null, this.#t = R$1.bind(this), this.#e = j$1.bind(this), this.stack = new T$1({
1698
+ super({ ...I$1, ...t }), this.entryClass = $, this.name = "Modal", this.trigger = null, this.#t = T.bind(this), this.#e = S$1.bind(this), this.stack = new L({
1680
1699
  onChange: () => {
1681
- $(
1700
+ b(
1682
1701
  !!this.stack.top,
1683
- this.settings.selectorInert,
1684
- this.settings.selectorOverflow
1702
+ this.config.selectorInert,
1703
+ this.config.selectorOverflow
1685
1704
  );
1686
1705
  }
1687
1706
  });
1688
1707
  }
1708
+ #t;
1709
+ #e;
1689
1710
  get active() {
1690
1711
  return this.stack.top;
1691
1712
  }
1692
- async open(t, s, i) {
1713
+ async open(t, e, i) {
1693
1714
  const n = this.getOrThrow(t);
1694
- return h(n, s, i);
1715
+ return l(n, e, i);
1695
1716
  }
1696
- async close(t, s, i) {
1717
+ async close(t, e, i) {
1697
1718
  const n = t ? this.getOrThrow(t) : this.active;
1698
- return d(n, s, i);
1719
+ return h(n, e, i);
1699
1720
  }
1700
- async replace(t, s, i) {
1721
+ async replace(t, e, i) {
1701
1722
  const n = this.getOrThrow(t);
1702
- return v(n, s, i);
1723
+ return g(n, e, i);
1703
1724
  }
1704
- async closeAll(t, s, i = true) {
1705
- const n = await z$1.call(this, t, s);
1725
+ async closeAll(t, e, i = true) {
1726
+ const n = await M.call(this, t, e);
1706
1727
  return i && c(this), n;
1707
1728
  }
1708
1729
  async afterMount() {
@@ -1715,11 +1736,7 @@
1715
1736
  document.removeEventListener("click", this.#t, false), document.removeEventListener("keydown", this.#e, false);
1716
1737
  }
1717
1738
  };
1718
- function Jt(t, e = "config") {
1719
- const n = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
1720
- return n ? JSON.parse(n) : {};
1721
- }
1722
- function Rt(t) {
1739
+ function jt(t) {
1723
1740
  if (typeof t == "string") {
1724
1741
  const e = document.getElementById(t);
1725
1742
  if (e) return e;
@@ -1734,84 +1751,107 @@
1734
1751
  async function z(t, e, ...n) {
1735
1752
  e in t && typeof t[e] == "function" && await t[e](...n);
1736
1753
  }
1737
- function Zt(t) {
1738
- return t.split("-").map(
1739
- (e, n) => n === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1)
1740
- ).join("");
1741
- }
1742
- function kt(t) {
1743
- return t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1744
- }
1745
- async function H(t, e, n) {
1754
+ function Kt(t, e = {}) {
1755
+ const n = {
1756
+ fallback: null,
1757
+ element: document.body,
1758
+ ...e
1759
+ };
1760
+ if (!t.startsWith("--")) {
1761
+ const s = Jt();
1762
+ s && (t = `${s}${t}`), t = `--${t}`;
1763
+ }
1764
+ const i = getComputedStyle(n.element).getPropertyValue(t).trim();
1765
+ if (i)
1766
+ return i;
1767
+ if (n.fallback)
1768
+ return n.fallback;
1769
+ throw new Error(`CSS variable "${t}" was not found!`);
1770
+ }
1771
+ async function N(t, e, n) {
1746
1772
  await z(e, t, n), n && await z(n, t);
1747
1773
  for (const i of e.plugins)
1748
- await z(i, t, { plugin: i, parent: e, entry: n });
1749
- await e.emit(t, n);
1774
+ await z(i, t, { parent: e, entry: n });
1775
+ await e.emit(t, { parent: e, entry: n });
1750
1776
  }
1751
- function Gt(t) {
1752
- const e = getComputedStyle(t.el), n = {}, i = t.getSetting("customProps");
1753
- for (let s = 0; s < i.length; s++) {
1754
- const o = Qt(), r2 = t.parent.module.toLowerCase(), c2 = kt(i[s]), l = e.getPropertyValue(`--${o}${r2}-${c2}`).trim();
1755
- l && (n[c2] = l);
1756
- }
1757
- return n;
1758
- }
1759
- function Qt() {
1777
+ function Jt() {
1760
1778
  return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim();
1761
1779
  }
1762
- function te(t, e, n = "camel") {
1763
- return e = n === "camel" ? Zt(e) : kt(e), t.split(".").concat(e).reduce((i, s) => i?.[s], this);
1764
- }
1765
- function ee(t, e = {}) {
1766
- const {
1767
- fallback: n,
1768
- props: i = ["dataConfig", "customProps", "settings", "parent.settings"]
1769
- } = e;
1770
- for (const s of i) {
1771
- const o = s !== "customProps" ? "camel" : "kebab", r2 = te.call(this, s, t, o);
1772
- if (r2 !== void 0)
1773
- return r2;
1774
- }
1775
- if (n !== void 0)
1776
- return n;
1777
- throw new Error(`${this.parent.module} setting does not exist: ${t}`);
1780
+ class Gt {
1781
+ #t;
1782
+ #e;
1783
+ constructor() {
1784
+ this.#t = {}, this.#e = [];
1785
+ }
1786
+ get(e, n) {
1787
+ const { fallback: i, source: s } = n ?? {};
1788
+ if (s) {
1789
+ const o = this.#t?.[s]?.[e];
1790
+ if (o !== void 0)
1791
+ return o;
1792
+ } else
1793
+ for (const o of this.#e) {
1794
+ const r2 = this.#t?.[o]?.[e];
1795
+ if (r2 !== void 0)
1796
+ return r2;
1797
+ }
1798
+ if (i !== void 0)
1799
+ return i;
1800
+ throw new Error(`Config does not exist: ${e}`);
1801
+ }
1802
+ set(e, n = {}) {
1803
+ let i, s;
1804
+ return typeof e == "string" ? (i = e, s = n) : (i = "entry", s = e), this.#t[i] ? Object.assign(this.#t[i], s) : (this.#e.unshift(i), this.#t[i] = s), this.#t[i];
1805
+ }
1806
+ remove(e) {
1807
+ const n = this.#e.indexOf(e);
1808
+ n !== -1 && this.#e.splice(n, 1), delete this.#t[e];
1809
+ }
1810
+ setSourceOrder(e) {
1811
+ const n = Object.keys(this.#t).reverse(), i = e.filter((s) => n.includes(s));
1812
+ for (const s of n)
1813
+ i.includes(s) || i.push(s);
1814
+ return this.#e = i;
1815
+ }
1778
1816
  }
1779
- const ne = {
1780
- events: {},
1781
- on(t, e, ...n) {
1782
- this.events[t] || (this.events[t] = []), this.events[t].some(
1783
- (i) => i.listener === e
1784
- ) || this.events[t].push({ listener: e, args: n });
1785
- },
1786
- off(t, e) {
1787
- this.events[t] && (this.events[t] = this.events[t].filter(
1788
- (n) => n.listener !== e
1817
+ class Qt {
1818
+ constructor() {
1819
+ this.events = {};
1820
+ }
1821
+ on(e, n, ...i) {
1822
+ this.events[e] || (this.events[e] = []), this.events[e].some(
1823
+ (s) => s.listener === n
1824
+ ) || this.events[e].push({ listener: n, args: i });
1825
+ }
1826
+ off(e, n) {
1827
+ this.events[e] && (this.events[e] = this.events[e].filter(
1828
+ (i) => i.listener !== n
1789
1829
  ));
1790
- },
1791
- async emit(t, e) {
1792
- if (t = t.startsWith("on") ? t.slice(2, 3).toLowerCase() + t.slice(3) : t, !!this.events[t])
1793
- for (const { listener: n, args: i } of this.events[t])
1794
- await n(e, ...i);
1795
1830
  }
1796
- };
1797
- class ie extends Array {
1831
+ async emit(e, ...n) {
1832
+ if (e = e.startsWith("on") ? e.slice(2, 3).toLowerCase() + e.slice(3) : e, !!this.events[e])
1833
+ for (const { listener: i, args: s } of this.events[e])
1834
+ await i(...n, ...s);
1835
+ }
1836
+ }
1837
+ class Zt extends Array {
1798
1838
  constructor(e = {}) {
1799
1839
  super(), this.presets = e;
1800
1840
  }
1801
- applySettings(e) {
1802
- const n = e?.defaults || {}, i = this.presets?.[e.name] || {}, s = e?.options || {};
1803
- e.settings = { ...n, ...i, ...s };
1841
+ #t(e) {
1842
+ const n = this.presets?.[e.name] || {}, i = e?.options || {};
1843
+ e.config = { ...e.config, ...n, ...i };
1804
1844
  }
1805
- validate(e) {
1845
+ #e(e) {
1806
1846
  return !("name" in e) || typeof e.name != "string" ? (console.error("Plugin requires a name!"), false) : true;
1807
1847
  }
1808
1848
  get(e) {
1809
- return this.find((n) => n.name === e);
1849
+ return this.find((n) => n.name === e) || null;
1810
1850
  }
1811
1851
  add(e) {
1812
1852
  if (Array.isArray(e))
1813
1853
  e.forEach((n) => this.add(n));
1814
- else if (this.applySettings(e), this.validate(e)) {
1854
+ else if (this.#t(e), this.#e(e)) {
1815
1855
  const n = this.findIndex((i) => i.name === e.name);
1816
1856
  ~n ? this[n] = e : this.push(e);
1817
1857
  }
@@ -1821,45 +1861,21 @@
1821
1861
  ~n && this.splice(n, 1);
1822
1862
  }
1823
1863
  }
1824
- const se = {
1825
- dataConfig: "config",
1826
- customProps: []
1827
- };
1828
- class Dt {
1829
- constructor(e, n, i = {}) {
1830
- this.parent = e, this.el = Rt(n), this.settings = { ...i }, this.dataConfig = {}, this.customProps = {};
1831
- }
1832
- get id() {
1833
- return this.el.id;
1834
- }
1835
- applySettings(e) {
1836
- return Object.assign(this.settings, e);
1837
- }
1838
- getSetting(e, n) {
1839
- return ee.call(this, e, n);
1840
- }
1841
- buildDataConfig() {
1842
- return Object.assign(
1843
- this.dataConfig,
1844
- Jt(this.el, this.getSetting("dataConfig"))
1845
- );
1846
- }
1847
- buildCustomProps() {
1848
- return Object.assign(this.customProps, Gt(this));
1849
- }
1850
- async init(e = {}) {
1851
- this.applySettings(e), this.buildDataConfig(), this.buildCustomProps();
1852
- }
1853
- async destroy() {
1854
- Object.getOwnPropertyNames(this).forEach((e) => {
1855
- delete this[e];
1856
- });
1864
+ class Pt {
1865
+ constructor(e, n) {
1866
+ this.config = new Gt(), this.parent = e, this.el = jt(n), this.id = this.el.id, this.config.set("parent", this.parent.config), this.config.set("entry", {});
1857
1867
  }
1858
1868
  }
1859
- class oe {
1869
+ const te = {
1870
+ selector: "",
1871
+ plugins: [],
1872
+ presets: {}
1873
+ };
1874
+ class ee {
1860
1875
  constructor(e = {}) {
1861
- this.module = this.constructor.name, this.collection = [], this.entryClass = Dt, this.settings = { ...se, ...e }, this.plugins = new ie(this.settings.presets), this.events = {}, Object.assign(this, ne);
1876
+ this.#t = new Qt(), this.events = this.#t.events, this.on = this.#t.on.bind(this.#t), this.off = this.#t.off.bind(this.#t), this.emit = this.#t.emit.bind(this.#t), this.collection = [], this.entryClass = Pt, this.name = this.constructor.name, this.config = { ...te, ...e }, this.plugins = new Zt(this.config.presets);
1862
1877
  }
1878
+ #t;
1863
1879
  get(e, n = "id") {
1864
1880
  return this.collection.find((i) => i[n] === e);
1865
1881
  }
@@ -1868,65 +1884,60 @@
1868
1884
  if (i)
1869
1885
  return i;
1870
1886
  throw new Error(
1871
- `${this.module} entry not found in collection with ${n} of "${e}"`
1887
+ `${this.name} entry not found in collection with ${String(n)} of "${e}"`
1872
1888
  );
1873
1889
  }
1874
- applySettings(e) {
1875
- return Object.assign(this.settings, e);
1890
+ updateConfig(e = {}) {
1891
+ return Object.assign(this.config, e);
1876
1892
  }
1877
- async createEntry(e, n) {
1878
- const i = new this.entryClass(this, e, n);
1879
- return await z(i, "init"), await H("onCreateEntry", this, i), i;
1893
+ async createEntry(e) {
1894
+ const n = new this.entryClass(this, e);
1895
+ return await z(n, "init"), await N("onCreateEntry", this, n), n;
1880
1896
  }
1881
1897
  async destroyEntry(e) {
1882
- return await H("onDestroyEntry", this, e), await z(e, "destroy"), e;
1898
+ return await N("onDestroyEntry", this, e), await z(e, "destroy"), e;
1883
1899
  }
1884
- async register(e, n = {}) {
1885
- const i = Rt(e), s = this.collection.findIndex((o) => o.id === i.id);
1886
- if (~s) {
1887
- const o = this.collection[s];
1888
- return o.el = i, typeof o.init == "function" && await o.init(n), o;
1889
- } else {
1890
- const o = await this.createEntry(i, n);
1891
- return this.collection.push(o), await H("onRegisterEntry", this, o), o;
1892
- }
1900
+ async register(e) {
1901
+ const n = this.collection.findIndex((i) => i.id === e.id);
1902
+ return ~n ? this.collection[n] = e : this.collection.push(e), await N("onRegisterEntry", this, e), e;
1893
1903
  }
1894
1904
  async deregister(e) {
1895
- const n = this.collection.findIndex((i) => i.id === e);
1905
+ const n = this.collection.findIndex((i) => i.id === e.id);
1896
1906
  if (~n) {
1897
- const i = await this.destroyEntry(this.collection[n]);
1898
- return await H(
1907
+ await N(
1899
1908
  "onDeregisterEntry",
1900
1909
  this,
1901
1910
  this.collection[n]
1902
- ), this.collection.splice(n, 1), i;
1911
+ );
1912
+ const [i] = this.collection.splice(n, 1);
1903
1913
  }
1904
- return null;
1914
+ return e;
1905
1915
  }
1906
- async mount(e = {}) {
1907
- this.applySettings(e);
1908
- for (const i of this.settings?.plugins || [])
1909
- this.plugins.add(i);
1910
- for (const i of this.plugins)
1911
- await z(i, "setup", { plugin: i, parent: this });
1912
- await H("beforeMount", this);
1913
- const n = document.querySelectorAll(this.settings.selector);
1914
- for (const i of n)
1915
- await this.register(i);
1916
- return await H("afterMount", this), this;
1917
- }
1918
- async unmount() {
1919
- for (await H("beforeUnmount", this); this.collection.length > 0; )
1920
- await this.deregister(this.collection[0].id);
1921
- await H("afterUnmount", this);
1922
- for (const e of this.plugins)
1923
- await z(e, "teardown", { plugin: e, parent: this });
1924
- for (const e of [...this.plugins])
1925
- this.plugins.remove(e.name);
1916
+ async mount(e = (n) => n) {
1917
+ for (const n of this.config?.plugins || [])
1918
+ this.plugins.add(n);
1919
+ for (const n of this.plugins)
1920
+ await z(n, "setup", this);
1921
+ if (await N("beforeMount", this), this.config.selector) {
1922
+ const n = document.querySelectorAll(this.config.selector);
1923
+ for (const i of n)
1924
+ await this.createEntry(i).then((s) => e(s)).then((s) => this.register(s));
1925
+ }
1926
+ return await N("afterMount", this), this;
1927
+ }
1928
+ async unmount(e = (n) => n) {
1929
+ for (await N("beforeUnmount", this); this.collection.length > 0; )
1930
+ await this.destroyEntry(this.collection[0]).then((n) => e(n)).then((n) => this.deregister(n));
1931
+ await N("afterUnmount", this);
1932
+ for (const n of this.plugins)
1933
+ await z(n, "teardown", this);
1934
+ for (const n of [...this.plugins])
1935
+ this.plugins.remove(n.name);
1926
1936
  return this;
1927
1937
  }
1928
1938
  }
1929
- const re = {
1939
+ Kt("theme-prefix", { fallback: "vb-theme-" });
1940
+ const ne = {
1930
1941
  // Selectors
1931
1942
  selector: ".popover",
1932
1943
  selectorTooltip: ".popover_tooltip",
@@ -1951,22 +1962,22 @@
1951
1962
  shiftPadding: 0,
1952
1963
  arrowPadding: 0,
1953
1964
  toggleDelay: 0
1954
- }, Y = Math.min, j = Math.max, st = Math.round, it = Math.floor, R = (t) => ({
1965
+ }, j = Math.min, q = Math.max, st = Math.round, it = Math.floor, P = (t) => ({
1955
1966
  x: t,
1956
1967
  y: t
1957
- }), ce = {
1968
+ }), ie = {
1958
1969
  left: "right",
1959
1970
  right: "left",
1960
1971
  bottom: "top",
1961
1972
  top: "bottom"
1962
- }, le = {
1973
+ }, se = {
1963
1974
  start: "end",
1964
1975
  end: "start"
1965
1976
  };
1966
- function gt(t, e, n) {
1967
- return j(t, Y(e, n));
1977
+ function ht(t, e, n) {
1978
+ return q(t, j(e, n));
1968
1979
  }
1969
- function q(t, e) {
1980
+ function X(t, e) {
1970
1981
  return typeof t == "function" ? t(e) : t;
1971
1982
  }
1972
1983
  function I(t) {
@@ -1981,48 +1992,48 @@
1981
1992
  function wt(t) {
1982
1993
  return t === "y" ? "height" : "width";
1983
1994
  }
1984
- const ae = /* @__PURE__ */ new Set(["top", "bottom"]);
1995
+ const oe = /* @__PURE__ */ new Set(["top", "bottom"]);
1985
1996
  function F(t) {
1986
- return ae.has(I(t)) ? "y" : "x";
1997
+ return oe.has(I(t)) ? "y" : "x";
1987
1998
  }
1988
1999
  function yt(t) {
1989
2000
  return pt(F(t));
1990
2001
  }
1991
- function fe(t, e, n) {
2002
+ function re(t, e, n) {
1992
2003
  n === void 0 && (n = false);
1993
2004
  const i = et(t), s = yt(t), o = wt(s);
1994
2005
  let r2 = s === "x" ? i === (n ? "end" : "start") ? "right" : "left" : i === "start" ? "bottom" : "top";
1995
2006
  return e.reference[o] > e.floating[o] && (r2 = ot(r2)), [r2, ot(r2)];
1996
2007
  }
1997
- function ue(t) {
2008
+ function ce(t) {
1998
2009
  const e = ot(t);
1999
- return [ht(t), e, ht(e)];
2010
+ return [gt(t), e, gt(e)];
2000
2011
  }
2001
- function ht(t) {
2002
- return t.replace(/start|end/g, (e) => le[e]);
2012
+ function gt(t) {
2013
+ return t.replace(/start|end/g, (e) => se[e]);
2003
2014
  }
2004
- const At = ["left", "right"], Et = ["right", "left"], de = ["top", "bottom"], ge = ["bottom", "top"];
2005
- function he(t, e, n) {
2015
+ const Et = ["left", "right"], At = ["right", "left"], le = ["top", "bottom"], ae = ["bottom", "top"];
2016
+ function fe(t, e, n) {
2006
2017
  switch (t) {
2007
2018
  case "top":
2008
2019
  case "bottom":
2009
- return n ? e ? Et : At : e ? At : Et;
2020
+ return n ? e ? At : Et : e ? Et : At;
2010
2021
  case "left":
2011
2022
  case "right":
2012
- return e ? de : ge;
2023
+ return e ? le : ae;
2013
2024
  default:
2014
2025
  return [];
2015
2026
  }
2016
2027
  }
2017
- function me(t, e, n, i) {
2028
+ function ue(t, e, n, i) {
2018
2029
  const s = et(t);
2019
- let o = he(I(t), n === "start", i);
2020
- return s && (o = o.map((r2) => r2 + "-" + s), e && (o = o.concat(o.map(ht)))), o;
2030
+ let o = fe(I(t), n === "start", i);
2031
+ return s && (o = o.map((r2) => r2 + "-" + s), e && (o = o.concat(o.map(gt)))), o;
2021
2032
  }
2022
2033
  function ot(t) {
2023
- return t.replace(/left|right|bottom|top/g, (e) => ce[e]);
2034
+ return t.replace(/left|right|bottom|top/g, (e) => ie[e]);
2024
2035
  }
2025
- function pe(t) {
2036
+ function de(t) {
2026
2037
  return {
2027
2038
  top: 0,
2028
2039
  right: 0,
@@ -2031,8 +2042,8 @@
2031
2042
  ...t
2032
2043
  };
2033
2044
  }
2034
- function Mt(t) {
2035
- return typeof t != "number" ? pe(t) : {
2045
+ function kt(t) {
2046
+ return typeof t != "number" ? de(t) : {
2036
2047
  top: t,
2037
2048
  right: t,
2038
2049
  bottom: t,
@@ -2062,9 +2073,9 @@
2062
2073
  reference: i,
2063
2074
  floating: s
2064
2075
  } = t;
2065
- const o = F(e), r2 = yt(e), c2 = wt(r2), l = I(e), a2 = o === "y", d2 = i.x + i.width / 2 - s.width / 2, u2 = i.y + i.height / 2 - s.height / 2, g2 = i[c2] / 2 - s[c2] / 2;
2076
+ const o = F(e), r2 = yt(e), c2 = wt(r2), a2 = I(e), l2 = o === "y", d2 = i.x + i.width / 2 - s.width / 2, u2 = i.y + i.height / 2 - s.height / 2, h2 = i[c2] / 2 - s[c2] / 2;
2066
2077
  let f2;
2067
- switch (l) {
2078
+ switch (a2) {
2068
2079
  case "top":
2069
2080
  f2 = {
2070
2081
  x: d2,
@@ -2097,29 +2108,29 @@
2097
2108
  }
2098
2109
  switch (et(e)) {
2099
2110
  case "start":
2100
- f2[r2] -= g2 * (n && a2 ? -1 : 1);
2111
+ f2[r2] -= h2 * (n && l2 ? -1 : 1);
2101
2112
  break;
2102
2113
  case "end":
2103
- f2[r2] += g2 * (n && a2 ? -1 : 1);
2114
+ f2[r2] += h2 * (n && l2 ? -1 : 1);
2104
2115
  break;
2105
2116
  }
2106
2117
  return f2;
2107
2118
  }
2108
- const we = async (t, e, n) => {
2119
+ const he = async (t, e, n) => {
2109
2120
  const {
2110
2121
  placement: i = "bottom",
2111
2122
  strategy: s = "absolute",
2112
2123
  middleware: o = [],
2113
2124
  platform: r2
2114
- } = n, c2 = o.filter(Boolean), l = await (r2.isRTL == null ? void 0 : r2.isRTL(e));
2115
- let a2 = await r2.getElementRects({
2125
+ } = n, c2 = o.filter(Boolean), a2 = await (r2.isRTL == null ? void 0 : r2.isRTL(e));
2126
+ let l2 = await r2.getElementRects({
2116
2127
  reference: t,
2117
2128
  floating: e,
2118
2129
  strategy: s
2119
2130
  }), {
2120
2131
  x: d2,
2121
2132
  y: u2
2122
- } = Ct(a2, i, l), g2 = i, f2 = {}, h2 = 0;
2133
+ } = Ct(l2, i, a2), h2 = i, f2 = {}, g2 = 0;
2123
2134
  for (let m2 = 0; m2 < c2.length; m2++) {
2124
2135
  const {
2125
2136
  name: p2,
@@ -2127,16 +2138,16 @@
2127
2138
  } = c2[m2], {
2128
2139
  x: y2,
2129
2140
  y: x2,
2130
- data: v2,
2131
- reset: b2
2141
+ data: b2,
2142
+ reset: v2
2132
2143
  } = await w2({
2133
2144
  x: d2,
2134
2145
  y: u2,
2135
2146
  initialPlacement: i,
2136
- placement: g2,
2147
+ placement: h2,
2137
2148
  strategy: s,
2138
2149
  middlewareData: f2,
2139
- rects: a2,
2150
+ rects: l2,
2140
2151
  platform: r2,
2141
2152
  elements: {
2142
2153
  reference: t,
@@ -2147,26 +2158,26 @@
2147
2158
  ...f2,
2148
2159
  [p2]: {
2149
2160
  ...f2[p2],
2150
- ...v2
2161
+ ...b2
2151
2162
  }
2152
- }, b2 && h2 <= 50 && (h2++, typeof b2 == "object" && (b2.placement && (g2 = b2.placement), b2.rects && (a2 = b2.rects === true ? await r2.getElementRects({
2163
+ }, v2 && g2 <= 50 && (g2++, typeof v2 == "object" && (v2.placement && (h2 = v2.placement), v2.rects && (l2 = v2.rects === true ? await r2.getElementRects({
2153
2164
  reference: t,
2154
2165
  floating: e,
2155
2166
  strategy: s
2156
- }) : b2.rects), {
2167
+ }) : v2.rects), {
2157
2168
  x: d2,
2158
2169
  y: u2
2159
- } = Ct(a2, g2, l)), m2 = -1);
2170
+ } = Ct(l2, h2, a2)), m2 = -1);
2160
2171
  }
2161
2172
  return {
2162
2173
  x: d2,
2163
2174
  y: u2,
2164
- placement: g2,
2175
+ placement: h2,
2165
2176
  strategy: s,
2166
2177
  middlewareData: f2
2167
2178
  };
2168
2179
  };
2169
- async function $t(t, e) {
2180
+ async function Dt(t, e) {
2170
2181
  var n;
2171
2182
  e === void 0 && (e = {});
2172
2183
  const {
@@ -2175,43 +2186,43 @@
2175
2186
  platform: o,
2176
2187
  rects: r2,
2177
2188
  elements: c2,
2178
- strategy: l
2189
+ strategy: a2
2179
2190
  } = t, {
2180
- boundary: a2 = "clippingAncestors",
2191
+ boundary: l2 = "clippingAncestors",
2181
2192
  rootBoundary: d2 = "viewport",
2182
2193
  elementContext: u2 = "floating",
2183
- altBoundary: g2 = false,
2194
+ altBoundary: h2 = false,
2184
2195
  padding: f2 = 0
2185
- } = q(e, t), h2 = Mt(f2), p2 = c2[g2 ? u2 === "floating" ? "reference" : "floating" : u2], w2 = rt(await o.getClippingRect({
2196
+ } = X(e, t), g2 = kt(f2), p2 = c2[h2 ? u2 === "floating" ? "reference" : "floating" : u2], w2 = rt(await o.getClippingRect({
2186
2197
  element: (n = await (o.isElement == null ? void 0 : o.isElement(p2))) == null || n ? p2 : p2.contextElement || await (o.getDocumentElement == null ? void 0 : o.getDocumentElement(c2.floating)),
2187
- boundary: a2,
2198
+ boundary: l2,
2188
2199
  rootBoundary: d2,
2189
- strategy: l
2200
+ strategy: a2
2190
2201
  })), y2 = u2 === "floating" ? {
2191
2202
  x: i,
2192
2203
  y: s,
2193
2204
  width: r2.floating.width,
2194
2205
  height: r2.floating.height
2195
- } : r2.reference, x2 = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c2.floating)), v2 = await (o.isElement == null ? void 0 : o.isElement(x2)) ? await (o.getScale == null ? void 0 : o.getScale(x2)) || {
2206
+ } : r2.reference, x2 = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(c2.floating)), b2 = await (o.isElement == null ? void 0 : o.isElement(x2)) ? await (o.getScale == null ? void 0 : o.getScale(x2)) || {
2196
2207
  x: 1,
2197
2208
  y: 1
2198
2209
  } : {
2199
2210
  x: 1,
2200
2211
  y: 1
2201
- }, b2 = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
2212
+ }, v2 = rt(o.convertOffsetParentRelativeRectToViewportRelativeRect ? await o.convertOffsetParentRelativeRectToViewportRelativeRect({
2202
2213
  elements: c2,
2203
2214
  rect: y2,
2204
2215
  offsetParent: x2,
2205
- strategy: l
2216
+ strategy: a2
2206
2217
  }) : y2);
2207
2218
  return {
2208
- top: (w2.top - b2.top + h2.top) / v2.y,
2209
- bottom: (b2.bottom - w2.bottom + h2.bottom) / v2.y,
2210
- left: (w2.left - b2.left + h2.left) / v2.x,
2211
- right: (b2.right - w2.right + h2.right) / v2.x
2219
+ top: (w2.top - v2.top + g2.top) / b2.y,
2220
+ bottom: (v2.bottom - w2.bottom + g2.bottom) / b2.y,
2221
+ left: (w2.left - v2.left + g2.left) / b2.x,
2222
+ right: (v2.right - w2.right + g2.right) / b2.x
2212
2223
  };
2213
2224
  }
2214
- const ye = (t) => ({
2225
+ const ge = (t) => ({
2215
2226
  name: "arrow",
2216
2227
  options: t,
2217
2228
  async fn(e) {
@@ -2222,33 +2233,33 @@
2222
2233
  rects: o,
2223
2234
  platform: r2,
2224
2235
  elements: c2,
2225
- middlewareData: l
2236
+ middlewareData: a2
2226
2237
  } = e, {
2227
- element: a2,
2238
+ element: l2,
2228
2239
  padding: d2 = 0
2229
- } = q(t, e) || {};
2230
- if (a2 == null)
2240
+ } = X(t, e) || {};
2241
+ if (l2 == null)
2231
2242
  return {};
2232
- const u2 = Mt(d2), g2 = {
2243
+ const u2 = kt(d2), h2 = {
2233
2244
  x: n,
2234
2245
  y: i
2235
- }, f2 = yt(s), h2 = wt(f2), m2 = await r2.getDimensions(a2), p2 = f2 === "y", w2 = p2 ? "top" : "left", y2 = p2 ? "bottom" : "right", x2 = p2 ? "clientHeight" : "clientWidth", v2 = o.reference[h2] + o.reference[f2] - g2[f2] - o.floating[h2], b2 = g2[f2] - o.reference[f2], C2 = await (r2.getOffsetParent == null ? void 0 : r2.getOffsetParent(a2));
2236
- let S2 = C2 ? C2[x2] : 0;
2237
- (!S2 || !await (r2.isElement == null ? void 0 : r2.isElement(C2))) && (S2 = c2.floating[x2] || o.floating[h2]);
2238
- const Z2 = v2 / 2 - b2 / 2, W2 = S2 / 2 - m2[h2] / 2 - 1, M2 = Y(u2[w2], W2), G2 = Y(u2[y2], W2), B2 = M2, Q2 = S2 - m2[h2] - G2, A2 = S2 / 2 - m2[h2] / 2 + Z2, _2 = gt(B2, A2, Q2), $2 = !l.arrow && et(s) != null && A2 !== _2 && o.reference[h2] / 2 - (A2 < B2 ? M2 : G2) - m2[h2] / 2 < 0, L2 = $2 ? A2 < B2 ? A2 - B2 : A2 - Q2 : 0;
2246
+ }, f2 = yt(s), g2 = wt(f2), m2 = await r2.getDimensions(l2), p2 = f2 === "y", w2 = p2 ? "top" : "left", y2 = p2 ? "bottom" : "right", x2 = p2 ? "clientHeight" : "clientWidth", b2 = o.reference[g2] + o.reference[f2] - h2[f2] - o.floating[g2], v2 = h2[f2] - o.reference[f2], C2 = await (r2.getOffsetParent == null ? void 0 : r2.getOffsetParent(l2));
2247
+ let L2 = C2 ? C2[x2] : 0;
2248
+ (!L2 || !await (r2.isElement == null ? void 0 : r2.isElement(C2))) && (L2 = c2.floating[x2] || o.floating[g2]);
2249
+ const G2 = b2 / 2 - v2 / 2, V2 = L2 / 2 - m2[g2] / 2 - 1, M2 = j(u2[w2], V2), Q2 = j(u2[y2], V2), B2 = M2, Z2 = L2 - m2[g2] - Q2, E2 = L2 / 2 - m2[g2] / 2 + G2, _2 = ht(B2, E2, Z2), $2 = !a2.arrow && et(s) != null && E2 !== _2 && o.reference[g2] / 2 - (E2 < B2 ? M2 : Q2) - m2[g2] / 2 < 0, O2 = $2 ? E2 < B2 ? E2 - B2 : E2 - Z2 : 0;
2239
2250
  return {
2240
- [f2]: g2[f2] + L2,
2251
+ [f2]: h2[f2] + O2,
2241
2252
  data: {
2242
2253
  [f2]: _2,
2243
- centerOffset: A2 - _2 - L2,
2254
+ centerOffset: E2 - _2 - O2,
2244
2255
  ...$2 && {
2245
- alignmentOffset: L2
2256
+ alignmentOffset: O2
2246
2257
  }
2247
2258
  },
2248
2259
  reset: $2
2249
2260
  };
2250
2261
  }
2251
- }), xe = function(t) {
2262
+ }), me = function(t) {
2252
2263
  return t === void 0 && (t = {}), {
2253
2264
  name: "flip",
2254
2265
  options: t,
@@ -2259,60 +2270,60 @@
2259
2270
  middlewareData: o,
2260
2271
  rects: r2,
2261
2272
  initialPlacement: c2,
2262
- platform: l,
2263
- elements: a2
2273
+ platform: a2,
2274
+ elements: l2
2264
2275
  } = e, {
2265
2276
  mainAxis: d2 = true,
2266
2277
  crossAxis: u2 = true,
2267
- fallbackPlacements: g2,
2278
+ fallbackPlacements: h2,
2268
2279
  fallbackStrategy: f2 = "bestFit",
2269
- fallbackAxisSideDirection: h2 = "none",
2280
+ fallbackAxisSideDirection: g2 = "none",
2270
2281
  flipAlignment: m2 = true,
2271
2282
  ...p2
2272
- } = q(t, e);
2283
+ } = X(t, e);
2273
2284
  if ((n = o.arrow) != null && n.alignmentOffset)
2274
2285
  return {};
2275
- const w2 = I(s), y2 = F(c2), x2 = I(c2) === c2, v2 = await (l.isRTL == null ? void 0 : l.isRTL(a2.floating)), b2 = g2 || (x2 || !m2 ? [ot(c2)] : ue(c2)), C2 = h2 !== "none";
2276
- !g2 && C2 && b2.push(...me(c2, m2, h2, v2));
2277
- const S2 = [c2, ...b2], Z2 = await $t(e, p2), W2 = [];
2286
+ const w2 = I(s), y2 = F(c2), x2 = I(c2) === c2, b2 = await (a2.isRTL == null ? void 0 : a2.isRTL(l2.floating)), v2 = h2 || (x2 || !m2 ? [ot(c2)] : ce(c2)), C2 = g2 !== "none";
2287
+ !h2 && C2 && v2.push(...ue(c2, m2, g2, b2));
2288
+ const L2 = [c2, ...v2], G2 = await Dt(e, p2), V2 = [];
2278
2289
  let M2 = ((i = o.flip) == null ? void 0 : i.overflows) || [];
2279
- if (d2 && W2.push(Z2[w2]), u2) {
2280
- const A2 = fe(s, r2, v2);
2281
- W2.push(Z2[A2[0]], Z2[A2[1]]);
2290
+ if (d2 && V2.push(G2[w2]), u2) {
2291
+ const E2 = re(s, r2, b2);
2292
+ V2.push(G2[E2[0]], G2[E2[1]]);
2282
2293
  }
2283
2294
  if (M2 = [...M2, {
2284
2295
  placement: s,
2285
- overflows: W2
2286
- }], !W2.every((A2) => A2 <= 0)) {
2287
- var G2, B2;
2288
- const A2 = (((G2 = o.flip) == null ? void 0 : G2.index) || 0) + 1, _2 = S2[A2];
2296
+ overflows: V2
2297
+ }], !V2.every((E2) => E2 <= 0)) {
2298
+ var Q2, B2;
2299
+ const E2 = (((Q2 = o.flip) == null ? void 0 : Q2.index) || 0) + 1, _2 = L2[E2];
2289
2300
  if (_2 && (!(u2 === "alignment" ? y2 !== F(_2) : false) || // We leave the current main axis only if every placement on that axis
2290
2301
  // overflows the main axis.
2291
- M2.every((O2) => F(O2.placement) === y2 ? O2.overflows[0] > 0 : true)))
2302
+ M2.every((T2) => F(T2.placement) === y2 ? T2.overflows[0] > 0 : true)))
2292
2303
  return {
2293
2304
  data: {
2294
- index: A2,
2305
+ index: E2,
2295
2306
  overflows: M2
2296
2307
  },
2297
2308
  reset: {
2298
2309
  placement: _2
2299
2310
  }
2300
2311
  };
2301
- let $2 = (B2 = M2.filter((L2) => L2.overflows[0] <= 0).sort((L2, O2) => L2.overflows[1] - O2.overflows[1])[0]) == null ? void 0 : B2.placement;
2312
+ let $2 = (B2 = M2.filter((O2) => O2.overflows[0] <= 0).sort((O2, T2) => O2.overflows[1] - T2.overflows[1])[0]) == null ? void 0 : B2.placement;
2302
2313
  if (!$2)
2303
2314
  switch (f2) {
2304
2315
  case "bestFit": {
2305
- var Q2;
2306
- const L2 = (Q2 = M2.filter((O2) => {
2316
+ var Z2;
2317
+ const O2 = (Z2 = M2.filter((T2) => {
2307
2318
  if (C2) {
2308
- const N2 = F(O2.placement);
2309
- return N2 === y2 || // Create a bias to the `y` side axis due to horizontal
2319
+ const H2 = F(T2.placement);
2320
+ return H2 === y2 || // Create a bias to the `y` side axis due to horizontal
2310
2321
  // reading directions favoring greater width.
2311
- N2 === "y";
2322
+ H2 === "y";
2312
2323
  }
2313
2324
  return true;
2314
- }).map((O2) => [O2.placement, O2.overflows.filter((N2) => N2 > 0).reduce((N2, Kt) => N2 + Kt, 0)]).sort((O2, N2) => O2[1] - N2[1])[0]) == null ? void 0 : Q2[0];
2315
- L2 && ($2 = L2);
2325
+ }).map((T2) => [T2.placement, T2.overflows.filter((H2) => H2 > 0).reduce((H2, Yt) => H2 + Yt, 0)]).sort((T2, H2) => T2[1] - H2[1])[0]) == null ? void 0 : Z2[0];
2326
+ O2 && ($2 = O2);
2316
2327
  break;
2317
2328
  }
2318
2329
  case "initialPlacement":
@@ -2329,17 +2340,17 @@
2329
2340
  return {};
2330
2341
  }
2331
2342
  };
2332
- }, Ft = /* @__PURE__ */ new Set(["left", "top"]);
2333
- async function be(t, e) {
2343
+ }, Mt = /* @__PURE__ */ new Set(["left", "top"]);
2344
+ async function pe(t, e) {
2334
2345
  const {
2335
2346
  placement: n,
2336
2347
  platform: i,
2337
2348
  elements: s
2338
- } = t, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r2 = I(n), c2 = et(n), l = F(n) === "y", a2 = Ft.has(r2) ? -1 : 1, d2 = o && l ? -1 : 1, u2 = q(e, t);
2349
+ } = t, o = await (i.isRTL == null ? void 0 : i.isRTL(s.floating)), r2 = I(n), c2 = et(n), a2 = F(n) === "y", l2 = Mt.has(r2) ? -1 : 1, d2 = o && a2 ? -1 : 1, u2 = X(e, t);
2339
2350
  let {
2340
- mainAxis: g2,
2351
+ mainAxis: h2,
2341
2352
  crossAxis: f2,
2342
- alignmentAxis: h2
2353
+ alignmentAxis: g2
2343
2354
  } = typeof u2 == "number" ? {
2344
2355
  mainAxis: u2,
2345
2356
  crossAxis: 0,
@@ -2349,15 +2360,15 @@
2349
2360
  crossAxis: u2.crossAxis || 0,
2350
2361
  alignmentAxis: u2.alignmentAxis
2351
2362
  };
2352
- return c2 && typeof h2 == "number" && (f2 = c2 === "end" ? h2 * -1 : h2), l ? {
2363
+ return c2 && typeof g2 == "number" && (f2 = c2 === "end" ? g2 * -1 : g2), a2 ? {
2353
2364
  x: f2 * d2,
2354
- y: g2 * a2
2365
+ y: h2 * l2
2355
2366
  } : {
2356
- x: g2 * a2,
2367
+ x: h2 * l2,
2357
2368
  y: f2 * d2
2358
2369
  };
2359
2370
  }
2360
- const ve = function(t) {
2371
+ const we = function(t) {
2361
2372
  return t === void 0 && (t = 0), {
2362
2373
  name: "offset",
2363
2374
  options: t,
@@ -2368,18 +2379,18 @@
2368
2379
  y: o,
2369
2380
  placement: r2,
2370
2381
  middlewareData: c2
2371
- } = e, l = await be(e, t);
2382
+ } = e, a2 = await pe(e, t);
2372
2383
  return r2 === ((n = c2.offset) == null ? void 0 : n.placement) && (i = c2.arrow) != null && i.alignmentOffset ? {} : {
2373
- x: s + l.x,
2374
- y: o + l.y,
2384
+ x: s + a2.x,
2385
+ y: o + a2.y,
2375
2386
  data: {
2376
- ...l,
2387
+ ...a2,
2377
2388
  placement: r2
2378
2389
  }
2379
2390
  };
2380
2391
  }
2381
2392
  };
2382
- }, Ae = function(t) {
2393
+ }, ye = function(t) {
2383
2394
  return t === void 0 && (t = {}), {
2384
2395
  name: "shift",
2385
2396
  options: t,
@@ -2403,24 +2414,24 @@
2403
2414
  };
2404
2415
  }
2405
2416
  },
2406
- ...l
2407
- } = q(t, e), a2 = {
2417
+ ...a2
2418
+ } = X(t, e), l2 = {
2408
2419
  x: n,
2409
2420
  y: i
2410
- }, d2 = await $t(e, l), u2 = F(I(s)), g2 = pt(u2);
2411
- let f2 = a2[g2], h2 = a2[u2];
2421
+ }, d2 = await Dt(e, a2), u2 = F(I(s)), h2 = pt(u2);
2422
+ let f2 = l2[h2], g2 = l2[u2];
2412
2423
  if (o) {
2413
- const p2 = g2 === "y" ? "top" : "left", w2 = g2 === "y" ? "bottom" : "right", y2 = f2 + d2[p2], x2 = f2 - d2[w2];
2414
- f2 = gt(y2, f2, x2);
2424
+ const p2 = h2 === "y" ? "top" : "left", w2 = h2 === "y" ? "bottom" : "right", y2 = f2 + d2[p2], x2 = f2 - d2[w2];
2425
+ f2 = ht(y2, f2, x2);
2415
2426
  }
2416
2427
  if (r2) {
2417
- const p2 = u2 === "y" ? "top" : "left", w2 = u2 === "y" ? "bottom" : "right", y2 = h2 + d2[p2], x2 = h2 - d2[w2];
2418
- h2 = gt(y2, h2, x2);
2428
+ const p2 = u2 === "y" ? "top" : "left", w2 = u2 === "y" ? "bottom" : "right", y2 = g2 + d2[p2], x2 = g2 - d2[w2];
2429
+ g2 = ht(y2, g2, x2);
2419
2430
  }
2420
2431
  const m2 = c2.fn({
2421
2432
  ...e,
2422
- [g2]: f2,
2423
- [u2]: h2
2433
+ [h2]: f2,
2434
+ [u2]: g2
2424
2435
  });
2425
2436
  return {
2426
2437
  ...m2,
@@ -2428,14 +2439,14 @@
2428
2439
  x: m2.x - n,
2429
2440
  y: m2.y - i,
2430
2441
  enabled: {
2431
- [g2]: o,
2442
+ [h2]: o,
2432
2443
  [u2]: r2
2433
2444
  }
2434
2445
  }
2435
2446
  };
2436
2447
  }
2437
2448
  };
2438
- }, Ee = function(t) {
2449
+ }, xe = function(t) {
2439
2450
  return t === void 0 && (t = {}), {
2440
2451
  options: t,
2441
2452
  fn(e) {
@@ -2447,14 +2458,14 @@
2447
2458
  middlewareData: r2
2448
2459
  } = e, {
2449
2460
  offset: c2 = 0,
2450
- mainAxis: l = true,
2451
- crossAxis: a2 = true
2452
- } = q(t, e), d2 = {
2461
+ mainAxis: a2 = true,
2462
+ crossAxis: l2 = true
2463
+ } = X(t, e), d2 = {
2453
2464
  x: n,
2454
2465
  y: i
2455
- }, u2 = F(s), g2 = pt(u2);
2456
- let f2 = d2[g2], h2 = d2[u2];
2457
- const m2 = q(c2, e), p2 = typeof m2 == "number" ? {
2466
+ }, u2 = F(s), h2 = pt(u2);
2467
+ let f2 = d2[h2], g2 = d2[u2];
2468
+ const m2 = X(c2, e), p2 = typeof m2 == "number" ? {
2458
2469
  mainAxis: m2,
2459
2470
  crossAxis: 0
2460
2471
  } : {
@@ -2462,18 +2473,18 @@
2462
2473
  crossAxis: 0,
2463
2474
  ...m2
2464
2475
  };
2465
- if (l) {
2466
- const x2 = g2 === "y" ? "height" : "width", v2 = o.reference[g2] - o.floating[x2] + p2.mainAxis, b2 = o.reference[g2] + o.reference[x2] - p2.mainAxis;
2467
- f2 < v2 ? f2 = v2 : f2 > b2 && (f2 = b2);
2468
- }
2469
2476
  if (a2) {
2477
+ const x2 = h2 === "y" ? "height" : "width", b2 = o.reference[h2] - o.floating[x2] + p2.mainAxis, v2 = o.reference[h2] + o.reference[x2] - p2.mainAxis;
2478
+ f2 < b2 ? f2 = b2 : f2 > v2 && (f2 = v2);
2479
+ }
2480
+ if (l2) {
2470
2481
  var w2, y2;
2471
- const x2 = g2 === "y" ? "width" : "height", v2 = Ft.has(I(s)), b2 = o.reference[u2] - o.floating[x2] + (v2 && ((w2 = r2.offset) == null ? void 0 : w2[u2]) || 0) + (v2 ? 0 : p2.crossAxis), C2 = o.reference[u2] + o.reference[x2] + (v2 ? 0 : ((y2 = r2.offset) == null ? void 0 : y2[u2]) || 0) - (v2 ? p2.crossAxis : 0);
2472
- h2 < b2 ? h2 = b2 : h2 > C2 && (h2 = C2);
2482
+ const x2 = h2 === "y" ? "width" : "height", b2 = Mt.has(I(s)), v2 = o.reference[u2] - o.floating[x2] + (b2 && ((w2 = r2.offset) == null ? void 0 : w2[u2]) || 0) + (b2 ? 0 : p2.crossAxis), C2 = o.reference[u2] + o.reference[x2] + (b2 ? 0 : ((y2 = r2.offset) == null ? void 0 : y2[u2]) || 0) - (b2 ? p2.crossAxis : 0);
2483
+ g2 < v2 ? g2 = v2 : g2 > C2 && (g2 = C2);
2473
2484
  }
2474
2485
  return {
2475
- [g2]: f2,
2476
- [u2]: h2
2486
+ [h2]: f2,
2487
+ [u2]: g2
2477
2488
  };
2478
2489
  }
2479
2490
  };
@@ -2482,45 +2493,45 @@
2482
2493
  return typeof window < "u";
2483
2494
  }
2484
2495
  function J(t) {
2485
- return Nt(t) ? (t.nodeName || "").toLowerCase() : "#document";
2496
+ return $t(t) ? (t.nodeName || "").toLowerCase() : "#document";
2486
2497
  }
2487
- function E(t) {
2498
+ function A(t) {
2488
2499
  var e;
2489
2500
  return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
2490
2501
  }
2491
2502
  function D(t) {
2492
2503
  var e;
2493
- return (e = (Nt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
2504
+ return (e = ($t(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
2494
2505
  }
2495
- function Nt(t) {
2496
- return ct() ? t instanceof Node || t instanceof E(t).Node : false;
2506
+ function $t(t) {
2507
+ return ct() ? t instanceof Node || t instanceof A(t).Node : false;
2497
2508
  }
2498
- function T(t) {
2499
- return ct() ? t instanceof Element || t instanceof E(t).Element : false;
2509
+ function S(t) {
2510
+ return ct() ? t instanceof Element || t instanceof A(t).Element : false;
2500
2511
  }
2501
2512
  function k(t) {
2502
- return ct() ? t instanceof HTMLElement || t instanceof E(t).HTMLElement : false;
2513
+ return ct() ? t instanceof HTMLElement || t instanceof A(t).HTMLElement : false;
2503
2514
  }
2504
- function St(t) {
2505
- return !ct() || typeof ShadowRoot > "u" ? false : t instanceof ShadowRoot || t instanceof E(t).ShadowRoot;
2515
+ function Lt(t) {
2516
+ return !ct() || typeof ShadowRoot > "u" ? false : t instanceof ShadowRoot || t instanceof A(t).ShadowRoot;
2506
2517
  }
2507
- const Ce = /* @__PURE__ */ new Set(["inline", "contents"]);
2518
+ const ve = /* @__PURE__ */ new Set(["inline", "contents"]);
2508
2519
  function nt(t) {
2509
2520
  const {
2510
2521
  overflow: e,
2511
2522
  overflowX: n,
2512
2523
  overflowY: i,
2513
2524
  display: s
2514
- } = P(t);
2515
- return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !Ce.has(s);
2525
+ } = R(t);
2526
+ return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !ve.has(s);
2516
2527
  }
2517
- const Se = /* @__PURE__ */ new Set(["table", "td", "th"]);
2518
- function Le(t) {
2519
- return Se.has(J(t));
2528
+ const be = /* @__PURE__ */ new Set(["table", "td", "th"]);
2529
+ function Ee(t) {
2530
+ return be.has(J(t));
2520
2531
  }
2521
- const Oe = [":popover-open", ":modal"];
2532
+ const Ae = [":popover-open", ":modal"];
2522
2533
  function lt(t) {
2523
- return Oe.some((e) => {
2534
+ return Ae.some((e) => {
2524
2535
  try {
2525
2536
  return t.matches(e);
2526
2537
  } catch {
@@ -2528,34 +2539,34 @@
2528
2539
  }
2529
2540
  });
2530
2541
  }
2531
- const Te = ["transform", "translate", "scale", "rotate", "perspective"], Pe = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Re = ["paint", "layout", "strict", "content"];
2542
+ const Ce = ["transform", "translate", "scale", "rotate", "perspective"], Le = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Oe = ["paint", "layout", "strict", "content"];
2532
2543
  function xt(t) {
2533
- const e = bt(), n = T(t) ? P(t) : t;
2534
- return Te.some((i) => n[i] ? n[i] !== "none" : false) || (n.containerType ? n.containerType !== "normal" : false) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : false) || !e && (n.filter ? n.filter !== "none" : false) || Pe.some((i) => (n.willChange || "").includes(i)) || Re.some((i) => (n.contain || "").includes(i));
2544
+ const e = vt(), n = S(t) ? R(t) : t;
2545
+ return Ce.some((i) => n[i] ? n[i] !== "none" : false) || (n.containerType ? n.containerType !== "normal" : false) || !e && (n.backdropFilter ? n.backdropFilter !== "none" : false) || !e && (n.filter ? n.filter !== "none" : false) || Le.some((i) => (n.willChange || "").includes(i)) || Oe.some((i) => (n.contain || "").includes(i));
2535
2546
  }
2536
- function ke(t) {
2537
- let e = V(t);
2547
+ function Te(t) {
2548
+ let e = W(t);
2538
2549
  for (; k(e) && !K(e); ) {
2539
2550
  if (xt(e))
2540
2551
  return e;
2541
2552
  if (lt(e))
2542
2553
  return null;
2543
- e = V(e);
2554
+ e = W(e);
2544
2555
  }
2545
2556
  return null;
2546
2557
  }
2547
- function bt() {
2558
+ function vt() {
2548
2559
  return typeof CSS > "u" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter", "none");
2549
2560
  }
2550
- const De = /* @__PURE__ */ new Set(["html", "body", "#document"]);
2561
+ const Se = /* @__PURE__ */ new Set(["html", "body", "#document"]);
2551
2562
  function K(t) {
2552
- return De.has(J(t));
2563
+ return Se.has(J(t));
2553
2564
  }
2554
- function P(t) {
2555
- return E(t).getComputedStyle(t);
2565
+ function R(t) {
2566
+ return A(t).getComputedStyle(t);
2556
2567
  }
2557
2568
  function at(t) {
2558
- return T(t) ? {
2569
+ return S(t) ? {
2559
2570
  scrollLeft: t.scrollLeft,
2560
2571
  scrollTop: t.scrollTop
2561
2572
  } : {
@@ -2563,26 +2574,26 @@
2563
2574
  scrollTop: t.scrollY
2564
2575
  };
2565
2576
  }
2566
- function V(t) {
2577
+ function W(t) {
2567
2578
  if (J(t) === "html")
2568
2579
  return t;
2569
2580
  const e = (
2570
2581
  // Step into the shadow DOM of the parent of a slotted node.
2571
2582
  t.assignedSlot || // DOM Element detected.
2572
2583
  t.parentNode || // ShadowRoot detected.
2573
- St(t) && t.host || // Fallback.
2584
+ Lt(t) && t.host || // Fallback.
2574
2585
  D(t)
2575
2586
  );
2576
- return St(e) ? e.host : e;
2587
+ return Lt(e) ? e.host : e;
2577
2588
  }
2578
- function Ht(t) {
2579
- const e = V(t);
2580
- return K(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : k(e) && nt(e) ? e : Ht(e);
2589
+ function Ft(t) {
2590
+ const e = W(t);
2591
+ return K(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : k(e) && nt(e) ? e : Ft(e);
2581
2592
  }
2582
2593
  function tt(t, e, n) {
2583
2594
  var i;
2584
2595
  e === void 0 && (e = []), n === void 0 && (n = true);
2585
- const s = Ht(t), o = s === ((i = t.ownerDocument) == null ? void 0 : i.body), r2 = E(s);
2596
+ const s = Ft(t), o = s === ((i = t.ownerDocument) == null ? void 0 : i.body), r2 = A(s);
2586
2597
  if (o) {
2587
2598
  const c2 = mt(r2);
2588
2599
  return e.concat(r2, r2.visualViewport || [], nt(s) ? s : [], c2 && n ? tt(c2) : []);
@@ -2592,8 +2603,8 @@
2592
2603
  function mt(t) {
2593
2604
  return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
2594
2605
  }
2595
- function It(t) {
2596
- const e = P(t);
2606
+ function Ht(t) {
2607
+ const e = R(t);
2597
2608
  let n = parseFloat(e.width) || 0, i = parseFloat(e.height) || 0;
2598
2609
  const s = k(t), o = s ? t.offsetWidth : n, r2 = s ? t.offsetHeight : i, c2 = st(n) !== o || st(i) !== r2;
2599
2610
  return c2 && (n = o, i = r2), {
@@ -2602,69 +2613,69 @@
2602
2613
  $: c2
2603
2614
  };
2604
2615
  }
2605
- function vt(t) {
2606
- return T(t) ? t : t.contextElement;
2616
+ function bt(t) {
2617
+ return S(t) ? t : t.contextElement;
2607
2618
  }
2608
- function X(t) {
2609
- const e = vt(t);
2619
+ function Y(t) {
2620
+ const e = bt(t);
2610
2621
  if (!k(e))
2611
- return R(1);
2622
+ return P(1);
2612
2623
  const n = e.getBoundingClientRect(), {
2613
2624
  width: i,
2614
2625
  height: s,
2615
2626
  $: o
2616
- } = It(e);
2627
+ } = Ht(e);
2617
2628
  let r2 = (o ? st(n.width) : n.width) / i, c2 = (o ? st(n.height) : n.height) / s;
2618
2629
  return (!r2 || !Number.isFinite(r2)) && (r2 = 1), (!c2 || !Number.isFinite(c2)) && (c2 = 1), {
2619
2630
  x: r2,
2620
2631
  y: c2
2621
2632
  };
2622
2633
  }
2623
- const Me = /* @__PURE__ */ R(0);
2624
- function Vt(t) {
2625
- const e = E(t);
2626
- return !bt() || !e.visualViewport ? Me : {
2634
+ const Re = /* @__PURE__ */ P(0);
2635
+ function Nt(t) {
2636
+ const e = A(t);
2637
+ return !vt() || !e.visualViewport ? Re : {
2627
2638
  x: e.visualViewport.offsetLeft,
2628
2639
  y: e.visualViewport.offsetTop
2629
2640
  };
2630
2641
  }
2631
- function $e(t, e, n) {
2632
- return e === void 0 && (e = false), !n || e && n !== E(t) ? false : e;
2642
+ function Pe(t, e, n) {
2643
+ return e === void 0 && (e = false), !n || e && n !== A(t) ? false : e;
2633
2644
  }
2634
2645
  function U(t, e, n, i) {
2635
2646
  e === void 0 && (e = false), n === void 0 && (n = false);
2636
- const s = t.getBoundingClientRect(), o = vt(t);
2637
- let r2 = R(1);
2638
- e && (i ? T(i) && (r2 = X(i)) : r2 = X(t));
2639
- const c2 = $e(o, n, i) ? Vt(o) : R(0);
2640
- let l = (s.left + c2.x) / r2.x, a2 = (s.top + c2.y) / r2.y, d2 = s.width / r2.x, u2 = s.height / r2.y;
2647
+ const s = t.getBoundingClientRect(), o = bt(t);
2648
+ let r2 = P(1);
2649
+ e && (i ? S(i) && (r2 = Y(i)) : r2 = Y(t));
2650
+ const c2 = Pe(o, n, i) ? Nt(o) : P(0);
2651
+ let a2 = (s.left + c2.x) / r2.x, l2 = (s.top + c2.y) / r2.y, d2 = s.width / r2.x, u2 = s.height / r2.y;
2641
2652
  if (o) {
2642
- const g2 = E(o), f2 = i && T(i) ? E(i) : i;
2643
- let h2 = g2, m2 = mt(h2);
2644
- for (; m2 && i && f2 !== h2; ) {
2645
- const p2 = X(m2), w2 = m2.getBoundingClientRect(), y2 = P(m2), x2 = w2.left + (m2.clientLeft + parseFloat(y2.paddingLeft)) * p2.x, v2 = w2.top + (m2.clientTop + parseFloat(y2.paddingTop)) * p2.y;
2646
- l *= p2.x, a2 *= p2.y, d2 *= p2.x, u2 *= p2.y, l += x2, a2 += v2, h2 = E(m2), m2 = mt(h2);
2653
+ const h2 = A(o), f2 = i && S(i) ? A(i) : i;
2654
+ let g2 = h2, m2 = mt(g2);
2655
+ for (; m2 && i && f2 !== g2; ) {
2656
+ const p2 = Y(m2), w2 = m2.getBoundingClientRect(), y2 = R(m2), x2 = w2.left + (m2.clientLeft + parseFloat(y2.paddingLeft)) * p2.x, b2 = w2.top + (m2.clientTop + parseFloat(y2.paddingTop)) * p2.y;
2657
+ a2 *= p2.x, l2 *= p2.y, d2 *= p2.x, u2 *= p2.y, a2 += x2, l2 += b2, g2 = A(m2), m2 = mt(g2);
2647
2658
  }
2648
2659
  }
2649
2660
  return rt({
2650
2661
  width: d2,
2651
2662
  height: u2,
2652
- x: l,
2653
- y: a2
2663
+ x: a2,
2664
+ y: l2
2654
2665
  });
2655
2666
  }
2656
2667
  function ft(t, e) {
2657
2668
  const n = at(t).scrollLeft;
2658
2669
  return e ? e.left + n : U(D(t)).left + n;
2659
2670
  }
2660
- function Wt(t, e) {
2671
+ function It(t, e) {
2661
2672
  const n = t.getBoundingClientRect(), i = n.left + e.scrollLeft - ft(t, n), s = n.top + e.scrollTop;
2662
2673
  return {
2663
2674
  x: i,
2664
2675
  y: s
2665
2676
  };
2666
2677
  }
2667
- function Fe(t) {
2678
+ function ke(t) {
2668
2679
  let {
2669
2680
  elements: e,
2670
2681
  rect: n,
@@ -2674,78 +2685,78 @@
2674
2685
  const o = s === "fixed", r2 = D(i), c2 = e ? lt(e.floating) : false;
2675
2686
  if (i === r2 || c2 && o)
2676
2687
  return n;
2677
- let l = {
2688
+ let a2 = {
2678
2689
  scrollLeft: 0,
2679
2690
  scrollTop: 0
2680
- }, a2 = R(1);
2681
- const d2 = R(0), u2 = k(i);
2682
- if ((u2 || !u2 && !o) && ((J(i) !== "body" || nt(r2)) && (l = at(i)), k(i))) {
2691
+ }, l2 = P(1);
2692
+ const d2 = P(0), u2 = k(i);
2693
+ if ((u2 || !u2 && !o) && ((J(i) !== "body" || nt(r2)) && (a2 = at(i)), k(i))) {
2683
2694
  const f2 = U(i);
2684
- a2 = X(i), d2.x = f2.x + i.clientLeft, d2.y = f2.y + i.clientTop;
2695
+ l2 = Y(i), d2.x = f2.x + i.clientLeft, d2.y = f2.y + i.clientTop;
2685
2696
  }
2686
- const g2 = r2 && !u2 && !o ? Wt(r2, l) : R(0);
2697
+ const h2 = r2 && !u2 && !o ? It(r2, a2) : P(0);
2687
2698
  return {
2688
- width: n.width * a2.x,
2689
- height: n.height * a2.y,
2690
- x: n.x * a2.x - l.scrollLeft * a2.x + d2.x + g2.x,
2691
- y: n.y * a2.y - l.scrollTop * a2.y + d2.y + g2.y
2699
+ width: n.width * l2.x,
2700
+ height: n.height * l2.y,
2701
+ x: n.x * l2.x - a2.scrollLeft * l2.x + d2.x + h2.x,
2702
+ y: n.y * l2.y - a2.scrollTop * l2.y + d2.y + h2.y
2692
2703
  };
2693
2704
  }
2694
- function Ne(t) {
2705
+ function De(t) {
2695
2706
  return Array.from(t.getClientRects());
2696
2707
  }
2697
- function He(t) {
2698
- const e = D(t), n = at(t), i = t.ownerDocument.body, s = j(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), o = j(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
2708
+ function Me(t) {
2709
+ const e = D(t), n = at(t), i = t.ownerDocument.body, s = q(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth), o = q(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
2699
2710
  let r2 = -n.scrollLeft + ft(t);
2700
2711
  const c2 = -n.scrollTop;
2701
- return P(i).direction === "rtl" && (r2 += j(e.clientWidth, i.clientWidth) - s), {
2712
+ return R(i).direction === "rtl" && (r2 += q(e.clientWidth, i.clientWidth) - s), {
2702
2713
  width: s,
2703
2714
  height: o,
2704
2715
  x: r2,
2705
2716
  y: c2
2706
2717
  };
2707
2718
  }
2708
- const Lt = 25;
2709
- function Ie(t, e) {
2710
- const n = E(t), i = D(t), s = n.visualViewport;
2711
- let o = i.clientWidth, r2 = i.clientHeight, c2 = 0, l = 0;
2719
+ const Ot = 25;
2720
+ function $e(t, e) {
2721
+ const n = A(t), i = D(t), s = n.visualViewport;
2722
+ let o = i.clientWidth, r2 = i.clientHeight, c2 = 0, a2 = 0;
2712
2723
  if (s) {
2713
2724
  o = s.width, r2 = s.height;
2714
- const d2 = bt();
2715
- (!d2 || d2 && e === "fixed") && (c2 = s.offsetLeft, l = s.offsetTop);
2716
- }
2717
- const a2 = ft(i);
2718
- if (a2 <= 0) {
2719
- const d2 = i.ownerDocument, u2 = d2.body, g2 = getComputedStyle(u2), f2 = d2.compatMode === "CSS1Compat" && parseFloat(g2.marginLeft) + parseFloat(g2.marginRight) || 0, h2 = Math.abs(i.clientWidth - u2.clientWidth - f2);
2720
- h2 <= Lt && (o -= h2);
2721
- } else a2 <= Lt && (o += a2);
2725
+ const d2 = vt();
2726
+ (!d2 || d2 && e === "fixed") && (c2 = s.offsetLeft, a2 = s.offsetTop);
2727
+ }
2728
+ const l2 = ft(i);
2729
+ if (l2 <= 0) {
2730
+ const d2 = i.ownerDocument, u2 = d2.body, h2 = getComputedStyle(u2), f2 = d2.compatMode === "CSS1Compat" && parseFloat(h2.marginLeft) + parseFloat(h2.marginRight) || 0, g2 = Math.abs(i.clientWidth - u2.clientWidth - f2);
2731
+ g2 <= Ot && (o -= g2);
2732
+ } else l2 <= Ot && (o += l2);
2722
2733
  return {
2723
2734
  width: o,
2724
2735
  height: r2,
2725
2736
  x: c2,
2726
- y: l
2737
+ y: a2
2727
2738
  };
2728
2739
  }
2729
- const Ve = /* @__PURE__ */ new Set(["absolute", "fixed"]);
2730
- function We(t, e) {
2731
- const n = U(t, true, e === "fixed"), i = n.top + t.clientTop, s = n.left + t.clientLeft, o = k(t) ? X(t) : R(1), r2 = t.clientWidth * o.x, c2 = t.clientHeight * o.y, l = s * o.x, a2 = i * o.y;
2740
+ const Fe = /* @__PURE__ */ new Set(["absolute", "fixed"]);
2741
+ function He(t, e) {
2742
+ const n = U(t, true, e === "fixed"), i = n.top + t.clientTop, s = n.left + t.clientLeft, o = k(t) ? Y(t) : P(1), r2 = t.clientWidth * o.x, c2 = t.clientHeight * o.y, a2 = s * o.x, l2 = i * o.y;
2732
2743
  return {
2733
2744
  width: r2,
2734
2745
  height: c2,
2735
- x: l,
2736
- y: a2
2746
+ x: a2,
2747
+ y: l2
2737
2748
  };
2738
2749
  }
2739
- function Ot(t, e, n) {
2750
+ function Tt(t, e, n) {
2740
2751
  let i;
2741
2752
  if (e === "viewport")
2742
- i = Ie(t, n);
2753
+ i = $e(t, n);
2743
2754
  else if (e === "document")
2744
- i = He(D(t));
2745
- else if (T(e))
2746
- i = We(e, n);
2755
+ i = Me(D(t));
2756
+ else if (S(e))
2757
+ i = He(e, n);
2747
2758
  else {
2748
- const s = Vt(t);
2759
+ const s = Nt(t);
2749
2760
  i = {
2750
2761
  x: e.x - s.x,
2751
2762
  y: e.y - s.y,
@@ -2755,108 +2766,108 @@
2755
2766
  }
2756
2767
  return rt(i);
2757
2768
  }
2758
- function Bt(t, e) {
2759
- const n = V(t);
2760
- return n === e || !T(n) || K(n) ? false : P(n).position === "fixed" || Bt(n, e);
2769
+ function Wt(t, e) {
2770
+ const n = W(t);
2771
+ return n === e || !S(n) || K(n) ? false : R(n).position === "fixed" || Wt(n, e);
2761
2772
  }
2762
- function Be(t, e) {
2773
+ function Ne(t, e) {
2763
2774
  const n = e.get(t);
2764
2775
  if (n)
2765
2776
  return n;
2766
- let i = tt(t, [], false).filter((c2) => T(c2) && J(c2) !== "body"), s = null;
2767
- const o = P(t).position === "fixed";
2768
- let r2 = o ? V(t) : t;
2769
- for (; T(r2) && !K(r2); ) {
2770
- const c2 = P(r2), l = xt(r2);
2771
- !l && c2.position === "fixed" && (s = null), (o ? !l && !s : !l && c2.position === "static" && !!s && Ve.has(s.position) || nt(r2) && !l && Bt(t, r2)) ? i = i.filter((d2) => d2 !== r2) : s = c2, r2 = V(r2);
2777
+ let i = tt(t, [], false).filter((c2) => S(c2) && J(c2) !== "body"), s = null;
2778
+ const o = R(t).position === "fixed";
2779
+ let r2 = o ? W(t) : t;
2780
+ for (; S(r2) && !K(r2); ) {
2781
+ const c2 = R(r2), a2 = xt(r2);
2782
+ !a2 && c2.position === "fixed" && (s = null), (o ? !a2 && !s : !a2 && c2.position === "static" && !!s && Fe.has(s.position) || nt(r2) && !a2 && Wt(t, r2)) ? i = i.filter((d2) => d2 !== r2) : s = c2, r2 = W(r2);
2772
2783
  }
2773
2784
  return e.set(t, i), i;
2774
2785
  }
2775
- function _e(t) {
2786
+ function Ie(t) {
2776
2787
  let {
2777
2788
  element: e,
2778
2789
  boundary: n,
2779
2790
  rootBoundary: i,
2780
2791
  strategy: s
2781
2792
  } = t;
2782
- const r2 = [...n === "clippingAncestors" ? lt(e) ? [] : Be(e, this._c) : [].concat(n), i], c2 = r2[0], l = r2.reduce((a2, d2) => {
2783
- const u2 = Ot(e, d2, s);
2784
- return a2.top = j(u2.top, a2.top), a2.right = Y(u2.right, a2.right), a2.bottom = Y(u2.bottom, a2.bottom), a2.left = j(u2.left, a2.left), a2;
2785
- }, Ot(e, c2, s));
2793
+ const r2 = [...n === "clippingAncestors" ? lt(e) ? [] : Ne(e, this._c) : [].concat(n), i], c2 = r2[0], a2 = r2.reduce((l2, d2) => {
2794
+ const u2 = Tt(e, d2, s);
2795
+ return l2.top = q(u2.top, l2.top), l2.right = j(u2.right, l2.right), l2.bottom = j(u2.bottom, l2.bottom), l2.left = q(u2.left, l2.left), l2;
2796
+ }, Tt(e, c2, s));
2786
2797
  return {
2787
- width: l.right - l.left,
2788
- height: l.bottom - l.top,
2789
- x: l.left,
2790
- y: l.top
2798
+ width: a2.right - a2.left,
2799
+ height: a2.bottom - a2.top,
2800
+ x: a2.left,
2801
+ y: a2.top
2791
2802
  };
2792
2803
  }
2793
- function ze(t) {
2804
+ function We(t) {
2794
2805
  const {
2795
2806
  width: e,
2796
2807
  height: n
2797
- } = It(t);
2808
+ } = Ht(t);
2798
2809
  return {
2799
2810
  width: e,
2800
2811
  height: n
2801
2812
  };
2802
2813
  }
2803
- function je(t, e, n) {
2814
+ function Ve(t, e, n) {
2804
2815
  const i = k(e), s = D(e), o = n === "fixed", r2 = U(t, true, o, e);
2805
2816
  let c2 = {
2806
2817
  scrollLeft: 0,
2807
2818
  scrollTop: 0
2808
2819
  };
2809
- const l = R(0);
2810
- function a2() {
2811
- l.x = ft(s);
2820
+ const a2 = P(0);
2821
+ function l2() {
2822
+ a2.x = ft(s);
2812
2823
  }
2813
2824
  if (i || !i && !o)
2814
2825
  if ((J(e) !== "body" || nt(s)) && (c2 = at(e)), i) {
2815
2826
  const f2 = U(e, true, o, e);
2816
- l.x = f2.x + e.clientLeft, l.y = f2.y + e.clientTop;
2817
- } else s && a2();
2818
- o && !i && s && a2();
2819
- const d2 = s && !i && !o ? Wt(s, c2) : R(0), u2 = r2.left + c2.scrollLeft - l.x - d2.x, g2 = r2.top + c2.scrollTop - l.y - d2.y;
2827
+ a2.x = f2.x + e.clientLeft, a2.y = f2.y + e.clientTop;
2828
+ } else s && l2();
2829
+ o && !i && s && l2();
2830
+ const d2 = s && !i && !o ? It(s, c2) : P(0), u2 = r2.left + c2.scrollLeft - a2.x - d2.x, h2 = r2.top + c2.scrollTop - a2.y - d2.y;
2820
2831
  return {
2821
2832
  x: u2,
2822
- y: g2,
2833
+ y: h2,
2823
2834
  width: r2.width,
2824
2835
  height: r2.height
2825
2836
  };
2826
2837
  }
2827
2838
  function ut(t) {
2828
- return P(t).position === "static";
2839
+ return R(t).position === "static";
2829
2840
  }
2830
- function Tt(t, e) {
2831
- if (!k(t) || P(t).position === "fixed")
2841
+ function St(t, e) {
2842
+ if (!k(t) || R(t).position === "fixed")
2832
2843
  return null;
2833
2844
  if (e)
2834
2845
  return e(t);
2835
2846
  let n = t.offsetParent;
2836
2847
  return D(t) === n && (n = n.ownerDocument.body), n;
2837
2848
  }
2838
- function _t(t, e) {
2839
- const n = E(t);
2849
+ function Vt(t, e) {
2850
+ const n = A(t);
2840
2851
  if (lt(t))
2841
2852
  return n;
2842
2853
  if (!k(t)) {
2843
- let s = V(t);
2854
+ let s = W(t);
2844
2855
  for (; s && !K(s); ) {
2845
- if (T(s) && !ut(s))
2856
+ if (S(s) && !ut(s))
2846
2857
  return s;
2847
- s = V(s);
2858
+ s = W(s);
2848
2859
  }
2849
2860
  return n;
2850
2861
  }
2851
- let i = Tt(t, e);
2852
- for (; i && Le(i) && ut(i); )
2853
- i = Tt(i, e);
2854
- return i && K(i) && ut(i) && !xt(i) ? n : i || ke(t) || n;
2862
+ let i = St(t, e);
2863
+ for (; i && Ee(i) && ut(i); )
2864
+ i = St(i, e);
2865
+ return i && K(i) && ut(i) && !xt(i) ? n : i || Te(t) || n;
2855
2866
  }
2856
- const qe = async function(t) {
2857
- const e = this.getOffsetParent || _t, n = this.getDimensions, i = await n(t.floating);
2867
+ const Be = async function(t) {
2868
+ const e = this.getOffsetParent || Vt, n = this.getDimensions, i = await n(t.floating);
2858
2869
  return {
2859
- reference: je(t.reference, await e(t.floating), t.strategy),
2870
+ reference: Ve(t.reference, await e(t.floating), t.strategy),
2860
2871
  floating: {
2861
2872
  x: 0,
2862
2873
  y: 0,
@@ -2865,127 +2876,127 @@
2865
2876
  }
2866
2877
  };
2867
2878
  };
2868
- function Ue(t) {
2869
- return P(t).direction === "rtl";
2879
+ function _e(t) {
2880
+ return R(t).direction === "rtl";
2870
2881
  }
2871
- const Xe = {
2872
- convertOffsetParentRelativeRectToViewportRelativeRect: Fe,
2882
+ const ze = {
2883
+ convertOffsetParentRelativeRectToViewportRelativeRect: ke,
2873
2884
  getDocumentElement: D,
2874
- getClippingRect: _e,
2875
- getOffsetParent: _t,
2876
- getElementRects: qe,
2877
- getClientRects: Ne,
2878
- getDimensions: ze,
2879
- getScale: X,
2880
- isElement: T,
2881
- isRTL: Ue
2885
+ getClippingRect: Ie,
2886
+ getOffsetParent: Vt,
2887
+ getElementRects: Be,
2888
+ getClientRects: De,
2889
+ getDimensions: We,
2890
+ getScale: Y,
2891
+ isElement: S,
2892
+ isRTL: _e
2882
2893
  };
2883
- function zt(t, e) {
2894
+ function Bt(t, e) {
2884
2895
  return t.x === e.x && t.y === e.y && t.width === e.width && t.height === e.height;
2885
2896
  }
2886
- function Ye(t, e) {
2897
+ function qe(t, e) {
2887
2898
  let n = null, i;
2888
2899
  const s = D(t);
2889
2900
  function o() {
2890
2901
  var c2;
2891
2902
  clearTimeout(i), (c2 = n) == null || c2.disconnect(), n = null;
2892
2903
  }
2893
- function r2(c2, l) {
2894
- c2 === void 0 && (c2 = false), l === void 0 && (l = 1), o();
2895
- const a2 = t.getBoundingClientRect(), {
2904
+ function r2(c2, a2) {
2905
+ c2 === void 0 && (c2 = false), a2 === void 0 && (a2 = 1), o();
2906
+ const l2 = t.getBoundingClientRect(), {
2896
2907
  left: d2,
2897
2908
  top: u2,
2898
- width: g2,
2909
+ width: h2,
2899
2910
  height: f2
2900
- } = a2;
2901
- if (c2 || e(), !g2 || !f2)
2911
+ } = l2;
2912
+ if (c2 || e(), !h2 || !f2)
2902
2913
  return;
2903
- const h2 = it(u2), m2 = it(s.clientWidth - (d2 + g2)), p2 = it(s.clientHeight - (u2 + f2)), w2 = it(d2), x2 = {
2904
- rootMargin: -h2 + "px " + -m2 + "px " + -p2 + "px " + -w2 + "px",
2905
- threshold: j(0, Y(1, l)) || 1
2914
+ const g2 = it(u2), m2 = it(s.clientWidth - (d2 + h2)), p2 = it(s.clientHeight - (u2 + f2)), w2 = it(d2), x2 = {
2915
+ rootMargin: -g2 + "px " + -m2 + "px " + -p2 + "px " + -w2 + "px",
2916
+ threshold: q(0, j(1, a2)) || 1
2906
2917
  };
2907
- let v2 = true;
2908
- function b2(C2) {
2909
- const S2 = C2[0].intersectionRatio;
2910
- if (S2 !== l) {
2911
- if (!v2)
2918
+ let b2 = true;
2919
+ function v2(C2) {
2920
+ const L2 = C2[0].intersectionRatio;
2921
+ if (L2 !== a2) {
2922
+ if (!b2)
2912
2923
  return r2();
2913
- S2 ? r2(false, S2) : i = setTimeout(() => {
2924
+ L2 ? r2(false, L2) : i = setTimeout(() => {
2914
2925
  r2(false, 1e-7);
2915
2926
  }, 1e3);
2916
2927
  }
2917
- S2 === 1 && !zt(a2, t.getBoundingClientRect()) && r2(), v2 = false;
2928
+ L2 === 1 && !Bt(l2, t.getBoundingClientRect()) && r2(), b2 = false;
2918
2929
  }
2919
2930
  try {
2920
- n = new IntersectionObserver(b2, {
2931
+ n = new IntersectionObserver(v2, {
2921
2932
  ...x2,
2922
2933
  // Handle <iframe>s
2923
2934
  root: s.ownerDocument
2924
2935
  });
2925
2936
  } catch {
2926
- n = new IntersectionObserver(b2, x2);
2937
+ n = new IntersectionObserver(v2, x2);
2927
2938
  }
2928
2939
  n.observe(t);
2929
2940
  }
2930
2941
  return r2(true), o;
2931
2942
  }
2932
- function Ke(t, e, n, i) {
2943
+ function Xe(t, e, n, i) {
2933
2944
  i === void 0 && (i = {});
2934
2945
  const {
2935
2946
  ancestorScroll: s = true,
2936
2947
  ancestorResize: o = true,
2937
2948
  elementResize: r2 = typeof ResizeObserver == "function",
2938
2949
  layoutShift: c2 = typeof IntersectionObserver == "function",
2939
- animationFrame: l = false
2940
- } = i, a2 = vt(t), d2 = s || o ? [...a2 ? tt(a2) : [], ...tt(e)] : [];
2950
+ animationFrame: a2 = false
2951
+ } = i, l2 = bt(t), d2 = s || o ? [...l2 ? tt(l2) : [], ...tt(e)] : [];
2941
2952
  d2.forEach((w2) => {
2942
2953
  s && w2.addEventListener("scroll", n, {
2943
2954
  passive: true
2944
2955
  }), o && w2.addEventListener("resize", n);
2945
2956
  });
2946
- const u2 = a2 && c2 ? Ye(a2, n) : null;
2947
- let g2 = -1, f2 = null;
2957
+ const u2 = l2 && c2 ? qe(l2, n) : null;
2958
+ let h2 = -1, f2 = null;
2948
2959
  r2 && (f2 = new ResizeObserver((w2) => {
2949
2960
  let [y2] = w2;
2950
- y2 && y2.target === a2 && f2 && (f2.unobserve(e), cancelAnimationFrame(g2), g2 = requestAnimationFrame(() => {
2961
+ y2 && y2.target === l2 && f2 && (f2.unobserve(e), cancelAnimationFrame(h2), h2 = requestAnimationFrame(() => {
2951
2962
  var x2;
2952
2963
  (x2 = f2) == null || x2.observe(e);
2953
2964
  })), n();
2954
- }), a2 && !l && f2.observe(a2), f2.observe(e));
2955
- let h2, m2 = l ? U(t) : null;
2956
- l && p2();
2965
+ }), l2 && !a2 && f2.observe(l2), f2.observe(e));
2966
+ let g2, m2 = a2 ? U(t) : null;
2967
+ a2 && p2();
2957
2968
  function p2() {
2958
2969
  const w2 = U(t);
2959
- m2 && !zt(m2, w2) && n(), m2 = w2, h2 = requestAnimationFrame(p2);
2970
+ m2 && !Bt(m2, w2) && n(), m2 = w2, g2 = requestAnimationFrame(p2);
2960
2971
  }
2961
2972
  return n(), () => {
2962
2973
  var w2;
2963
2974
  d2.forEach((y2) => {
2964
2975
  s && y2.removeEventListener("scroll", n), o && y2.removeEventListener("resize", n);
2965
- }), u2?.(), (w2 = f2) == null || w2.disconnect(), f2 = null, l && cancelAnimationFrame(h2);
2976
+ }), u2?.(), (w2 = f2) == null || w2.disconnect(), f2 = null, a2 && cancelAnimationFrame(g2);
2966
2977
  };
2967
2978
  }
2968
- const Je = ve, Ze = Ae, Ge = xe, Qe = ye, tn = Ee, en = (t, e, n) => {
2979
+ const Ue = we, Ye = ye, je = me, Ke = ge, Je = xe, Ge = (t, e, n) => {
2969
2980
  const i = /* @__PURE__ */ new Map(), s = {
2970
- platform: Xe,
2981
+ platform: ze,
2971
2982
  ...n
2972
2983
  }, o = {
2973
2984
  ...s.platform,
2974
2985
  _c: i
2975
2986
  };
2976
- return we(t, e, {
2987
+ return he(t, e, {
2977
2988
  ...s,
2978
2989
  platform: o
2979
2990
  });
2980
2991
  };
2981
- function Pt(t, e, n) {
2992
+ function Rt(t, e, n) {
2982
2993
  Object.assign(t.style, {
2983
2994
  left: e != null ? `${e}px` : "",
2984
2995
  top: n != null ? `${n}px` : ""
2985
2996
  });
2986
2997
  }
2987
- function jt(t, e) {
2988
- let n = t.getSetting("toggle-delay");
2998
+ function _t(t, e) {
2999
+ let n = t.config.get("toggleDelay");
2989
3000
  typeof n == "string" && (n.indexOf(",") > -1 && (n = n.split(",")), n.indexOf(" ") > -1 && (n = n.split(" "))), Array.isArray(n) && (n = n[e]);
2990
3001
  const i = Number(n);
2991
3002
  if (Number.isNaN(i))
@@ -3031,31 +3042,31 @@
3031
3042
  }
3032
3043
  return e;
3033
3044
  }
3034
- function nn(t) {
3045
+ function Qe(t) {
3035
3046
  return {
3036
- offset: Number(t.getSetting("offset")),
3047
+ offset: Number(t.config.get("offset")),
3037
3048
  flip: {
3038
- padding: dt(t.getSetting("flip-padding"))
3049
+ padding: dt(t.config.get("flipPadding"))
3039
3050
  },
3040
3051
  shift: {
3041
- padding: dt(t.getSetting("shift-padding"))
3052
+ padding: dt(t.config.get("shiftPadding"))
3042
3053
  },
3043
3054
  arrow: {
3044
- selector: t.getSetting("selectorArrow"),
3055
+ selector: t.config.get("selectorArrow"),
3045
3056
  element: null,
3046
- padding: dt(t.getSetting("arrow-padding"))
3057
+ padding: dt(t.config.get("arrowPadding"))
3047
3058
  }
3048
3059
  };
3049
3060
  }
3050
- async function qt(t) {
3051
- return t && t.state === "opened" && (t.el.inert = true, t.el.classList.remove(t.parent.settings.stateActive), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "false"), t.floatingCleanup(), t.state = "closed", t.trigger === t.parent.trigger && (t.parent.trigger = null), t.el.dispatchEvent(
3052
- new CustomEvent(t.getSetting("customEventPrefix") + "closed", {
3061
+ async function zt(t) {
3062
+ return t && t.state === "opened" && (t.el.inert = true, t.el.classList.remove(t.config.get("stateActive")), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "false"), t.floatingCleanup(), t.state = "closed", t.trigger === t.parent.trigger && (t.parent.trigger = null), t.el.dispatchEvent(
3063
+ new CustomEvent(t.config.get("customEventPrefix") + "closed", {
3053
3064
  detail: t.parent,
3054
3065
  bubbles: true
3055
3066
  })
3056
3067
  ), await t.parent.emit("closed", t)), t;
3057
3068
  }
3058
- async function Ut(t) {
3069
+ async function qt(t) {
3059
3070
  const e = [];
3060
3071
  for (const n of t.collection)
3061
3072
  n.state === "opened" && e.push(await n.close());
@@ -3066,35 +3077,35 @@
3066
3077
  `#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`
3067
3078
  ) || t.close(), t), 1);
3068
3079
  }
3069
- function sn(t) {
3080
+ function Ze(t) {
3070
3081
  t.state === "opened" ? t.close() : (this.trigger = t.trigger, t.open());
3071
3082
  }
3072
- function on(t) {
3083
+ function tn(t) {
3073
3084
  t.isTooltip && (t.toggleDelayId && clearTimeout(t.toggleDelayId), t.close());
3074
3085
  }
3075
- function rn(t, e) {
3076
- if (t.isHovered = e, e.type == "focus" && t.trigger && !t.trigger.matches(":focus-visible"))
3086
+ function en(t, e) {
3087
+ if (!(e instanceof MouseEvent) || (t.isHovered = e, e.type == "focus" && t.trigger && !t.trigger.matches(":focus-visible")))
3077
3088
  return;
3078
3089
  t.toggleDelayId && clearTimeout(t.toggleDelayId);
3079
3090
  const n = t.trigger?.getAttribute("aria-expanded");
3080
3091
  if (n && n == "true") return;
3081
- const i = this.activeHover ? 0 : jt(t, 0);
3092
+ const i = this.activeHover ? 0 : _t(t, 0);
3082
3093
  this.activeHover && this.activeHover.close(), t.toggleDelayId = setTimeout(() => {
3083
3094
  t.id && t.open();
3084
3095
  }, i);
3085
3096
  }
3086
- function cn(t, e) {
3087
- setTimeout(() => {
3097
+ function nn(t, e) {
3098
+ e instanceof MouseEvent && setTimeout(() => {
3088
3099
  t.isHovered = e, !t.isHovered && (t.toggleDelayId && clearTimeout(t.toggleDelayId), t.toggleDelayId = setTimeout(
3089
3100
  () => Xt(t),
3090
- jt(t, 1)
3101
+ _t(t, 1)
3091
3102
  ));
3092
3103
  }, 1);
3093
3104
  }
3094
- function ln(t) {
3105
+ function sn(t) {
3095
3106
  switch (t.key) {
3096
3107
  case "Escape":
3097
- this.trigger && this.trigger.focus(), Ut(this);
3108
+ this.trigger && this.trigger.focus(), qt(this);
3098
3109
  return;
3099
3110
  case "Tab":
3100
3111
  this.collection.forEach((e) => {
@@ -3105,62 +3116,61 @@
3105
3116
  return;
3106
3117
  }
3107
3118
  }
3108
- function an(t) {
3109
- const e = this;
3110
- document.addEventListener("click", function n(i) {
3111
- const s = i.target;
3112
- s && (s.closest(
3119
+ function on(t) {
3120
+ document.addEventListener("click", function e(n) {
3121
+ const i = n.target;
3122
+ i && (i.closest(
3113
3123
  `#${t.id}, [aria-controls="${t.id}"], [aria-describedby="${t.id}"]`
3114
- ) ? t.el && !t.el.classList.contains(e.settings.stateActive) && this.removeEventListener("click", n) : (t.el && t.el.classList.contains(e.settings.stateActive) && t.close(), this.removeEventListener("click", n)));
3124
+ ) ? t.el && !t.el.classList.contains(t.config.get("stateActive")) && this.removeEventListener("click", e) : (t.el && t.el.classList.contains(t.config.get("stateActive")) && t.close(), this.removeEventListener("click", e)));
3115
3125
  });
3116
3126
  }
3117
- async function Yt(t) {
3118
- t.el.inert = false, t.el.classList.add(t.parent.settings.stateActive), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "true"), t.buildCustomProps();
3119
- const e = nn(t), n = t.el.querySelector(
3127
+ async function Ut(t) {
3128
+ t.el.inert = false, t.el.classList.add(t.config.get("stateActive")), t.isTooltip || t.trigger?.setAttribute("aria-expanded", "true"), await t.parent.emit("updateCustomProps", t);
3129
+ const e = Qe(t), n = t.el.querySelector(
3120
3130
  e.arrow.selector
3121
3131
  );
3122
- return e.arrow.element = n || null, t.trigger instanceof HTMLElement && (t.floatingCleanup = Ke(t.trigger, t.el, () => {
3132
+ return e.arrow.element = n || null, t.trigger instanceof HTMLElement && (t.floatingCleanup = Xe(t.trigger, t.el, () => {
3123
3133
  const i = [
3124
- Ge(e.flip),
3125
- Ze({ ...e.shift, limiter: tn() }),
3126
- Je(e.offset)
3134
+ je(e.flip),
3135
+ Ye({ ...e.shift, limiter: Je() }),
3136
+ Ue(e.offset)
3127
3137
  ];
3128
3138
  e.arrow.element && i.push(
3129
- Qe({
3139
+ Ke({
3130
3140
  ...e.arrow,
3131
3141
  element: e.arrow.element
3132
3142
  })
3133
- ), en(t.trigger, t.el, {
3134
- placement: t.getSetting("placement"),
3143
+ ), Ge(t.trigger, t.el, {
3144
+ placement: t.config.get("placement"),
3135
3145
  middleware: i
3136
3146
  }).then(({ x: s, y: o, placement: r2, middlewareData: c2 }) => {
3137
3147
  if (t.el) {
3138
- if (Pt(t.el, s, o), e.arrow.element && c2.arrow) {
3139
- const { x: l, y: a2 } = c2.arrow;
3140
- Pt(e.arrow.element, l, a2);
3148
+ if (Rt(t.el, s, o), e.arrow.element && c2.arrow) {
3149
+ const { x: a2, y: l2 } = c2.arrow;
3150
+ Rt(e.arrow.element, a2, l2);
3141
3151
  }
3142
3152
  t.el.setAttribute("data-floating-placement", r2);
3143
3153
  }
3144
3154
  });
3145
- })), t.state = "opened", t.getSetting("event") === "click" && an.call(t.parent, t), t.el.dispatchEvent(
3146
- new CustomEvent(t.getSetting("customEventPrefix") + "opened", {
3155
+ })), t.state = "opened", t.config.get("event") === "click" && on.call(t.parent, t), t.el.dispatchEvent(
3156
+ new CustomEvent(t.config.get("customEventPrefix") + "opened", {
3147
3157
  detail: t.parent,
3148
3158
  bubbles: true
3149
3159
  })
3150
3160
  ), await t.parent.emit("opened", t), t;
3151
3161
  }
3152
- class fn extends Dt {
3153
- #t;
3154
- #e;
3155
- constructor(e, n, i = {}) {
3156
- super(e, n, i), this.state = "closed", this.toggleDelayId = null, this.trigger = null, this.#t = null, this.#e = {
3162
+ class rn extends Pt {
3163
+ constructor(e, n) {
3164
+ super(e, n), this.#t = [], this.#e = {
3157
3165
  el: false,
3158
3166
  trigger: false
3159
- }, this.floatingCleanup = () => {
3167
+ }, this.state = "closed", this.trigger = null, this.toggleDelayId = null, this.floatingCleanup = () => {
3160
3168
  };
3161
3169
  }
3170
+ #t;
3171
+ #e;
3162
3172
  get isTooltip() {
3163
- return !!this.el.closest(this.getSetting("selectorTooltip")) || this.el.getAttribute("role") == "tooltip";
3173
+ return !!this.el.closest(this.config.get("selectorTooltip")) || this.el.getAttribute("role") == "tooltip";
3164
3174
  }
3165
3175
  get isHovered() {
3166
3176
  return this.#e.el || this.#e.trigger;
@@ -3178,47 +3188,55 @@
3178
3188
  }
3179
3189
  }
3180
3190
  async open() {
3181
- return Yt(this);
3191
+ return Ut(this);
3182
3192
  }
3183
3193
  async close() {
3184
- return qt(this);
3194
+ return zt(this);
3185
3195
  }
3186
3196
  async deregister() {
3187
- return this.parent.deregister(this.id);
3197
+ return this.parent.deregister(this);
3188
3198
  }
3189
3199
  registerEventListeners() {
3190
- this.#t || (this.getSetting("event") === "hover" ? (this.#t = [
3200
+ this.#t.length || (this.config.get("event") === "hover" ? (this.#t = [
3191
3201
  {
3192
3202
  el: ["el", "trigger"],
3193
3203
  type: ["mouseenter", "focus"],
3194
- listener: rn.bind(this.parent, this)
3204
+ listener: en.bind(this.parent, this)
3195
3205
  },
3196
3206
  {
3197
3207
  el: ["el", "trigger"],
3198
3208
  type: ["mouseleave", "focusout"],
3199
- listener: cn.bind(this.parent, this)
3209
+ listener: nn.bind(this.parent, this)
3200
3210
  },
3201
3211
  {
3202
3212
  el: ["trigger"],
3203
3213
  type: ["click"],
3204
- listener: on.bind(this.parent, this)
3214
+ listener: tn.bind(this.parent, this)
3205
3215
  }
3206
3216
  ], this.#t.forEach((n) => {
3207
3217
  n.el.forEach((i) => {
3208
3218
  n.type.forEach((s) => {
3209
- this[i].addEventListener(s, n.listener, false);
3219
+ this[i].addEventListener(
3220
+ s,
3221
+ n.listener,
3222
+ false
3223
+ );
3210
3224
  });
3211
3225
  });
3212
3226
  })) : (this.#t = [
3213
3227
  {
3214
3228
  el: ["trigger"],
3215
3229
  type: ["click"],
3216
- listener: sn.bind(this.parent, this)
3230
+ listener: Ze.bind(this.parent, this)
3217
3231
  }
3218
3232
  ], this.#t.forEach((n) => {
3219
3233
  n.el.forEach((i) => {
3220
3234
  n.type.forEach((s) => {
3221
- this[i].addEventListener(s, n.listener, false);
3235
+ this[i].addEventListener(
3236
+ s,
3237
+ n.listener,
3238
+ false
3239
+ );
3222
3240
  });
3223
3241
  });
3224
3242
  })));
@@ -3227,41 +3245,45 @@
3227
3245
  this.#t && (this.#t.forEach((e) => {
3228
3246
  e.el.forEach((n) => {
3229
3247
  e.type.forEach((i) => {
3230
- this[n].removeEventListener(i, e.listener, false);
3248
+ this[n].removeEventListener(
3249
+ i,
3250
+ e.listener,
3251
+ false
3252
+ );
3231
3253
  });
3232
3254
  });
3233
- }), this.#t = null);
3255
+ }), this.#t = []);
3234
3256
  }
3235
3257
  async onCreateEntry() {
3236
3258
  this.trigger = document.querySelector(
3237
3259
  `[aria-controls="${this.id}"], [aria-describedby="${this.id}"]`
3238
- ), this.isTooltip ? (this.settings.event = "hover", this.el.setAttribute("role", "tooltip")) : this.trigger && this.trigger instanceof HTMLElement && this.trigger.setAttribute("aria-expanded", "false"), this.registerEventListeners();
3260
+ ), this.isTooltip ? (this.config.set({ event: "hover" }), this.el.setAttribute("role", "tooltip")) : this.trigger && this.trigger instanceof HTMLElement && this.trigger.setAttribute("aria-expanded", "false");
3239
3261
  }
3240
3262
  async onRegisterEntry() {
3241
- this.el.classList.contains(this.getSetting("stateActive")) ? await this.open() : this.el.inert = true;
3263
+ this.registerEventListeners(), this.el.classList.contains(this.config.get("stateActive")) ? await this.open() : this.el.inert = true;
3242
3264
  }
3243
3265
  async onDestroyEntry() {
3244
3266
  this.state === "opened" && await this.close(), this.floatingCleanup(), this.deregisterEventListeners();
3245
3267
  }
3246
3268
  }
3247
- class un extends oe {
3248
- #t;
3269
+ class cn extends ee {
3249
3270
  constructor(e) {
3250
- super({ ...re, ...e }), this.module = "Popover", this.entryClass = fn, this.trigger = null, this.#t = ln.bind(this);
3271
+ super({ ...ne, ...e }), this.entryClass = rn, this.name = "Popover", this.trigger = null, this.#t = sn.bind(this);
3251
3272
  }
3273
+ #t;
3252
3274
  get active() {
3253
3275
  return this.get("opened", "state");
3254
3276
  }
3255
3277
  get activeHover() {
3256
- return this.collection.find((e) => e.state == "opened" && e.getSetting("event") == "hover");
3278
+ return this.collection.find((e) => e.state == "opened" && e.config.get("event") == "hover");
3257
3279
  }
3258
3280
  async open(e) {
3259
3281
  const n = this.getOrThrow(e);
3260
- return Yt(n);
3282
+ return Ut(n);
3261
3283
  }
3262
3284
  async close(e) {
3263
3285
  const n = e ? this.getOrThrow(e) : void 0;
3264
- return n ? qt(n) : Ut(this);
3286
+ return n ? zt(n) : qt(this);
3265
3287
  }
3266
3288
  async afterMount() {
3267
3289
  document.addEventListener("keydown", this.#t, false);
@@ -3273,9 +3295,9 @@
3273
3295
  document.removeEventListener("keydown", this.#t, false);
3274
3296
  }
3275
3297
  }
3276
- exports2.Drawer = _;
3277
- exports2.Modal = H$1;
3278
- exports2.Popover = un;
3298
+ exports2.Drawer = q$1;
3299
+ exports2.Modal = P$1;
3300
+ exports2.Popover = cn;
3279
3301
  exports2.core = index;
3280
3302
  Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
3281
3303
  }));