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