vrembem 3.0.13 → 4.0.0-next.0

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 ADDED
@@ -0,0 +1,2235 @@
1
+ var b$2 = (t, e, n) => {
2
+ if (!e.has(t))
3
+ throw TypeError("Cannot " + n);
4
+ };
5
+ var o$1 = (t, e, n) => (b$2(t, e, "read from private field"), n ? n.call(t) : e.get(t)), f$2 = (t, e, n) => {
6
+ if (e.has(t))
7
+ throw TypeError("Cannot add the same private member more than once");
8
+ e instanceof WeakSet ? e.add(t) : e.set(t, n);
9
+ }, a = (t, e, n, i2) => (b$2(t, e, "write to private field"), i2 ? i2.call(t, n) : e.set(t, n), n);
10
+ var r$2;
11
+ let $$2 = class $ {
12
+ constructor(e, n) {
13
+ f$2(this, r$2, void 0);
14
+ this.value = e, a(this, r$2, n), this.mql = null;
15
+ }
16
+ get handler() {
17
+ return o$1(this, r$2);
18
+ }
19
+ // Unmount existing handler before setting a new one.
20
+ set handler(e) {
21
+ this.mql && (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o$1(this, r$2)) : this.mql.removeListener(o$1(this, r$2))), a(this, r$2, e);
22
+ }
23
+ mount(e, n) {
24
+ return e && (this.value = e), n && a(this, r$2, n), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), typeof this.mql.addEventListener == "function" ? this.mql.addEventListener("change", o$1(this, r$2)) : this.mql.addListener(o$1(this, r$2)), o$1(this, r$2).call(this, this.mql), this) : this;
25
+ }
26
+ unmount() {
27
+ return this.mql ? (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o$1(this, r$2)) : this.mql.removeListener(o$1(this, r$2)), this.value = null, a(this, r$2, null), this.mql = null, this) : this;
28
+ }
29
+ };
30
+ r$2 = /* @__PURE__ */ new WeakMap();
31
+ let T$2 = class T {
32
+ constructor() {
33
+ this.collection = [];
34
+ }
35
+ async register(e) {
36
+ return await this.deregister(e), this.collection.push(e), this.collection;
37
+ }
38
+ async deregister(e) {
39
+ const n = this.collection.findIndex((i2) => i2 === e);
40
+ if (n >= 0) {
41
+ const i2 = this.collection[n];
42
+ Object.getOwnPropertyNames(i2).forEach((l2) => {
43
+ delete i2[l2];
44
+ }), this.collection.splice(n, 1);
45
+ }
46
+ return this.collection;
47
+ }
48
+ async registerCollection(e) {
49
+ return await Promise.all(Array.from(e, (n) => {
50
+ this.register(n);
51
+ })), this.collection;
52
+ }
53
+ async deregisterCollection() {
54
+ for (; this.collection.length > 0; )
55
+ await this.deregister(this.collection[0]);
56
+ return this.collection;
57
+ }
58
+ get(e, n = "id") {
59
+ return this.collection.find((i2) => i2[n] === e);
60
+ }
61
+ };
62
+ const s = {
63
+ inert: ":not([inert]):not([inert] *)",
64
+ negTabIndex: ':not([tabindex^="-"])',
65
+ disabled: ":not(:disabled)"
66
+ }, v$2 = [
67
+ `a[href]${s.inert}${s.negTabIndex}`,
68
+ `area[href]${s.inert}${s.negTabIndex}`,
69
+ `input:not([type="hidden"]):not([type="radio"])${s.inert}${s.negTabIndex}${s.disabled}`,
70
+ `input[type="radio"]${s.inert}${s.negTabIndex}${s.disabled}`,
71
+ `select${s.inert}${s.negTabIndex}${s.disabled}`,
72
+ `textarea${s.inert}${s.negTabIndex}${s.disabled}`,
73
+ `button${s.inert}${s.negTabIndex}${s.disabled}`,
74
+ `details${s.inert} > summary:first-of-type${s.negTabIndex}`,
75
+ // Discard until Firefox supports `:has()`
76
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
77
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
78
+ `iframe${s.inert}${s.negTabIndex}`,
79
+ `audio[controls]${s.inert}${s.negTabIndex}`,
80
+ `video[controls]${s.inert}${s.negTabIndex}`,
81
+ `[contenteditable]${s.inert}${s.negTabIndex}`,
82
+ `[tabindex]${s.inert}${s.negTabIndex}`
83
+ ];
84
+ var h$2, d$1, u$2;
85
+ let x$1 = class x {
86
+ constructor(e = null, n = "[data-focus]") {
87
+ f$2(this, h$2, void 0);
88
+ f$2(this, d$1, void 0);
89
+ f$2(this, u$2, void 0);
90
+ this.el = e, this.selectorFocus = n, a(this, d$1, p$2.bind(this)), a(this, u$2, g$2.bind(this));
91
+ }
92
+ get focusable() {
93
+ return o$1(this, h$2);
94
+ }
95
+ set focusable(e) {
96
+ a(this, h$2, e), o$1(this, h$2).length ? (document.removeEventListener("keydown", o$1(this, u$2)), document.addEventListener("keydown", o$1(this, d$1))) : (document.removeEventListener("keydown", o$1(this, d$1)), document.addEventListener("keydown", o$1(this, u$2)));
97
+ }
98
+ get focusableFirst() {
99
+ return this.focusable[0];
100
+ }
101
+ get focusableLast() {
102
+ return this.focusable[this.focusable.length - 1];
103
+ }
104
+ mount(e, n) {
105
+ e && (this.el = e), n && (this.selectorFocus = n), this.focusable = this.getFocusable(), this.focus();
106
+ }
107
+ unmount() {
108
+ this.el = null, this.focusable = [], document.removeEventListener("keydown", o$1(this, d$1)), document.removeEventListener("keydown", o$1(this, u$2));
109
+ }
110
+ focus(e = this.el, n = this.selectorFocus) {
111
+ (e.querySelector(n) || e).focus();
112
+ }
113
+ getFocusable(e = this.el) {
114
+ const n = [], i2 = document.activeElement, l2 = e.scrollTop;
115
+ return e.querySelectorAll(v$2.join(",")).forEach((m2) => {
116
+ m2.focus(), document.activeElement === m2 && n.push(m2);
117
+ }), e.scrollTop = l2, i2.focus(), n;
118
+ }
119
+ };
120
+ h$2 = /* @__PURE__ */ new WeakMap(), d$1 = /* @__PURE__ */ new WeakMap(), u$2 = /* @__PURE__ */ new WeakMap();
121
+ function p$2(t) {
122
+ (t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
123
+ }
124
+ function g$2(t) {
125
+ (t.key === "Tab" || t.keyCode === 9) && t.preventDefault();
126
+ }
127
+ function q$2(t, e) {
128
+ const i2 = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
129
+ return i2 ? JSON.parse(i2) : {};
130
+ }
131
+ function I$3() {
132
+ return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
133
+ }
134
+ function C$2(t, e = true) {
135
+ const n = localStorage.getItem(t), i2 = n ? JSON.parse(n) : {};
136
+ return {
137
+ get(l2) {
138
+ return l2 ? i2[l2] : i2;
139
+ },
140
+ set(l2, c2) {
141
+ return c2 ? i2[l2] = c2 : delete i2[l2], e && localStorage.setItem(t, JSON.stringify(i2)), i2;
142
+ }
143
+ };
144
+ }
145
+ function O$2(t, e, n) {
146
+ const i2 = e.nodeType === Node.COMMENT_NODE, l2 = e.nodeType === Node.ELEMENT_NODE;
147
+ if (e = i2 || l2 ? e : document.querySelector(e), i2 && (n = "after"), !e)
148
+ throw new Error(`Not a valid teleport reference: '${e}'`);
149
+ if (typeof e[n] != "function")
150
+ throw new Error(`Not a valid teleport method: '${n}'`);
151
+ let c2 = null;
152
+ return i2 || (c2 = document.createComment("teleported #" + t.id), t.before(c2)), e[n](t), i2 && e.remove(), c2;
153
+ }
154
+ const S$3 = (t, e) => new Promise((n) => {
155
+ e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i2() {
156
+ t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), n(t), this.removeEventListener("transitionend", i2);
157
+ })) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), n(t));
158
+ }), F$3 = (t, e) => new Promise((n) => {
159
+ e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i2() {
160
+ t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), n(t), this.removeEventListener("transitionend", i2);
161
+ })) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), n(t));
162
+ });
163
+ function y$2(t, e) {
164
+ e && document.querySelectorAll(e).forEach((i2) => {
165
+ t ? i2.style.overflow = "hidden" : i2.style.removeProperty("overflow");
166
+ });
167
+ }
168
+ function L$2(t, e) {
169
+ e && document.querySelectorAll(e).forEach((i2) => {
170
+ t ? (i2.inert = true, i2.setAttribute("aria-hidden", true)) : (i2.inert = null, i2.removeAttribute("aria-hidden"));
171
+ });
172
+ }
173
+ function k$3(t, e) {
174
+ L$2(!!t, e.selectorInert), y$2(!!t, e.selectorOverflow);
175
+ }
176
+ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
177
+ __proto__: null,
178
+ Breakpoint: $$2,
179
+ Collection: T$2,
180
+ FocusTrap: x$1,
181
+ closeTransition: F$3,
182
+ getConfig: q$2,
183
+ getPrefix: I$3,
184
+ localStore: C$2,
185
+ openTransition: S$3,
186
+ teleport: O$2,
187
+ updateGlobalState: k$3
188
+ }, Symbol.toStringTag, { value: "Module" }));
189
+ const i = {
190
+ autoInit: false,
191
+ stateAttr: "aria-checked",
192
+ stateValue: "mixed"
193
+ };
194
+ let r$1 = class r {
195
+ constructor(t) {
196
+ this.defaults = i, this.settings = { ...this.defaults, ...t }, this.__handlerClick = this.handlerClick.bind(this), this.settings.autoInit && this.init();
197
+ }
198
+ init(t = null) {
199
+ t && (this.settings = { ...this.settings, ...t });
200
+ const e = `[${this.settings.stateAttr}="${this.settings.stateValue}"]`, s2 = document.querySelectorAll(e);
201
+ this.setIndeterminate(s2), document.addEventListener("click", this.__handlerClick, false);
202
+ }
203
+ destroy() {
204
+ document.removeEventListener("click", this.__handlerClick, false);
205
+ }
206
+ handlerClick(t) {
207
+ const e = `[${this.settings.stateAttr}="${this.settings.stateValue}"]`, s2 = t.target.closest(e);
208
+ s2 && (this.removeAriaState(s2), this.setIndeterminate(s2));
209
+ }
210
+ setAriaState(t, e = this.settings.stateValue) {
211
+ t = t.forEach ? t : [t], t.forEach((s2) => {
212
+ s2.setAttribute(this.settings.stateAttr, e);
213
+ });
214
+ }
215
+ removeAriaState(t) {
216
+ t = t.forEach ? t : [t], t.forEach((e) => {
217
+ e.removeAttribute(this.settings.stateAttr);
218
+ });
219
+ }
220
+ setIndeterminate(t) {
221
+ t = t.forEach ? t : [t], t.forEach((e) => {
222
+ e.hasAttribute(this.settings.stateAttr) ? e.indeterminate = true : e.indeterminate = false;
223
+ });
224
+ }
225
+ };
226
+ var S$2 = (t, e, s2) => {
227
+ if (!e.has(t))
228
+ throw TypeError("Cannot " + s2);
229
+ };
230
+ var p$1 = (t, e, s2) => (S$2(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), E$1 = (t, e, s2) => {
231
+ if (e.has(t))
232
+ throw TypeError("Cannot add the same private member more than once");
233
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
234
+ }, $$1 = (t, e, s2, i2) => (S$2(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2);
235
+ var I$2 = (t, e, s2) => {
236
+ if (!e.has(t))
237
+ throw TypeError("Cannot " + s2);
238
+ }, l$1 = (t, e, s2) => (I$2(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), w$1 = (t, e, s2) => {
239
+ if (e.has(t))
240
+ throw TypeError("Cannot add the same private member more than once");
241
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
242
+ }, h$1 = (t, e, s2, i2) => (I$2(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2), c$1;
243
+ let M$2 = class M {
244
+ constructor(e, s2) {
245
+ w$1(this, c$1, void 0), this.value = e, h$1(this, c$1, s2), this.mql = null;
246
+ }
247
+ get handler() {
248
+ return l$1(this, c$1);
249
+ }
250
+ // Unmount existing handler before setting a new one.
251
+ set handler(e) {
252
+ this.mql && (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", l$1(this, c$1)) : this.mql.removeListener(l$1(this, c$1))), h$1(this, c$1, e);
253
+ }
254
+ mount(e, s2) {
255
+ return e && (this.value = e), s2 && h$1(this, c$1, s2), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), typeof this.mql.addEventListener == "function" ? this.mql.addEventListener("change", l$1(this, c$1)) : this.mql.addListener(l$1(this, c$1)), l$1(this, c$1).call(this, this.mql), this) : this;
256
+ }
257
+ unmount() {
258
+ return this.mql ? (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", l$1(this, c$1)) : this.mql.removeListener(l$1(this, c$1)), this.value = null, h$1(this, c$1, null), this.mql = null, this) : this;
259
+ }
260
+ };
261
+ c$1 = /* @__PURE__ */ new WeakMap();
262
+ let P$1 = class P {
263
+ constructor() {
264
+ this.collection = [];
265
+ }
266
+ async register(e) {
267
+ return await this.deregister(e), this.collection.push(e), this.collection;
268
+ }
269
+ async deregister(e) {
270
+ const s2 = this.collection.findIndex((i2) => i2 === e);
271
+ if (s2 >= 0) {
272
+ const i2 = this.collection[s2];
273
+ Object.getOwnPropertyNames(i2).forEach((n) => {
274
+ delete i2[n];
275
+ }), this.collection.splice(s2, 1);
276
+ }
277
+ return this.collection;
278
+ }
279
+ async registerCollection(e) {
280
+ return await Promise.all(Array.from(e, (s2) => {
281
+ this.register(s2);
282
+ })), this.collection;
283
+ }
284
+ async deregisterCollection() {
285
+ for (; this.collection.length > 0; )
286
+ await this.deregister(this.collection[0]);
287
+ return this.collection;
288
+ }
289
+ get(e, s2 = "id") {
290
+ return this.collection.find((i2) => i2[s2] === e);
291
+ }
292
+ };
293
+ const r2 = {
294
+ inert: ":not([inert]):not([inert] *)",
295
+ negTabIndex: ':not([tabindex^="-"])',
296
+ disabled: ":not(:disabled)"
297
+ }, F$2 = [
298
+ `a[href]${r2.inert}${r2.negTabIndex}`,
299
+ `area[href]${r2.inert}${r2.negTabIndex}`,
300
+ `input:not([type="hidden"]):not([type="radio"])${r2.inert}${r2.negTabIndex}${r2.disabled}`,
301
+ `input[type="radio"]${r2.inert}${r2.negTabIndex}${r2.disabled}`,
302
+ `select${r2.inert}${r2.negTabIndex}${r2.disabled}`,
303
+ `textarea${r2.inert}${r2.negTabIndex}${r2.disabled}`,
304
+ `button${r2.inert}${r2.negTabIndex}${r2.disabled}`,
305
+ `details${r2.inert} > summary:first-of-type${r2.negTabIndex}`,
306
+ // Discard until Firefox supports `:has()`
307
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
308
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
309
+ `iframe${r2.inert}${r2.negTabIndex}`,
310
+ `audio[controls]${r2.inert}${r2.negTabIndex}`,
311
+ `video[controls]${r2.inert}${r2.negTabIndex}`,
312
+ `[contenteditable]${r2.inert}${r2.negTabIndex}`,
313
+ `[tabindex]${r2.inert}${r2.negTabIndex}`
314
+ ];
315
+ var v$1, u$1, g$1;
316
+ let B$2 = class B {
317
+ constructor(e = null, s2 = "[data-focus]") {
318
+ w$1(this, v$1, void 0), w$1(this, u$1, void 0), w$1(this, g$1, void 0), this.el = e, this.selectorFocus = s2, h$1(this, u$1, _$2.bind(this)), h$1(this, g$1, N$2.bind(this));
319
+ }
320
+ get focusable() {
321
+ return l$1(this, v$1);
322
+ }
323
+ set focusable(e) {
324
+ h$1(this, v$1, e), l$1(this, v$1).length ? (document.removeEventListener("keydown", l$1(this, g$1)), document.addEventListener("keydown", l$1(this, u$1))) : (document.removeEventListener("keydown", l$1(this, u$1)), document.addEventListener("keydown", l$1(this, g$1)));
325
+ }
326
+ get focusableFirst() {
327
+ return this.focusable[0];
328
+ }
329
+ get focusableLast() {
330
+ return this.focusable[this.focusable.length - 1];
331
+ }
332
+ mount(e, s2) {
333
+ e && (this.el = e), s2 && (this.selectorFocus = s2), this.focusable = this.getFocusable(), this.focus();
334
+ }
335
+ unmount() {
336
+ this.el = null, this.focusable = [], document.removeEventListener("keydown", l$1(this, u$1)), document.removeEventListener("keydown", l$1(this, g$1));
337
+ }
338
+ focus(e = this.el, s2 = this.selectorFocus) {
339
+ (e.querySelector(s2) || e).focus();
340
+ }
341
+ getFocusable(e = this.el) {
342
+ const s2 = [], i2 = document.activeElement, n = e.scrollTop;
343
+ return e.querySelectorAll(F$2.join(",")).forEach((a2) => {
344
+ a2.focus(), document.activeElement === a2 && s2.push(a2);
345
+ }), e.scrollTop = n, i2.focus(), s2;
346
+ }
347
+ };
348
+ v$1 = /* @__PURE__ */ new WeakMap(), u$1 = /* @__PURE__ */ new WeakMap(), g$1 = /* @__PURE__ */ new WeakMap();
349
+ function _$2(t) {
350
+ (t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
351
+ }
352
+ function N$2(t) {
353
+ (t.key === "Tab" || t.keyCode === 9) && t.preventDefault();
354
+ }
355
+ function K$2(t, e) {
356
+ const s2 = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
357
+ return s2 ? JSON.parse(s2) : {};
358
+ }
359
+ function W$1() {
360
+ return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
361
+ }
362
+ function V(t, e = true) {
363
+ const s2 = localStorage.getItem(t), i2 = s2 ? JSON.parse(s2) : {};
364
+ return {
365
+ get(n) {
366
+ return n ? i2[n] : i2;
367
+ },
368
+ set(n, a2) {
369
+ return a2 ? i2[n] = a2 : delete i2[n], e && localStorage.setItem(t, JSON.stringify(i2)), i2;
370
+ }
371
+ };
372
+ }
373
+ const J$2 = (t, e) => new Promise((s2) => {
374
+ e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i2() {
375
+ t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), s2(t), this.removeEventListener("transitionend", i2);
376
+ })) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), s2(t));
377
+ }), z$1 = (t, e) => new Promise((s2) => {
378
+ e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i2() {
379
+ t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), s2(t), this.removeEventListener("transitionend", i2);
380
+ })) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), s2(t));
381
+ });
382
+ function G$1(t, e) {
383
+ e && document.querySelectorAll(e).forEach((s2) => {
384
+ t ? s2.style.overflow = "hidden" : s2.style.removeProperty("overflow");
385
+ });
386
+ }
387
+ function H$2(t, e) {
388
+ e && document.querySelectorAll(e).forEach((s2) => {
389
+ t ? (s2.inert = true, s2.setAttribute("aria-hidden", true)) : (s2.inert = null, s2.removeAttribute("aria-hidden"));
390
+ });
391
+ }
392
+ function k$2(t, e) {
393
+ H$2(!!t, e.selectorInert), G$1(!!t, e.selectorOverflow);
394
+ }
395
+ const Q$1 = {
396
+ autoInit: false,
397
+ // Data attributes
398
+ dataOpen: "drawer-open",
399
+ dataClose: "drawer-close",
400
+ dataToggle: "drawer-toggle",
401
+ dataBreakpoint: "drawer-breakpoint",
402
+ dataConfig: "drawer-config",
403
+ // Selectors
404
+ selectorDrawer: ".drawer",
405
+ selectorDialog: ".drawer__dialog",
406
+ selectorFocus: "[data-focus]",
407
+ selectorInert: null,
408
+ selectorOverflow: "body",
409
+ // State classes
410
+ stateOpened: "is-opened",
411
+ stateOpening: "is-opening",
412
+ stateClosing: "is-closing",
413
+ stateClosed: "is-closed",
414
+ // Classes
415
+ classModal: "drawer_modal",
416
+ // Feature toggles
417
+ breakpoints: null,
418
+ customEventPrefix: "drawer:",
419
+ eventListeners: true,
420
+ store: true,
421
+ storeKey: "VB:DrawerState",
422
+ setTabindex: true,
423
+ transition: true
424
+ };
425
+ function R$1(t) {
426
+ const e = t.target.closest(`
427
+ [data-${this.settings.dataOpen}],
428
+ [data-${this.settings.dataToggle}],
429
+ [data-${this.settings.dataClose}]
430
+ `);
431
+ if (e) {
432
+ t.preventDefault(), e.matches(`[data-${this.settings.dataToggle}]`) && e.getAttribute(`data-${this.settings.dataToggle}`).trim().split(" ").forEach((i2) => {
433
+ const n = this.get(i2);
434
+ n.trigger = e, n.toggle();
435
+ }), e.matches(`[data-${this.settings.dataOpen}]`) && e.getAttribute(`data-${this.settings.dataOpen}`).trim().split(" ").forEach((i2) => {
436
+ const n = this.get(i2);
437
+ n.trigger = e, n.open();
438
+ }), e.matches(`[data-${this.settings.dataClose}]`) && e.getAttribute(`data-${this.settings.dataClose}`).trim().split(" ").forEach((i2) => {
439
+ if (i2) {
440
+ const n = this.get(i2);
441
+ n.trigger = e, n.close();
442
+ } else {
443
+ const n = t.target.closest(this.settings.selectorDrawer);
444
+ n && this.close(n);
445
+ }
446
+ });
447
+ return;
448
+ }
449
+ t.target.matches(this.settings.selectorDrawer) && this.close(t.target.id);
450
+ }
451
+ function U$1(t) {
452
+ if (t.key === "Escape") {
453
+ const e = this.activeModal;
454
+ e && this.close(e);
455
+ }
456
+ }
457
+ async function L$1(t, e = true) {
458
+ if (!t)
459
+ return this.collection;
460
+ const s2 = this.collection.findIndex((i2) => i2.id === t.id);
461
+ if (s2 >= 0) {
462
+ const i2 = this.collection[s2];
463
+ e && i2.state === "opened" && await i2.close(false), this.store.set(i2.id), i2.unmountBreakpoint(), Object.getOwnPropertyNames(i2).forEach((n) => {
464
+ delete i2[n];
465
+ }), this.collection.splice(s2, 1);
466
+ }
467
+ return this.collection;
468
+ }
469
+ function X(t) {
470
+ const e = W$1(), s2 = t.getAttribute(`data-${this.settings.dataBreakpoint}`);
471
+ return this.settings.breakpoints && this.settings.breakpoints[s2] ? this.settings.breakpoints[s2] : getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${s2}`).trim() ? getComputedStyle(document.body).getPropertyValue(`--${e}breakpoint-${s2}`).trim() : s2;
472
+ }
473
+ function y$1(t) {
474
+ const e = typeof t == "string" ? this.get(t) : this.get(t.id);
475
+ if (e)
476
+ return e;
477
+ throw new Error(`Drawer not found in collection with id of "${t.id || t}".`);
478
+ }
479
+ function O$1(t) {
480
+ return typeof t == "string" ? t : typeof t.hasAttribute == "function" ? t.hasAttribute(`data-${this.settings.dataOpen}`) ? t.getAttribute(`data-${this.settings.dataOpen}`) : t.hasAttribute(`data-${this.settings.dataClose}`) ? t.getAttribute(`data-${this.settings.dataClose}`) || false : t.hasAttribute(`data-${this.settings.dataToggle}`) ? t.getAttribute(`data-${this.settings.dataToggle}`) : t.closest(this.settings.selectorDrawer) ? (t = t.closest(this.settings.selectorDrawer), t.id || false) : false : t.id ? t.id : false;
481
+ }
482
+ function Y(t) {
483
+ const e = O$1.call(this, t);
484
+ if (e) {
485
+ const s2 = document.querySelector(`#${e}`), i2 = s2 ? s2.querySelector(this.settings.selectorDialog) : null;
486
+ return !s2 && !i2 ? { error: new Error(`No drawer elements found using the ID: "${e}".`) } : i2 ? { drawer: s2, dialog: i2 } : { error: new Error("Drawer is missing dialog element.") };
487
+ } else
488
+ return { error: new Error("Could not resolve the drawer ID.") };
489
+ }
490
+ async function A$1(t) {
491
+ this.store.get(t.id) ? this.store.get(t.id) === "opened" ? await t.open(false, false) : await t.close(false, false) : t.el.classList.contains(this.settings.stateOpened) ? t.state = "opened" : (t.el.classList.remove(this.settings.stateOpening), t.el.classList.remove(this.settings.stateClosing), t.el.classList.add(this.settings.stateClosed));
492
+ }
493
+ function D$2(t) {
494
+ t.state === "opened" ? t.mode === "modal" ? this.focusTrap.mount(t.dialog, this.settings.selectorFocus) : this.focusTrap.focus(t.dialog, this.settings.selectorFocus) : (t.trigger && (t.trigger.focus(), t.trigger = null), this.focusTrap.unmount());
495
+ }
496
+ async function C$1(t, e, s2 = true) {
497
+ const i2 = y$1.call(this, t), n = { ...this.settings, ...i2.settings };
498
+ return e !== void 0 && (n.transition = e), i2.state === "closed" && (i2.state = "opening", await J$2(i2.el, n), i2.mode === "modal" && k$2(true, n), i2.state = "opened"), s2 && D$2.call(this, i2), i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "opened", {
499
+ detail: this,
500
+ bubbles: true
501
+ })), i2;
502
+ }
503
+ async function b$1(t, e, s2 = true) {
504
+ const i2 = y$1.call(this, t), n = { ...this.settings, ...i2.settings };
505
+ return e !== void 0 && (n.transition = e), i2.state === "opened" && (i2.state = "closing", document.activeElement.blur(), await z$1(i2.el, n), i2.mode === "modal" && k$2(false, n), s2 && D$2.call(this, i2), i2.state = "closed", i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "closed", {
506
+ detail: this,
507
+ bubbles: true
508
+ }))), i2;
509
+ }
510
+ async function q$1(t, e, s2) {
511
+ const i2 = y$1.call(this, t);
512
+ return i2.state === "closed" ? C$1.call(this, i2, e, s2) : b$1.call(this, i2, e, s2);
513
+ }
514
+ function Z$1(t) {
515
+ switch (t.mode) {
516
+ case "inline":
517
+ return j.call(this, t);
518
+ case "modal":
519
+ return tt$1.call(this, t);
520
+ default:
521
+ throw new Error(`"${t.mode}" is not a valid drawer mode.`);
522
+ }
523
+ }
524
+ async function j(t) {
525
+ return t.el.classList.remove(t.getSetting("classModal")), t.dialog.removeAttribute("aria-modal"), k$2(false, { ...this.settings, ...t.settings }), this.focusTrap.unmount(), await A$1.call(this, t), t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
526
+ detail: this,
527
+ bubbles: true
528
+ })), t;
529
+ }
530
+ async function tt$1(t) {
531
+ return t.el.classList.add(t.getSetting("classModal")), t.dialog.setAttribute("aria-modal", "true"), !this.store.get(t.id) && t.el.classList.contains(t.getSetting("stateOpened")) && this.store.set(t.id, "opened"), await b$1.call(this, t, false, false), t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", {
532
+ detail: this,
533
+ bubbles: true
534
+ })), t;
535
+ }
536
+ async function et$1(t, e) {
537
+ await L$1.call(this, t, false);
538
+ const s2 = this, i2 = new M$2(), n = {
539
+ open(o2, d2) {
540
+ return C$1.call(s2, this, o2, d2);
541
+ },
542
+ close(o2, d2) {
543
+ return b$1.call(s2, this, o2, d2);
544
+ },
545
+ toggle(o2, d2) {
546
+ return q$1.call(s2, this, o2, d2);
547
+ },
548
+ deregister() {
549
+ return L$1.call(s2, this);
550
+ },
551
+ mountBreakpoint() {
552
+ const o2 = this.breakpoint, d2 = this.handleBreakpoint.bind(this);
553
+ return i2.mount(o2, d2), this;
554
+ },
555
+ unmountBreakpoint() {
556
+ return i2.unmount(), this;
557
+ },
558
+ handleBreakpoint(o2) {
559
+ return this.mode = o2.matches ? "inline" : "modal", this;
560
+ },
561
+ getSetting(o2) {
562
+ return o2 in this.settings ? this.settings[o2] : s2.settings[o2];
563
+ }
564
+ }, a2 = {
565
+ id: t.id,
566
+ el: t,
567
+ dialog: e,
568
+ trigger: null,
569
+ settings: K$2(t, this.settings.dataConfig),
570
+ get breakpoint() {
571
+ return X.call(s2, t);
572
+ },
573
+ get state() {
574
+ return T3;
575
+ },
576
+ set state(o2) {
577
+ T3 = o2, (o2 === "opened" || o2 === "closed") && this.mode === "inline" && s2.store.set(this.id, this.state);
578
+ },
579
+ get mode() {
580
+ return x3;
581
+ },
582
+ set mode(o2) {
583
+ x3 = o2, Z$1.call(s2, this);
584
+ },
585
+ ...n
586
+ };
587
+ let T3 = t.classList.contains(a2.getSetting("stateOpened")) ? "opened" : "closed", x3 = t.classList.contains(a2.getSetting("classModal")) ? "modal" : "inline";
588
+ return a2.mode === "modal" ? a2.dialog.setAttribute("aria-modal", "true") : a2.dialog.removeAttribute("aria-modal"), a2.getSetting("setTabindex") && a2.dialog.setAttribute("tabindex", "-1"), this.collection.push(a2), a2.breakpoint ? a2.mountBreakpoint() : await A$1.call(this, a2), a2;
589
+ }
590
+ var f$1, m$1;
591
+ let it$1 = class it extends P$1 {
592
+ constructor(s2) {
593
+ super();
594
+ E$1(this, f$1, void 0);
595
+ E$1(this, m$1, void 0);
596
+ this.defaults = Q$1, this.settings = { ...this.defaults, ...s2 }, this.focusTrap = new B$2(), this.store = V(this.settings.storeKey, this.settings.store), $$1(this, f$1, R$1.bind(this)), $$1(this, m$1, U$1.bind(this)), this.settings.autoInit && this.init();
597
+ }
598
+ get activeModal() {
599
+ return this.collection.find((s2) => s2.state === "opened" && s2.mode === "modal");
600
+ }
601
+ async init(s2 = null) {
602
+ s2 && (this.settings = { ...this.settings, ...s2 });
603
+ const i2 = document.querySelectorAll(this.settings.selectorDrawer);
604
+ return await this.registerCollection(i2), this.settings.eventListeners && this.initEventListeners(), this;
605
+ }
606
+ async destroy() {
607
+ return await this.deregisterCollection(), this.settings.eventListeners && this.destroyEventListeners(), this;
608
+ }
609
+ initEventListeners() {
610
+ document.addEventListener("click", p$1(this, f$1), false), document.addEventListener("keydown", p$1(this, m$1), false);
611
+ }
612
+ destroyEventListeners() {
613
+ document.removeEventListener("click", p$1(this, f$1), false), document.removeEventListener("keydown", p$1(this, m$1), false);
614
+ }
615
+ register(s2) {
616
+ const i2 = Y.call(this, s2);
617
+ return i2.error ? Promise.reject(i2.error) : et$1.call(this, i2.drawer, i2.dialog);
618
+ }
619
+ deregister(s2) {
620
+ const i2 = this.get(O$1.call(this, s2));
621
+ return L$1.call(this, i2);
622
+ }
623
+ open(s2, i2, n) {
624
+ return C$1.call(this, s2, i2, n);
625
+ }
626
+ close(s2, i2, n) {
627
+ return b$1.call(this, s2, i2, n);
628
+ }
629
+ toggle(s2, i2, n) {
630
+ return q$1.call(this, s2, i2, n);
631
+ }
632
+ };
633
+ f$1 = /* @__PURE__ */ new WeakMap(), m$1 = /* @__PURE__ */ new WeakMap();
634
+ var I$1 = (t, e, s2) => {
635
+ if (!e.has(t))
636
+ throw TypeError("Cannot " + s2);
637
+ };
638
+ var f = (t, e, s2) => (I$1(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), v = (t, e, s2) => {
639
+ if (e.has(t))
640
+ throw TypeError("Cannot add the same private member more than once");
641
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
642
+ }, b = (t, e, s2, i2) => (I$1(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2);
643
+ var k$1 = (t, e, s2) => {
644
+ if (!e.has(t))
645
+ throw TypeError("Cannot " + s2);
646
+ }, o = (t, e, s2) => (k$1(t, e, "read from private field"), s2 ? s2.call(t) : e.get(t)), y = (t, e, s2) => {
647
+ if (e.has(t))
648
+ throw TypeError("Cannot add the same private member more than once");
649
+ e instanceof WeakSet ? e.add(t) : e.set(t, s2);
650
+ }, E = (t, e, s2, i2) => (k$1(t, e, "write to private field"), i2 ? i2.call(t, s2) : e.set(t, s2), s2);
651
+ class A {
652
+ constructor() {
653
+ this.collection = [];
654
+ }
655
+ async register(e) {
656
+ return await this.deregister(e), this.collection.push(e), this.collection;
657
+ }
658
+ async deregister(e) {
659
+ const s2 = this.collection.findIndex((i2) => i2 === e);
660
+ if (s2 >= 0) {
661
+ const i2 = this.collection[s2];
662
+ Object.getOwnPropertyNames(i2).forEach((n) => {
663
+ delete i2[n];
664
+ }), this.collection.splice(s2, 1);
665
+ }
666
+ return this.collection;
667
+ }
668
+ async registerCollection(e) {
669
+ return await Promise.all(Array.from(e, (s2) => {
670
+ this.register(s2);
671
+ })), this.collection;
672
+ }
673
+ async deregisterCollection() {
674
+ for (; this.collection.length > 0; )
675
+ await this.deregister(this.collection[0]);
676
+ return this.collection;
677
+ }
678
+ get(e, s2 = "id") {
679
+ return this.collection.find((i2) => i2[s2] === e);
680
+ }
681
+ }
682
+ const l = {
683
+ inert: ":not([inert]):not([inert] *)",
684
+ negTabIndex: ':not([tabindex^="-"])',
685
+ disabled: ":not(:disabled)"
686
+ }, S$1 = [
687
+ `a[href]${l.inert}${l.negTabIndex}`,
688
+ `area[href]${l.inert}${l.negTabIndex}`,
689
+ `input:not([type="hidden"]):not([type="radio"])${l.inert}${l.negTabIndex}${l.disabled}`,
690
+ `input[type="radio"]${l.inert}${l.negTabIndex}${l.disabled}`,
691
+ `select${l.inert}${l.negTabIndex}${l.disabled}`,
692
+ `textarea${l.inert}${l.negTabIndex}${l.disabled}`,
693
+ `button${l.inert}${l.negTabIndex}${l.disabled}`,
694
+ `details${l.inert} > summary:first-of-type${l.negTabIndex}`,
695
+ // Discard until Firefox supports `:has()`
696
+ // See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
697
+ // `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
698
+ `iframe${l.inert}${l.negTabIndex}`,
699
+ `audio[controls]${l.inert}${l.negTabIndex}`,
700
+ `video[controls]${l.inert}${l.negTabIndex}`,
701
+ `[contenteditable]${l.inert}${l.negTabIndex}`,
702
+ `[tabindex]${l.inert}${l.negTabIndex}`
703
+ ];
704
+ var g, c, d;
705
+ let M$1 = class M2 {
706
+ constructor(e = null, s2 = "[data-focus]") {
707
+ y(this, g, void 0), y(this, c, void 0), y(this, d, void 0), this.el = e, this.selectorFocus = s2, E(this, c, R.bind(this)), E(this, d, N$1.bind(this));
708
+ }
709
+ get focusable() {
710
+ return o(this, g);
711
+ }
712
+ set focusable(e) {
713
+ E(this, g, e), o(this, g).length ? (document.removeEventListener("keydown", o(this, d)), document.addEventListener("keydown", o(this, c))) : (document.removeEventListener("keydown", o(this, c)), document.addEventListener("keydown", o(this, d)));
714
+ }
715
+ get focusableFirst() {
716
+ return this.focusable[0];
717
+ }
718
+ get focusableLast() {
719
+ return this.focusable[this.focusable.length - 1];
720
+ }
721
+ mount(e, s2) {
722
+ e && (this.el = e), s2 && (this.selectorFocus = s2), this.focusable = this.getFocusable(), this.focus();
723
+ }
724
+ unmount() {
725
+ this.el = null, this.focusable = [], document.removeEventListener("keydown", o(this, c)), document.removeEventListener("keydown", o(this, d));
726
+ }
727
+ focus(e = this.el, s2 = this.selectorFocus) {
728
+ (e.querySelector(s2) || e).focus();
729
+ }
730
+ getFocusable(e = this.el) {
731
+ const s2 = [], i2 = document.activeElement, n = e.scrollTop;
732
+ return e.querySelectorAll(S$1.join(",")).forEach((r3) => {
733
+ r3.focus(), document.activeElement === r3 && s2.push(r3);
734
+ }), e.scrollTop = n, i2.focus(), s2;
735
+ }
736
+ };
737
+ g = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap();
738
+ function R(t) {
739
+ (t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus()));
740
+ }
741
+ function N$1(t) {
742
+ (t.key === "Tab" || t.keyCode === 9) && t.preventDefault();
743
+ }
744
+ function P2(t, e) {
745
+ const s2 = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"');
746
+ return s2 ? JSON.parse(s2) : {};
747
+ }
748
+ function T$1(t, e, s2) {
749
+ const i2 = e.nodeType === Node.COMMENT_NODE, n = e.nodeType === Node.ELEMENT_NODE;
750
+ if (e = i2 || n ? e : document.querySelector(e), i2 && (s2 = "after"), !e)
751
+ throw new Error(`Not a valid teleport reference: '${e}'`);
752
+ if (typeof e[s2] != "function")
753
+ throw new Error(`Not a valid teleport method: '${s2}'`);
754
+ let r3 = null;
755
+ return i2 || (r3 = document.createComment("teleported #" + t.id), t.before(r3)), e[s2](t), i2 && e.remove(), r3;
756
+ }
757
+ const D$1 = (t, e) => new Promise((s2) => {
758
+ e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i2() {
759
+ t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), s2(t), this.removeEventListener("transitionend", i2);
760
+ })) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), s2(t));
761
+ }), F$1 = (t, e) => new Promise((s2) => {
762
+ e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i2() {
763
+ t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), s2(t), this.removeEventListener("transitionend", i2);
764
+ })) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), s2(t));
765
+ });
766
+ function q(t, e) {
767
+ e && document.querySelectorAll(e).forEach((s2) => {
768
+ t ? s2.style.overflow = "hidden" : s2.style.removeProperty("overflow");
769
+ });
770
+ }
771
+ function z(t, e) {
772
+ e && document.querySelectorAll(e).forEach((s2) => {
773
+ t ? (s2.inert = true, s2.setAttribute("aria-hidden", true)) : (s2.inert = null, s2.removeAttribute("aria-hidden"));
774
+ });
775
+ }
776
+ function W(t, e) {
777
+ z(!!t, e.selectorInert), q(!!t, e.selectorOverflow);
778
+ }
779
+ const _$1 = {
780
+ autoInit: false,
781
+ // Data attributes
782
+ dataOpen: "modal-open",
783
+ dataClose: "modal-close",
784
+ dataReplace: "modal-replace",
785
+ dataConfig: "modal-config",
786
+ // Selectors
787
+ selectorModal: ".modal",
788
+ selectorDialog: ".modal__dialog",
789
+ selectorRequired: '[role="alertdialog"]',
790
+ selectorFocus: "[data-focus]",
791
+ selectorInert: null,
792
+ selectorOverflow: "body",
793
+ // State classes
794
+ stateOpened: "is-opened",
795
+ stateOpening: "is-opening",
796
+ stateClosing: "is-closing",
797
+ stateClosed: "is-closed",
798
+ // Feature settings
799
+ customEventPrefix: "modal:",
800
+ eventListeners: true,
801
+ teleport: null,
802
+ teleportMethod: "append",
803
+ setTabindex: true,
804
+ transition: true
805
+ };
806
+ function L(t) {
807
+ const e = typeof t == "string" ? this.get(t) : this.get(t.id);
808
+ if (e)
809
+ return e;
810
+ throw new Error(`Modal not found in collection with id of "${t.id || t}".`);
811
+ }
812
+ function p(t) {
813
+ return typeof t == "string" ? t : typeof t.hasAttribute == "function" ? t.hasAttribute(`data-${this.settings.dataOpen}`) ? t.getAttribute(`data-${this.settings.dataOpen}`) : t.hasAttribute(`data-${this.settings.dataClose}`) ? t.getAttribute(`data-${this.settings.dataClose}`) || false : t.hasAttribute(`data-${this.settings.dataReplace}`) ? t.getAttribute(`data-${this.settings.dataReplace}`) : t.closest(this.settings.selectorModal) ? (t = t.closest(this.settings.selectorModal), t.id || false) : false : t.id ? t.id : false;
814
+ }
815
+ function G(t) {
816
+ const e = p.call(this, t);
817
+ if (e) {
818
+ const s2 = document.querySelector(`#${e}`), i2 = s2 ? s2.querySelector(this.settings.selectorDialog) : null;
819
+ return !s2 && !i2 ? { error: new Error(`No modal elements found using the ID: "${e}".`) } : i2 ? { modal: s2, dialog: i2 } : { error: new Error("Modal is missing dialog element.") };
820
+ } else
821
+ return { error: new Error("Could not resolve the modal ID.") };
822
+ }
823
+ function m() {
824
+ this.active ? this.focusTrap.mount(this.active.dialog, this.settings.selectorFocus) : (this.trigger && (this.trigger.focus(), this.trigger = null), this.focusTrap.unmount());
825
+ }
826
+ async function K$1(t) {
827
+ let e = t.target.closest(
828
+ `[data-${this.settings.dataOpen}], [data-${this.settings.dataReplace}]`
829
+ );
830
+ if (e) {
831
+ t.preventDefault(), t.target.closest(this.settings.selectorModal) || (this.trigger = e);
832
+ const i2 = this.get(p.call(this, e));
833
+ return e.matches(`[data-${this.settings.dataOpen}]`) ? i2.open() : i2.replace();
834
+ }
835
+ if (e = t.target.closest(`[data-${this.settings.dataClose}]`), e) {
836
+ t.preventDefault();
837
+ const s2 = e.getAttribute(`data-${this.settings.dataClose}`);
838
+ return s2 === "*" ? this.closeAll() : this.close(s2);
839
+ }
840
+ if (t.target.matches(this.settings.selectorModal) && !t.target.querySelector(this.settings.selectorRequired))
841
+ return this.close(p.call(this, t.target));
842
+ }
843
+ function J$1(t) {
844
+ if (t.key === "Escape" && this.active && !this.active.dialog.matches(this.settings.selectorRequired))
845
+ return this.close();
846
+ }
847
+ async function w(t, e = true) {
848
+ if (!t)
849
+ return this.collection;
850
+ const s2 = this.collection.findIndex((i2) => i2.id === t.id);
851
+ if (s2 >= 0) {
852
+ const i2 = this.collection[s2];
853
+ e && i2.state === "opened" ? await i2.close(false) : this.stack.remove(i2), i2.getSetting("teleport") && i2.teleportReturn(), Object.getOwnPropertyNames(i2).forEach((n) => {
854
+ delete i2[n];
855
+ }), this.collection.splice(s2, 1);
856
+ }
857
+ return this.collection;
858
+ }
859
+ async function x2(t, e, s2 = true) {
860
+ const i2 = L.call(this, t), n = { ...this.settings, ...i2.settings };
861
+ return e !== void 0 && (n.transition = e), this.stack.moveToTop(i2), i2.state === "closed" && (i2.state = "opening", this.stack.add(i2), await D$1(i2.el, n), i2.state = "opened"), s2 && m.call(this), i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "opened", {
862
+ detail: this,
863
+ bubbles: true
864
+ })), i2;
865
+ }
866
+ async function C(t, e, s2 = true) {
867
+ const i2 = t ? L.call(this, t) : this.active;
868
+ if (i2 && i2.state === "opened") {
869
+ i2.state = "closing";
870
+ const n = { ...this.settings, ...i2.settings };
871
+ e !== void 0 && (n.transition = e), document.activeElement.blur(), await F$1(i2.el, n), this.stack.remove(i2), s2 && m.call(this), i2.state = "closed", i2.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "closed", {
872
+ detail: this,
873
+ bubbles: true
874
+ }));
875
+ }
876
+ return i2;
877
+ }
878
+ async function $2(t, e) {
879
+ const s2 = [];
880
+ return await Promise.all(this.stack.value.map(async (i2) => {
881
+ t && t === i2.id ? Promise.resolve() : s2.push(await C.call(this, i2, e, false)), i2.trigger = null;
882
+ })), s2;
883
+ }
884
+ async function O(t, e, s2 = true) {
885
+ const i2 = L.call(this, t);
886
+ let n, r3;
887
+ return i2.state === "opened" ? (n = i2, r3 = await $2.call(this, i2.id, e)) : (n = x2.call(this, i2, e, false), r3 = $2.call(this, false, e), await Promise.all([n, r3])), s2 && m.call(this), { opened: n, closed: r3 };
888
+ }
889
+ async function B$1(t, e) {
890
+ await w.call(this, t, false);
891
+ const s2 = this, i2 = {
892
+ open(r3, a2) {
893
+ return x2.call(s2, this, r3, a2);
894
+ },
895
+ close(r3, a2) {
896
+ return C.call(s2, this, r3, a2);
897
+ },
898
+ replace(r3, a2) {
899
+ return O.call(s2, this, r3, a2);
900
+ },
901
+ deregister() {
902
+ return w.call(s2, this);
903
+ },
904
+ teleport(r3 = this.getSetting("teleport"), a2 = this.getSetting("teleportMethod")) {
905
+ return this.returnRef ? (console.error("Element has already been teleported:", this.el), false) : (this.returnRef = T$1(this.el, r3, a2), this.el);
906
+ },
907
+ teleportReturn() {
908
+ return this.returnRef ? (this.returnRef = T$1(this.el, this.returnRef), this.el) : (console.error("No return reference found:", this.el), false);
909
+ },
910
+ getSetting(r3) {
911
+ return r3 in this.settings ? this.settings[r3] : s2.settings[r3];
912
+ }
913
+ }, n = {
914
+ id: t.id,
915
+ state: "closed",
916
+ el: t,
917
+ dialog: e,
918
+ returnRef: null,
919
+ settings: P2(t, this.settings.dataConfig),
920
+ ...i2
921
+ };
922
+ return n.dialog.setAttribute("aria-modal", "true"), n.dialog.hasAttribute("role") || n.dialog.setAttribute("role", "dialog"), n.getSetting("setTabindex") && n.dialog.setAttribute("tabindex", "-1"), n.getSetting("teleport") && n.teleport(), this.collection.push(n), n.el.classList.contains(this.settings.stateOpened) ? await n.open(false) : (n.el.classList.remove(this.settings.stateOpening), n.el.classList.remove(this.settings.stateClosing), n.el.classList.add(this.settings.stateClosed)), n;
923
+ }
924
+ function H$1(t) {
925
+ const e = [];
926
+ return {
927
+ get value() {
928
+ return [...e];
929
+ },
930
+ get top() {
931
+ return e[e.length - 1];
932
+ },
933
+ updateIndex() {
934
+ e.forEach((s2, i2) => {
935
+ s2.el.style.zIndex = null;
936
+ const n = getComputedStyle(s2.el)["z-index"];
937
+ s2.el.style.zIndex = parseInt(n) + i2 + 1;
938
+ });
939
+ },
940
+ updateGlobalState() {
941
+ W(this.top, t), this.updateIndex();
942
+ },
943
+ add(s2) {
944
+ s2.el.style.zIndex = null;
945
+ const i2 = getComputedStyle(s2.el)["z-index"];
946
+ s2.el.style.zIndex = parseInt(i2) + e.length + 1, e.push(s2), this.updateGlobalState();
947
+ },
948
+ remove(s2) {
949
+ const i2 = e.findIndex((n) => n.id === s2.id);
950
+ i2 >= 0 && (s2.el.style.zIndex = null, e.splice(i2, 1), this.updateGlobalState());
951
+ },
952
+ moveToTop(s2) {
953
+ const i2 = e.findIndex((n) => n.id === s2.id);
954
+ i2 >= 0 && (e.splice(i2, 1), this.add(s2));
955
+ }
956
+ };
957
+ }
958
+ var u, h;
959
+ class U extends A {
960
+ constructor(s2) {
961
+ super();
962
+ v(this, u, void 0);
963
+ v(this, h, void 0);
964
+ this.defaults = _$1, this.settings = { ...this.defaults, ...s2 }, this.trigger = null, this.focusTrap = new M$1(), this.stack = H$1(this.settings), b(this, u, K$1.bind(this)), b(this, h, J$1.bind(this)), this.settings.autoInit && this.init();
965
+ }
966
+ get active() {
967
+ return this.stack.top;
968
+ }
969
+ async init(s2) {
970
+ s2 && (this.settings = { ...this.settings, ...s2 });
971
+ const i2 = document.querySelectorAll(this.settings.selectorModal);
972
+ return await this.registerCollection(i2), this.settings.eventListeners && this.initEventListeners(), this;
973
+ }
974
+ async destroy() {
975
+ return this.trigger = null, await this.deregisterCollection(), this.settings.eventListeners && this.destroyEventListeners(), this;
976
+ }
977
+ initEventListeners() {
978
+ document.addEventListener("click", f(this, u), false), document.addEventListener("keydown", f(this, h), false);
979
+ }
980
+ destroyEventListeners() {
981
+ document.removeEventListener("click", f(this, u), false), document.removeEventListener("keydown", f(this, h), false);
982
+ }
983
+ register(s2) {
984
+ const i2 = G.call(this, s2);
985
+ return i2.error ? Promise.reject(i2.error) : B$1.call(this, i2.modal, i2.dialog);
986
+ }
987
+ deregister(s2) {
988
+ const i2 = this.get(p.call(this, s2));
989
+ return w.call(this, i2);
990
+ }
991
+ open(s2, i2, n) {
992
+ return x2.call(this, s2, i2, n);
993
+ }
994
+ close(s2, i2, n) {
995
+ return C.call(this, s2, i2, n);
996
+ }
997
+ replace(s2, i2, n) {
998
+ return O.call(this, s2, i2, n);
999
+ }
1000
+ async closeAll(s2 = false, i2, n = true) {
1001
+ const r3 = await $2.call(this, s2, i2);
1002
+ return n && m.call(this), r3;
1003
+ }
1004
+ }
1005
+ u = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new WeakMap();
1006
+ var Ue = (e, t, r3) => {
1007
+ if (!t.has(e))
1008
+ throw TypeError("Cannot " + r3);
1009
+ };
1010
+ var Ae = (e, t, r3) => (Ue(e, t, "read from private field"), r3 ? r3.call(e) : t.get(e)), _e = (e, t, r3) => {
1011
+ if (t.has(e))
1012
+ throw TypeError("Cannot add the same private member more than once");
1013
+ t instanceof WeakSet ? t.add(e) : t.set(e, r3);
1014
+ }, Ke = (e, t, r3, i2) => (Ue(e, t, "write to private field"), i2 ? i2.call(e, r3) : t.set(e, r3), r3);
1015
+ class Ct {
1016
+ constructor() {
1017
+ this.collection = [];
1018
+ }
1019
+ async register(t) {
1020
+ return await this.deregister(t), this.collection.push(t), this.collection;
1021
+ }
1022
+ async deregister(t) {
1023
+ const r3 = this.collection.findIndex((i2) => i2 === t);
1024
+ if (r3 >= 0) {
1025
+ const i2 = this.collection[r3];
1026
+ Object.getOwnPropertyNames(i2).forEach((n) => {
1027
+ delete i2[n];
1028
+ }), this.collection.splice(r3, 1);
1029
+ }
1030
+ return this.collection;
1031
+ }
1032
+ async registerCollection(t) {
1033
+ return await Promise.all(Array.from(t, (r3) => {
1034
+ this.register(r3);
1035
+ })), this.collection;
1036
+ }
1037
+ async deregisterCollection() {
1038
+ for (; this.collection.length > 0; )
1039
+ await this.deregister(this.collection[0]);
1040
+ return this.collection;
1041
+ }
1042
+ get(t, r3 = "id") {
1043
+ return this.collection.find((i2) => i2[r3] === t);
1044
+ }
1045
+ }
1046
+ function kt() {
1047
+ return getComputedStyle(document.body).getPropertyValue("--vrembem-variable-prefix").trim();
1048
+ }
1049
+ const Dt = {
1050
+ autoInit: false,
1051
+ // Selectors
1052
+ selectorPopover: ".popover",
1053
+ selectorArrow: ".popover__arrow",
1054
+ // State classes
1055
+ stateActive: "is-active",
1056
+ // Feature settings
1057
+ eventListeners: true,
1058
+ eventType: "click",
1059
+ placement: "bottom"
1060
+ };
1061
+ function ot(e, t) {
1062
+ const r3 = getComputedStyle(e), i2 = {
1063
+ placement: t.placement,
1064
+ event: t.eventType,
1065
+ offset: 0,
1066
+ "overflow-padding": 0,
1067
+ "flip-padding": 0,
1068
+ "arrow-element": t.selectorArrow,
1069
+ "arrow-padding": 0
1070
+ };
1071
+ for (const n in i2) {
1072
+ const o2 = kt(), l2 = r3.getPropertyValue(`--${o2}popover-${n}`).trim();
1073
+ l2 && (i2[n] = l2);
1074
+ }
1075
+ return i2;
1076
+ }
1077
+ function Pe(e) {
1078
+ let t;
1079
+ const r3 = typeof e == "string" ? e.trim().split(" ") : [e];
1080
+ switch (r3.forEach(function(i2, n) {
1081
+ r3[n] = parseInt(i2, 10);
1082
+ }), r3.length) {
1083
+ case 1:
1084
+ t = r3[0];
1085
+ break;
1086
+ case 2:
1087
+ t = {
1088
+ top: r3[0],
1089
+ right: r3[1],
1090
+ bottom: r3[0],
1091
+ left: r3[1]
1092
+ };
1093
+ break;
1094
+ case 3:
1095
+ t = {
1096
+ top: r3[0],
1097
+ right: r3[1],
1098
+ bottom: r3[2],
1099
+ left: r3[1]
1100
+ };
1101
+ break;
1102
+ case 4:
1103
+ t = {
1104
+ top: r3[0],
1105
+ right: r3[1],
1106
+ bottom: r3[2],
1107
+ left: r3[3]
1108
+ };
1109
+ break;
1110
+ default:
1111
+ t = false;
1112
+ break;
1113
+ }
1114
+ return t;
1115
+ }
1116
+ function Rt(e) {
1117
+ return [{
1118
+ name: "offset",
1119
+ options: {
1120
+ offset: [0, parseInt(e.offset, 10)]
1121
+ }
1122
+ }, {
1123
+ name: "preventOverflow",
1124
+ options: {
1125
+ padding: Pe(e["overflow-padding"])
1126
+ }
1127
+ }, {
1128
+ name: "flip",
1129
+ options: {
1130
+ padding: Pe(e["flip-padding"])
1131
+ }
1132
+ }, {
1133
+ name: "arrow",
1134
+ options: {
1135
+ element: e["arrow-element"],
1136
+ padding: Pe(e["arrow-padding"])
1137
+ }
1138
+ }];
1139
+ }
1140
+ function at(e) {
1141
+ const t = typeof e == "string" ? this.get(e) : this.get(e.id);
1142
+ if (t)
1143
+ return t;
1144
+ throw new Error(`Popover not found in collection with id of "${e}".`);
1145
+ }
1146
+ function st(e) {
1147
+ return typeof e == "string" ? e : typeof e.hasAttribute == "function" ? e.closest(this.settings.selectorPopover) ? (e = e.closest(this.settings.selectorPopover), e.id) : e.hasAttribute("aria-controls") ? e.getAttribute("aria-controls") : e.hasAttribute("aria-describedby") ? e.getAttribute("aria-describedby") : false : e.id ? e.id : false;
1148
+ }
1149
+ function Bt(e) {
1150
+ const t = st.call(this, e);
1151
+ if (t) {
1152
+ const r3 = document.querySelector(`#${t}`), i2 = document.querySelector(`[aria-controls="${t}"]`) || document.querySelector(`[aria-describedby="${t}"]`);
1153
+ return !i2 && !r3 ? { error: new Error(`No popover elements found using the ID: "${t}".`) } : i2 ? r3 ? { popover: r3, trigger: i2 } : { error: new Error("No popover associated with the provided popover trigger.") } : { error: new Error("No popover trigger associated with the provided popover.") };
1154
+ } else
1155
+ return { error: new Error("Could not resolve the popover ID.") };
1156
+ }
1157
+ async function ke(e) {
1158
+ const t = e ? at.call(this, e) : await ct.call(this);
1159
+ return t && t.state === "opened" && (t.el.classList.remove(this.settings.stateActive), t.trigger.hasAttribute("aria-controls") && t.trigger.setAttribute("aria-expanded", "false"), t.popper.setOptions({
1160
+ modifiers: [{ name: "eventListeners", enabled: false }]
1161
+ }), t.state = "closed", t.trigger === this.trigger && (this.trigger = null)), t;
1162
+ }
1163
+ async function ct() {
1164
+ const e = [];
1165
+ return await Promise.all(this.collection.map(async (t) => {
1166
+ t.state === "opened" && e.push(await ke.call(this, t));
1167
+ })), e;
1168
+ }
1169
+ function lt(e) {
1170
+ e.state == "opened" && setTimeout(() => {
1171
+ const t = e.el.closest(":hover") === e.el || e.trigger.closest(":hover") === e.trigger, r3 = document.activeElement.closest(
1172
+ `#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`
1173
+ );
1174
+ return !t && !r3 && e.close(), e;
1175
+ }, 1);
1176
+ }
1177
+ function Tt(e) {
1178
+ e.state === "opened" ? e.close() : (this.trigger = e.trigger, e.open(), ft.call(this, e));
1179
+ }
1180
+ function St(e) {
1181
+ switch (e.key) {
1182
+ case "Escape":
1183
+ this.trigger && this.trigger.focus(), ct.call(this);
1184
+ return;
1185
+ case "Tab":
1186
+ this.collection.forEach((t) => {
1187
+ lt.call(this, t);
1188
+ });
1189
+ return;
1190
+ default:
1191
+ return;
1192
+ }
1193
+ }
1194
+ function ft(e) {
1195
+ const t = this;
1196
+ document.addEventListener("click", function r3(i2) {
1197
+ i2.target.closest(
1198
+ `#${e.id}, [aria-controls="${e.id}"], [aria-describedby="${e.id}"]`
1199
+ ) ? e.el && !e.el.classList.contains(t.settings.stateActive) && this.removeEventListener("click", r3) : (e.el && e.el.classList.contains(t.settings.stateActive) && e.close(), this.removeEventListener("click", r3));
1200
+ });
1201
+ }
1202
+ var k = "top", S = "bottom", M3 = "right", D = "left", De = "auto", le = [k, S, M3, D], Q = "start", se = "end", Mt = "clippingParents", ut = "viewport", ne = "popper", Wt = "reference", Ge = /* @__PURE__ */ le.reduce(function(e, t) {
1203
+ return e.concat([t + "-" + Q, t + "-" + se]);
1204
+ }, []), pt = /* @__PURE__ */ [].concat(le, [De]).reduce(function(e, t) {
1205
+ return e.concat([t, t + "-" + Q, t + "-" + se]);
1206
+ }, []), jt = "beforeRead", Ht = "read", Nt = "afterRead", It = "beforeMain", Vt = "main", Ft = "afterMain", qt = "beforeWrite", Xt = "write", Yt = "afterWrite", zt = [jt, Ht, Nt, It, Vt, Ft, qt, Xt, Yt];
1207
+ function N(e) {
1208
+ return e ? (e.nodeName || "").toLowerCase() : null;
1209
+ }
1210
+ function B2(e) {
1211
+ if (e == null)
1212
+ return window;
1213
+ if (e.toString() !== "[object Window]") {
1214
+ var t = e.ownerDocument;
1215
+ return t && t.defaultView || window;
1216
+ }
1217
+ return e;
1218
+ }
1219
+ function K(e) {
1220
+ var t = B2(e).Element;
1221
+ return e instanceof t || e instanceof Element;
1222
+ }
1223
+ function T2(e) {
1224
+ var t = B2(e).HTMLElement;
1225
+ return e instanceof t || e instanceof HTMLElement;
1226
+ }
1227
+ function Re(e) {
1228
+ if (typeof ShadowRoot > "u")
1229
+ return false;
1230
+ var t = B2(e).ShadowRoot;
1231
+ return e instanceof t || e instanceof ShadowRoot;
1232
+ }
1233
+ function Ut(e) {
1234
+ var t = e.state;
1235
+ Object.keys(t.elements).forEach(function(r3) {
1236
+ var i2 = t.styles[r3] || {}, n = t.attributes[r3] || {}, o2 = t.elements[r3];
1237
+ !T2(o2) || !N(o2) || (Object.assign(o2.style, i2), Object.keys(n).forEach(function(l2) {
1238
+ var s2 = n[l2];
1239
+ s2 === false ? o2.removeAttribute(l2) : o2.setAttribute(l2, s2 === true ? "" : s2);
1240
+ }));
1241
+ });
1242
+ }
1243
+ function _t(e) {
1244
+ var t = e.state, r3 = {
1245
+ popper: {
1246
+ position: t.options.strategy,
1247
+ left: "0",
1248
+ top: "0",
1249
+ margin: "0"
1250
+ },
1251
+ arrow: {
1252
+ position: "absolute"
1253
+ },
1254
+ reference: {}
1255
+ };
1256
+ return Object.assign(t.elements.popper.style, r3.popper), t.styles = r3, t.elements.arrow && Object.assign(t.elements.arrow.style, r3.arrow), function() {
1257
+ Object.keys(t.elements).forEach(function(i2) {
1258
+ var n = t.elements[i2], o2 = t.attributes[i2] || {}, l2 = Object.keys(t.styles.hasOwnProperty(i2) ? t.styles[i2] : r3[i2]), s2 = l2.reduce(function(a2, f2) {
1259
+ return a2[f2] = "", a2;
1260
+ }, {});
1261
+ !T2(n) || !N(n) || (Object.assign(n.style, s2), Object.keys(o2).forEach(function(a2) {
1262
+ n.removeAttribute(a2);
1263
+ }));
1264
+ });
1265
+ };
1266
+ }
1267
+ const Kt = {
1268
+ name: "applyStyles",
1269
+ enabled: true,
1270
+ phase: "write",
1271
+ fn: Ut,
1272
+ effect: _t,
1273
+ requires: ["computeStyles"]
1274
+ };
1275
+ function H(e) {
1276
+ return e.split("-")[0];
1277
+ }
1278
+ var _ = Math.max, ye = Math.min, Z = Math.round;
1279
+ function Le() {
1280
+ var e = navigator.userAgentData;
1281
+ return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
1282
+ return t.brand + "/" + t.version;
1283
+ }).join(" ") : navigator.userAgent;
1284
+ }
1285
+ function dt() {
1286
+ return !/^((?!chrome|android).)*safari/i.test(Le());
1287
+ }
1288
+ function ee(e, t, r3) {
1289
+ t === void 0 && (t = false), r3 === void 0 && (r3 = false);
1290
+ var i2 = e.getBoundingClientRect(), n = 1, o2 = 1;
1291
+ t && T2(e) && (n = e.offsetWidth > 0 && Z(i2.width) / e.offsetWidth || 1, o2 = e.offsetHeight > 0 && Z(i2.height) / e.offsetHeight || 1);
1292
+ var l2 = K(e) ? B2(e) : window, s2 = l2.visualViewport, a2 = !dt() && r3, f2 = (i2.left + (a2 && s2 ? s2.offsetLeft : 0)) / n, c2 = (i2.top + (a2 && s2 ? s2.offsetTop : 0)) / o2, h2 = i2.width / n, y2 = i2.height / o2;
1293
+ return {
1294
+ width: h2,
1295
+ height: y2,
1296
+ top: c2,
1297
+ right: f2 + h2,
1298
+ bottom: c2 + y2,
1299
+ left: f2,
1300
+ x: f2,
1301
+ y: c2
1302
+ };
1303
+ }
1304
+ function Be(e) {
1305
+ var t = ee(e), r3 = e.offsetWidth, i2 = e.offsetHeight;
1306
+ return Math.abs(t.width - r3) <= 1 && (r3 = t.width), Math.abs(t.height - i2) <= 1 && (i2 = t.height), {
1307
+ x: e.offsetLeft,
1308
+ y: e.offsetTop,
1309
+ width: r3,
1310
+ height: i2
1311
+ };
1312
+ }
1313
+ function vt(e, t) {
1314
+ var r3 = t.getRootNode && t.getRootNode();
1315
+ if (e.contains(t))
1316
+ return true;
1317
+ if (r3 && Re(r3)) {
1318
+ var i2 = t;
1319
+ do {
1320
+ if (i2 && e.isSameNode(i2))
1321
+ return true;
1322
+ i2 = i2.parentNode || i2.host;
1323
+ } while (i2);
1324
+ }
1325
+ return false;
1326
+ }
1327
+ function I(e) {
1328
+ return B2(e).getComputedStyle(e);
1329
+ }
1330
+ function Gt(e) {
1331
+ return ["table", "td", "th"].indexOf(N(e)) >= 0;
1332
+ }
1333
+ function F(e) {
1334
+ return ((K(e) ? e.ownerDocument : (
1335
+ // $FlowFixMe[prop-missing]
1336
+ e.document
1337
+ )) || window.document).documentElement;
1338
+ }
1339
+ function we(e) {
1340
+ return N(e) === "html" ? e : (
1341
+ // this is a quicker (but less type safe) way to save quite some bytes from the bundle
1342
+ // $FlowFixMe[incompatible-return]
1343
+ // $FlowFixMe[prop-missing]
1344
+ e.assignedSlot || // step into the shadow DOM of the parent of a slotted node
1345
+ e.parentNode || // DOM Element detected
1346
+ (Re(e) ? e.host : null) || // ShadowRoot detected
1347
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
1348
+ F(e)
1349
+ );
1350
+ }
1351
+ function Je(e) {
1352
+ return !T2(e) || // https://github.com/popperjs/popper-core/issues/837
1353
+ I(e).position === "fixed" ? null : e.offsetParent;
1354
+ }
1355
+ function Jt(e) {
1356
+ var t = /firefox/i.test(Le()), r3 = /Trident/i.test(Le());
1357
+ if (r3 && T2(e)) {
1358
+ var i2 = I(e);
1359
+ if (i2.position === "fixed")
1360
+ return null;
1361
+ }
1362
+ var n = we(e);
1363
+ for (Re(n) && (n = n.host); T2(n) && ["html", "body"].indexOf(N(n)) < 0; ) {
1364
+ var o2 = I(n);
1365
+ if (o2.transform !== "none" || o2.perspective !== "none" || o2.contain === "paint" || ["transform", "perspective"].indexOf(o2.willChange) !== -1 || t && o2.willChange === "filter" || t && o2.filter && o2.filter !== "none")
1366
+ return n;
1367
+ n = n.parentNode;
1368
+ }
1369
+ return null;
1370
+ }
1371
+ function fe(e) {
1372
+ for (var t = B2(e), r3 = Je(e); r3 && Gt(r3) && I(r3).position === "static"; )
1373
+ r3 = Je(r3);
1374
+ return r3 && (N(r3) === "html" || N(r3) === "body" && I(r3).position === "static") ? t : r3 || Jt(e) || t;
1375
+ }
1376
+ function Te(e) {
1377
+ return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
1378
+ }
1379
+ function oe(e, t, r3) {
1380
+ return _(e, ye(t, r3));
1381
+ }
1382
+ function Qt(e, t, r3) {
1383
+ var i2 = oe(e, t, r3);
1384
+ return i2 > r3 ? r3 : i2;
1385
+ }
1386
+ function ht() {
1387
+ return {
1388
+ top: 0,
1389
+ right: 0,
1390
+ bottom: 0,
1391
+ left: 0
1392
+ };
1393
+ }
1394
+ function gt(e) {
1395
+ return Object.assign({}, ht(), e);
1396
+ }
1397
+ function mt(e, t) {
1398
+ return t.reduce(function(r3, i2) {
1399
+ return r3[i2] = e, r3;
1400
+ }, {});
1401
+ }
1402
+ var Zt = function(t, r3) {
1403
+ return t = typeof t == "function" ? t(Object.assign({}, r3.rects, {
1404
+ placement: r3.placement
1405
+ })) : t, gt(typeof t != "number" ? t : mt(t, le));
1406
+ };
1407
+ function er(e) {
1408
+ var t, r3 = e.state, i2 = e.name, n = e.options, o2 = r3.elements.arrow, l2 = r3.modifiersData.popperOffsets, s2 = H(r3.placement), a2 = Te(s2), f2 = [D, M3].indexOf(s2) >= 0, c2 = f2 ? "height" : "width";
1409
+ if (!(!o2 || !l2)) {
1410
+ var h2 = Zt(n.padding, r3), y2 = Be(o2), u2 = a2 === "y" ? k : D, b2 = a2 === "y" ? S : M3, v2 = r3.rects.reference[c2] + r3.rects.reference[a2] - l2[a2] - r3.rects.popper[c2], d2 = l2[a2] - r3.rects.reference[a2], w2 = fe(o2), O2 = w2 ? a2 === "y" ? w2.clientHeight || 0 : w2.clientWidth || 0 : 0, E2 = v2 / 2 - d2 / 2, p2 = h2[u2], g2 = O2 - y2[c2] - h2[b2], m2 = O2 / 2 - y2[c2] / 2 + E2, x3 = oe(p2, m2, g2), L2 = a2;
1411
+ r3.modifiersData[i2] = (t = {}, t[L2] = x3, t.centerOffset = x3 - m2, t);
1412
+ }
1413
+ }
1414
+ function tr(e) {
1415
+ var t = e.state, r3 = e.options, i2 = r3.element, n = i2 === void 0 ? "[data-popper-arrow]" : i2;
1416
+ n != null && (typeof n == "string" && (n = t.elements.popper.querySelector(n), !n) || vt(t.elements.popper, n) && (t.elements.arrow = n));
1417
+ }
1418
+ const rr = {
1419
+ name: "arrow",
1420
+ enabled: true,
1421
+ phase: "main",
1422
+ fn: er,
1423
+ effect: tr,
1424
+ requires: ["popperOffsets"],
1425
+ requiresIfExists: ["preventOverflow"]
1426
+ };
1427
+ function te(e) {
1428
+ return e.split("-")[1];
1429
+ }
1430
+ var ir = {
1431
+ top: "auto",
1432
+ right: "auto",
1433
+ bottom: "auto",
1434
+ left: "auto"
1435
+ };
1436
+ function nr(e, t) {
1437
+ var r3 = e.x, i2 = e.y, n = t.devicePixelRatio || 1;
1438
+ return {
1439
+ x: Z(r3 * n) / n || 0,
1440
+ y: Z(i2 * n) / n || 0
1441
+ };
1442
+ }
1443
+ function Qe(e) {
1444
+ var t, r3 = e.popper, i2 = e.popperRect, n = e.placement, o2 = e.variation, l2 = e.offsets, s2 = e.position, a2 = e.gpuAcceleration, f2 = e.adaptive, c2 = e.roundOffsets, h2 = e.isFixed, y2 = l2.x, u2 = y2 === void 0 ? 0 : y2, b2 = l2.y, v2 = b2 === void 0 ? 0 : b2, d2 = typeof c2 == "function" ? c2({
1445
+ x: u2,
1446
+ y: v2
1447
+ }) : {
1448
+ x: u2,
1449
+ y: v2
1450
+ };
1451
+ u2 = d2.x, v2 = d2.y;
1452
+ var w2 = l2.hasOwnProperty("x"), O2 = l2.hasOwnProperty("y"), E2 = D, p2 = k, g2 = window;
1453
+ if (f2) {
1454
+ var m2 = fe(r3), x3 = "clientHeight", L2 = "clientWidth";
1455
+ if (m2 === B2(r3) && (m2 = F(r3), I(m2).position !== "static" && s2 === "absolute" && (x3 = "scrollHeight", L2 = "scrollWidth")), m2 = m2, n === k || (n === D || n === M3) && o2 === se) {
1456
+ p2 = S;
1457
+ var P3 = h2 && m2 === g2 && g2.visualViewport ? g2.visualViewport.height : (
1458
+ // $FlowFixMe[prop-missing]
1459
+ m2[x3]
1460
+ );
1461
+ v2 -= P3 - i2.height, v2 *= a2 ? 1 : -1;
1462
+ }
1463
+ if (n === D || (n === k || n === S) && o2 === se) {
1464
+ E2 = M3;
1465
+ var A2 = h2 && m2 === g2 && g2.visualViewport ? g2.visualViewport.width : (
1466
+ // $FlowFixMe[prop-missing]
1467
+ m2[L2]
1468
+ );
1469
+ u2 -= A2 - i2.width, u2 *= a2 ? 1 : -1;
1470
+ }
1471
+ }
1472
+ var $3 = Object.assign({
1473
+ position: s2
1474
+ }, f2 && ir), W2 = c2 === true ? nr({
1475
+ x: u2,
1476
+ y: v2
1477
+ }, B2(r3)) : {
1478
+ x: u2,
1479
+ y: v2
1480
+ };
1481
+ if (u2 = W2.x, v2 = W2.y, a2) {
1482
+ var C2;
1483
+ return Object.assign({}, $3, (C2 = {}, C2[p2] = O2 ? "0" : "", C2[E2] = w2 ? "0" : "", C2.transform = (g2.devicePixelRatio || 1) <= 1 ? "translate(" + u2 + "px, " + v2 + "px)" : "translate3d(" + u2 + "px, " + v2 + "px, 0)", C2));
1484
+ }
1485
+ return Object.assign({}, $3, (t = {}, t[p2] = O2 ? v2 + "px" : "", t[E2] = w2 ? u2 + "px" : "", t.transform = "", t));
1486
+ }
1487
+ function or(e) {
1488
+ var t = e.state, r3 = e.options, i2 = r3.gpuAcceleration, n = i2 === void 0 ? true : i2, o2 = r3.adaptive, l2 = o2 === void 0 ? true : o2, s2 = r3.roundOffsets, a2 = s2 === void 0 ? true : s2, f2 = {
1489
+ placement: H(t.placement),
1490
+ variation: te(t.placement),
1491
+ popper: t.elements.popper,
1492
+ popperRect: t.rects.popper,
1493
+ gpuAcceleration: n,
1494
+ isFixed: t.options.strategy === "fixed"
1495
+ };
1496
+ t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, Qe(Object.assign({}, f2, {
1497
+ offsets: t.modifiersData.popperOffsets,
1498
+ position: t.options.strategy,
1499
+ adaptive: l2,
1500
+ roundOffsets: a2
1501
+ })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, Qe(Object.assign({}, f2, {
1502
+ offsets: t.modifiersData.arrow,
1503
+ position: "absolute",
1504
+ adaptive: false,
1505
+ roundOffsets: a2
1506
+ })))), t.attributes.popper = Object.assign({}, t.attributes.popper, {
1507
+ "data-popper-placement": t.placement
1508
+ });
1509
+ }
1510
+ const ar = {
1511
+ name: "computeStyles",
1512
+ enabled: true,
1513
+ phase: "beforeWrite",
1514
+ fn: or,
1515
+ data: {}
1516
+ };
1517
+ var ge = {
1518
+ passive: true
1519
+ };
1520
+ function sr(e) {
1521
+ var t = e.state, r3 = e.instance, i2 = e.options, n = i2.scroll, o2 = n === void 0 ? true : n, l2 = i2.resize, s2 = l2 === void 0 ? true : l2, a2 = B2(t.elements.popper), f2 = [].concat(t.scrollParents.reference, t.scrollParents.popper);
1522
+ return o2 && f2.forEach(function(c2) {
1523
+ c2.addEventListener("scroll", r3.update, ge);
1524
+ }), s2 && a2.addEventListener("resize", r3.update, ge), function() {
1525
+ o2 && f2.forEach(function(c2) {
1526
+ c2.removeEventListener("scroll", r3.update, ge);
1527
+ }), s2 && a2.removeEventListener("resize", r3.update, ge);
1528
+ };
1529
+ }
1530
+ const cr = {
1531
+ name: "eventListeners",
1532
+ enabled: true,
1533
+ phase: "write",
1534
+ fn: function() {
1535
+ },
1536
+ effect: sr,
1537
+ data: {}
1538
+ };
1539
+ var lr = {
1540
+ left: "right",
1541
+ right: "left",
1542
+ bottom: "top",
1543
+ top: "bottom"
1544
+ };
1545
+ function me(e) {
1546
+ return e.replace(/left|right|bottom|top/g, function(t) {
1547
+ return lr[t];
1548
+ });
1549
+ }
1550
+ var fr = {
1551
+ start: "end",
1552
+ end: "start"
1553
+ };
1554
+ function Ze(e) {
1555
+ return e.replace(/start|end/g, function(t) {
1556
+ return fr[t];
1557
+ });
1558
+ }
1559
+ function Se(e) {
1560
+ var t = B2(e), r3 = t.pageXOffset, i2 = t.pageYOffset;
1561
+ return {
1562
+ scrollLeft: r3,
1563
+ scrollTop: i2
1564
+ };
1565
+ }
1566
+ function Me(e) {
1567
+ return ee(F(e)).left + Se(e).scrollLeft;
1568
+ }
1569
+ function ur(e, t) {
1570
+ var r3 = B2(e), i2 = F(e), n = r3.visualViewport, o2 = i2.clientWidth, l2 = i2.clientHeight, s2 = 0, a2 = 0;
1571
+ if (n) {
1572
+ o2 = n.width, l2 = n.height;
1573
+ var f2 = dt();
1574
+ (f2 || !f2 && t === "fixed") && (s2 = n.offsetLeft, a2 = n.offsetTop);
1575
+ }
1576
+ return {
1577
+ width: o2,
1578
+ height: l2,
1579
+ x: s2 + Me(e),
1580
+ y: a2
1581
+ };
1582
+ }
1583
+ function pr(e) {
1584
+ var t, r3 = F(e), i2 = Se(e), n = (t = e.ownerDocument) == null ? void 0 : t.body, o2 = _(r3.scrollWidth, r3.clientWidth, n ? n.scrollWidth : 0, n ? n.clientWidth : 0), l2 = _(r3.scrollHeight, r3.clientHeight, n ? n.scrollHeight : 0, n ? n.clientHeight : 0), s2 = -i2.scrollLeft + Me(e), a2 = -i2.scrollTop;
1585
+ return I(n || r3).direction === "rtl" && (s2 += _(r3.clientWidth, n ? n.clientWidth : 0) - o2), {
1586
+ width: o2,
1587
+ height: l2,
1588
+ x: s2,
1589
+ y: a2
1590
+ };
1591
+ }
1592
+ function We(e) {
1593
+ var t = I(e), r3 = t.overflow, i2 = t.overflowX, n = t.overflowY;
1594
+ return /auto|scroll|overlay|hidden/.test(r3 + n + i2);
1595
+ }
1596
+ function yt(e) {
1597
+ return ["html", "body", "#document"].indexOf(N(e)) >= 0 ? e.ownerDocument.body : T2(e) && We(e) ? e : yt(we(e));
1598
+ }
1599
+ function ae(e, t) {
1600
+ var r3;
1601
+ t === void 0 && (t = []);
1602
+ var i2 = yt(e), n = i2 === ((r3 = e.ownerDocument) == null ? void 0 : r3.body), o2 = B2(i2), l2 = n ? [o2].concat(o2.visualViewport || [], We(i2) ? i2 : []) : i2, s2 = t.concat(l2);
1603
+ return n ? s2 : (
1604
+ // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1605
+ s2.concat(ae(we(l2)))
1606
+ );
1607
+ }
1608
+ function $e(e) {
1609
+ return Object.assign({}, e, {
1610
+ left: e.x,
1611
+ top: e.y,
1612
+ right: e.x + e.width,
1613
+ bottom: e.y + e.height
1614
+ });
1615
+ }
1616
+ function dr(e, t) {
1617
+ var r3 = ee(e, false, t === "fixed");
1618
+ return r3.top = r3.top + e.clientTop, r3.left = r3.left + e.clientLeft, r3.bottom = r3.top + e.clientHeight, r3.right = r3.left + e.clientWidth, r3.width = e.clientWidth, r3.height = e.clientHeight, r3.x = r3.left, r3.y = r3.top, r3;
1619
+ }
1620
+ function et(e, t, r3) {
1621
+ return t === ut ? $e(ur(e, r3)) : K(t) ? dr(t, r3) : $e(pr(F(e)));
1622
+ }
1623
+ function vr(e) {
1624
+ var t = ae(we(e)), r3 = ["absolute", "fixed"].indexOf(I(e).position) >= 0, i2 = r3 && T2(e) ? fe(e) : e;
1625
+ return K(i2) ? t.filter(function(n) {
1626
+ return K(n) && vt(n, i2) && N(n) !== "body";
1627
+ }) : [];
1628
+ }
1629
+ function hr(e, t, r3, i2) {
1630
+ var n = t === "clippingParents" ? vr(e) : [].concat(t), o2 = [].concat(n, [r3]), l2 = o2[0], s2 = o2.reduce(function(a2, f2) {
1631
+ var c2 = et(e, f2, i2);
1632
+ return a2.top = _(c2.top, a2.top), a2.right = ye(c2.right, a2.right), a2.bottom = ye(c2.bottom, a2.bottom), a2.left = _(c2.left, a2.left), a2;
1633
+ }, et(e, l2, i2));
1634
+ return s2.width = s2.right - s2.left, s2.height = s2.bottom - s2.top, s2.x = s2.left, s2.y = s2.top, s2;
1635
+ }
1636
+ function wt(e) {
1637
+ var t = e.reference, r3 = e.element, i2 = e.placement, n = i2 ? H(i2) : null, o2 = i2 ? te(i2) : null, l2 = t.x + t.width / 2 - r3.width / 2, s2 = t.y + t.height / 2 - r3.height / 2, a2;
1638
+ switch (n) {
1639
+ case k:
1640
+ a2 = {
1641
+ x: l2,
1642
+ y: t.y - r3.height
1643
+ };
1644
+ break;
1645
+ case S:
1646
+ a2 = {
1647
+ x: l2,
1648
+ y: t.y + t.height
1649
+ };
1650
+ break;
1651
+ case M3:
1652
+ a2 = {
1653
+ x: t.x + t.width,
1654
+ y: s2
1655
+ };
1656
+ break;
1657
+ case D:
1658
+ a2 = {
1659
+ x: t.x - r3.width,
1660
+ y: s2
1661
+ };
1662
+ break;
1663
+ default:
1664
+ a2 = {
1665
+ x: t.x,
1666
+ y: t.y
1667
+ };
1668
+ }
1669
+ var f2 = n ? Te(n) : null;
1670
+ if (f2 != null) {
1671
+ var c2 = f2 === "y" ? "height" : "width";
1672
+ switch (o2) {
1673
+ case Q:
1674
+ a2[f2] = a2[f2] - (t[c2] / 2 - r3[c2] / 2);
1675
+ break;
1676
+ case se:
1677
+ a2[f2] = a2[f2] + (t[c2] / 2 - r3[c2] / 2);
1678
+ break;
1679
+ }
1680
+ }
1681
+ return a2;
1682
+ }
1683
+ function ce(e, t) {
1684
+ t === void 0 && (t = {});
1685
+ var r3 = t, i2 = r3.placement, n = i2 === void 0 ? e.placement : i2, o2 = r3.strategy, l2 = o2 === void 0 ? e.strategy : o2, s2 = r3.boundary, a2 = s2 === void 0 ? Mt : s2, f2 = r3.rootBoundary, c2 = f2 === void 0 ? ut : f2, h2 = r3.elementContext, y2 = h2 === void 0 ? ne : h2, u2 = r3.altBoundary, b2 = u2 === void 0 ? false : u2, v2 = r3.padding, d2 = v2 === void 0 ? 0 : v2, w2 = gt(typeof d2 != "number" ? d2 : mt(d2, le)), O2 = y2 === ne ? Wt : ne, E2 = e.rects.popper, p2 = e.elements[b2 ? O2 : y2], g2 = hr(K(p2) ? p2 : p2.contextElement || F(e.elements.popper), a2, c2, l2), m2 = ee(e.elements.reference), x3 = wt({
1686
+ reference: m2,
1687
+ element: E2,
1688
+ strategy: "absolute",
1689
+ placement: n
1690
+ }), L2 = $e(Object.assign({}, E2, x3)), P3 = y2 === ne ? L2 : m2, A2 = {
1691
+ top: g2.top - P3.top + w2.top,
1692
+ bottom: P3.bottom - g2.bottom + w2.bottom,
1693
+ left: g2.left - P3.left + w2.left,
1694
+ right: P3.right - g2.right + w2.right
1695
+ }, $3 = e.modifiersData.offset;
1696
+ if (y2 === ne && $3) {
1697
+ var W2 = $3[n];
1698
+ Object.keys(A2).forEach(function(C2) {
1699
+ var q2 = [M3, S].indexOf(C2) >= 0 ? 1 : -1, X2 = [k, S].indexOf(C2) >= 0 ? "y" : "x";
1700
+ A2[C2] += W2[X2] * q2;
1701
+ });
1702
+ }
1703
+ return A2;
1704
+ }
1705
+ function gr(e, t) {
1706
+ t === void 0 && (t = {});
1707
+ var r3 = t, i2 = r3.placement, n = r3.boundary, o2 = r3.rootBoundary, l2 = r3.padding, s2 = r3.flipVariations, a2 = r3.allowedAutoPlacements, f2 = a2 === void 0 ? pt : a2, c2 = te(i2), h2 = c2 ? s2 ? Ge : Ge.filter(function(b2) {
1708
+ return te(b2) === c2;
1709
+ }) : le, y2 = h2.filter(function(b2) {
1710
+ return f2.indexOf(b2) >= 0;
1711
+ });
1712
+ y2.length === 0 && (y2 = h2);
1713
+ var u2 = y2.reduce(function(b2, v2) {
1714
+ return b2[v2] = ce(e, {
1715
+ placement: v2,
1716
+ boundary: n,
1717
+ rootBoundary: o2,
1718
+ padding: l2
1719
+ })[H(v2)], b2;
1720
+ }, {});
1721
+ return Object.keys(u2).sort(function(b2, v2) {
1722
+ return u2[b2] - u2[v2];
1723
+ });
1724
+ }
1725
+ function mr(e) {
1726
+ if (H(e) === De)
1727
+ return [];
1728
+ var t = me(e);
1729
+ return [Ze(e), t, Ze(t)];
1730
+ }
1731
+ function yr(e) {
1732
+ var t = e.state, r3 = e.options, i2 = e.name;
1733
+ if (!t.modifiersData[i2]._skip) {
1734
+ for (var n = r3.mainAxis, o2 = n === void 0 ? true : n, l2 = r3.altAxis, s2 = l2 === void 0 ? true : l2, a2 = r3.fallbackPlacements, f2 = r3.padding, c2 = r3.boundary, h2 = r3.rootBoundary, y2 = r3.altBoundary, u2 = r3.flipVariations, b2 = u2 === void 0 ? true : u2, v2 = r3.allowedAutoPlacements, d2 = t.options.placement, w2 = H(d2), O2 = w2 === d2, E2 = a2 || (O2 || !b2 ? [me(d2)] : mr(d2)), p2 = [d2].concat(E2).reduce(function(G2, V2) {
1735
+ return G2.concat(H(V2) === De ? gr(t, {
1736
+ placement: V2,
1737
+ boundary: c2,
1738
+ rootBoundary: h2,
1739
+ padding: f2,
1740
+ flipVariations: b2,
1741
+ allowedAutoPlacements: v2
1742
+ }) : V2);
1743
+ }, []), g2 = t.rects.reference, m2 = t.rects.popper, x3 = /* @__PURE__ */ new Map(), L2 = true, P3 = p2[0], A2 = 0; A2 < p2.length; A2++) {
1744
+ var $3 = p2[A2], W2 = H($3), C2 = te($3) === Q, q2 = [k, S].indexOf(W2) >= 0, X2 = q2 ? "width" : "height", R2 = ce(t, {
1745
+ placement: $3,
1746
+ boundary: c2,
1747
+ rootBoundary: h2,
1748
+ altBoundary: y2,
1749
+ padding: f2
1750
+ }), j2 = q2 ? C2 ? M3 : D : C2 ? S : k;
1751
+ g2[X2] > m2[X2] && (j2 = me(j2));
1752
+ var ue = me(j2), Y2 = [];
1753
+ if (o2 && Y2.push(R2[W2] <= 0), s2 && Y2.push(R2[j2] <= 0, R2[ue] <= 0), Y2.every(function(G2) {
1754
+ return G2;
1755
+ })) {
1756
+ P3 = $3, L2 = false;
1757
+ break;
1758
+ }
1759
+ x3.set($3, Y2);
1760
+ }
1761
+ if (L2)
1762
+ for (var pe = b2 ? 3 : 1, be = function(V2) {
1763
+ var ie = p2.find(function(ve) {
1764
+ var z2 = x3.get(ve);
1765
+ if (z2)
1766
+ return z2.slice(0, V2).every(function(xe) {
1767
+ return xe;
1768
+ });
1769
+ });
1770
+ if (ie)
1771
+ return P3 = ie, "break";
1772
+ }, re = pe; re > 0; re--) {
1773
+ var de = be(re);
1774
+ if (de === "break")
1775
+ break;
1776
+ }
1777
+ t.placement !== P3 && (t.modifiersData[i2]._skip = true, t.placement = P3, t.reset = true);
1778
+ }
1779
+ }
1780
+ const wr = {
1781
+ name: "flip",
1782
+ enabled: true,
1783
+ phase: "main",
1784
+ fn: yr,
1785
+ requiresIfExists: ["offset"],
1786
+ data: {
1787
+ _skip: false
1788
+ }
1789
+ };
1790
+ function tt(e, t, r3) {
1791
+ return r3 === void 0 && (r3 = {
1792
+ x: 0,
1793
+ y: 0
1794
+ }), {
1795
+ top: e.top - t.height - r3.y,
1796
+ right: e.right - t.width + r3.x,
1797
+ bottom: e.bottom - t.height + r3.y,
1798
+ left: e.left - t.width - r3.x
1799
+ };
1800
+ }
1801
+ function rt(e) {
1802
+ return [k, M3, S, D].some(function(t) {
1803
+ return e[t] >= 0;
1804
+ });
1805
+ }
1806
+ function br(e) {
1807
+ var t = e.state, r3 = e.name, i2 = t.rects.reference, n = t.rects.popper, o2 = t.modifiersData.preventOverflow, l2 = ce(t, {
1808
+ elementContext: "reference"
1809
+ }), s2 = ce(t, {
1810
+ altBoundary: true
1811
+ }), a2 = tt(l2, i2), f2 = tt(s2, n, o2), c2 = rt(a2), h2 = rt(f2);
1812
+ t.modifiersData[r3] = {
1813
+ referenceClippingOffsets: a2,
1814
+ popperEscapeOffsets: f2,
1815
+ isReferenceHidden: c2,
1816
+ hasPopperEscaped: h2
1817
+ }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
1818
+ "data-popper-reference-hidden": c2,
1819
+ "data-popper-escaped": h2
1820
+ });
1821
+ }
1822
+ const xr = {
1823
+ name: "hide",
1824
+ enabled: true,
1825
+ phase: "main",
1826
+ requiresIfExists: ["preventOverflow"],
1827
+ fn: br
1828
+ };
1829
+ function Or(e, t, r3) {
1830
+ var i2 = H(e), n = [D, k].indexOf(i2) >= 0 ? -1 : 1, o2 = typeof r3 == "function" ? r3(Object.assign({}, t, {
1831
+ placement: e
1832
+ })) : r3, l2 = o2[0], s2 = o2[1];
1833
+ return l2 = l2 || 0, s2 = (s2 || 0) * n, [D, M3].indexOf(i2) >= 0 ? {
1834
+ x: s2,
1835
+ y: l2
1836
+ } : {
1837
+ x: l2,
1838
+ y: s2
1839
+ };
1840
+ }
1841
+ function Er(e) {
1842
+ var t = e.state, r3 = e.options, i2 = e.name, n = r3.offset, o2 = n === void 0 ? [0, 0] : n, l2 = pt.reduce(function(c2, h2) {
1843
+ return c2[h2] = Or(h2, t.rects, o2), c2;
1844
+ }, {}), s2 = l2[t.placement], a2 = s2.x, f2 = s2.y;
1845
+ t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += a2, t.modifiersData.popperOffsets.y += f2), t.modifiersData[i2] = l2;
1846
+ }
1847
+ const Ar = {
1848
+ name: "offset",
1849
+ enabled: true,
1850
+ phase: "main",
1851
+ requires: ["popperOffsets"],
1852
+ fn: Er
1853
+ };
1854
+ function Pr(e) {
1855
+ var t = e.state, r3 = e.name;
1856
+ t.modifiersData[r3] = wt({
1857
+ reference: t.rects.reference,
1858
+ element: t.rects.popper,
1859
+ strategy: "absolute",
1860
+ placement: t.placement
1861
+ });
1862
+ }
1863
+ const Lr = {
1864
+ name: "popperOffsets",
1865
+ enabled: true,
1866
+ phase: "read",
1867
+ fn: Pr,
1868
+ data: {}
1869
+ };
1870
+ function $r(e) {
1871
+ return e === "x" ? "y" : "x";
1872
+ }
1873
+ function Cr(e) {
1874
+ var t = e.state, r3 = e.options, i2 = e.name, n = r3.mainAxis, o2 = n === void 0 ? true : n, l2 = r3.altAxis, s2 = l2 === void 0 ? false : l2, a2 = r3.boundary, f2 = r3.rootBoundary, c2 = r3.altBoundary, h2 = r3.padding, y2 = r3.tether, u2 = y2 === void 0 ? true : y2, b2 = r3.tetherOffset, v2 = b2 === void 0 ? 0 : b2, d2 = ce(t, {
1875
+ boundary: a2,
1876
+ rootBoundary: f2,
1877
+ padding: h2,
1878
+ altBoundary: c2
1879
+ }), w2 = H(t.placement), O2 = te(t.placement), E2 = !O2, p2 = Te(w2), g2 = $r(p2), m2 = t.modifiersData.popperOffsets, x3 = t.rects.reference, L2 = t.rects.popper, P3 = typeof v2 == "function" ? v2(Object.assign({}, t.rects, {
1880
+ placement: t.placement
1881
+ })) : v2, A2 = typeof P3 == "number" ? {
1882
+ mainAxis: P3,
1883
+ altAxis: P3
1884
+ } : Object.assign({
1885
+ mainAxis: 0,
1886
+ altAxis: 0
1887
+ }, P3), $3 = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, W2 = {
1888
+ x: 0,
1889
+ y: 0
1890
+ };
1891
+ if (m2) {
1892
+ if (o2) {
1893
+ var C2, q2 = p2 === "y" ? k : D, X2 = p2 === "y" ? S : M3, R2 = p2 === "y" ? "height" : "width", j2 = m2[p2], ue = j2 + d2[q2], Y2 = j2 - d2[X2], pe = u2 ? -L2[R2] / 2 : 0, be = O2 === Q ? x3[R2] : L2[R2], re = O2 === Q ? -L2[R2] : -x3[R2], de = t.elements.arrow, G2 = u2 && de ? Be(de) : {
1894
+ width: 0,
1895
+ height: 0
1896
+ }, V2 = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : ht(), ie = V2[q2], ve = V2[X2], z2 = oe(0, x3[R2], G2[R2]), xe = E2 ? x3[R2] / 2 - pe - z2 - ie - A2.mainAxis : be - z2 - ie - A2.mainAxis, Ot = E2 ? -x3[R2] / 2 + pe + z2 + ve + A2.mainAxis : re + z2 + ve + A2.mainAxis, Oe = t.elements.arrow && fe(t.elements.arrow), Et = Oe ? p2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, He = (C2 = $3 == null ? void 0 : $3[p2]) != null ? C2 : 0, At = j2 + xe - He - Et, Pt = j2 + Ot - He, Ne = oe(u2 ? ye(ue, At) : ue, j2, u2 ? _(Y2, Pt) : Y2);
1897
+ m2[p2] = Ne, W2[p2] = Ne - j2;
1898
+ }
1899
+ if (s2) {
1900
+ var Ie, Lt = p2 === "x" ? k : D, $t = p2 === "x" ? S : M3, U2 = m2[g2], he = g2 === "y" ? "height" : "width", Ve = U2 + d2[Lt], Fe = U2 - d2[$t], Ee = [k, D].indexOf(w2) !== -1, qe = (Ie = $3 == null ? void 0 : $3[g2]) != null ? Ie : 0, Xe = Ee ? Ve : U2 - x3[he] - L2[he] - qe + A2.altAxis, Ye = Ee ? U2 + x3[he] + L2[he] - qe - A2.altAxis : Fe, ze = u2 && Ee ? Qt(Xe, U2, Ye) : oe(u2 ? Xe : Ve, U2, u2 ? Ye : Fe);
1901
+ m2[g2] = ze, W2[g2] = ze - U2;
1902
+ }
1903
+ t.modifiersData[i2] = W2;
1904
+ }
1905
+ }
1906
+ const kr = {
1907
+ name: "preventOverflow",
1908
+ enabled: true,
1909
+ phase: "main",
1910
+ fn: Cr,
1911
+ requiresIfExists: ["offset"]
1912
+ };
1913
+ function Dr(e) {
1914
+ return {
1915
+ scrollLeft: e.scrollLeft,
1916
+ scrollTop: e.scrollTop
1917
+ };
1918
+ }
1919
+ function Rr(e) {
1920
+ return e === B2(e) || !T2(e) ? Se(e) : Dr(e);
1921
+ }
1922
+ function Br(e) {
1923
+ var t = e.getBoundingClientRect(), r3 = Z(t.width) / e.offsetWidth || 1, i2 = Z(t.height) / e.offsetHeight || 1;
1924
+ return r3 !== 1 || i2 !== 1;
1925
+ }
1926
+ function Tr(e, t, r3) {
1927
+ r3 === void 0 && (r3 = false);
1928
+ var i2 = T2(t), n = T2(t) && Br(t), o2 = F(t), l2 = ee(e, n, r3), s2 = {
1929
+ scrollLeft: 0,
1930
+ scrollTop: 0
1931
+ }, a2 = {
1932
+ x: 0,
1933
+ y: 0
1934
+ };
1935
+ return (i2 || !i2 && !r3) && ((N(t) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
1936
+ We(o2)) && (s2 = Rr(t)), T2(t) ? (a2 = ee(t, true), a2.x += t.clientLeft, a2.y += t.clientTop) : o2 && (a2.x = Me(o2))), {
1937
+ x: l2.left + s2.scrollLeft - a2.x,
1938
+ y: l2.top + s2.scrollTop - a2.y,
1939
+ width: l2.width,
1940
+ height: l2.height
1941
+ };
1942
+ }
1943
+ function Sr(e) {
1944
+ var t = /* @__PURE__ */ new Map(), r3 = /* @__PURE__ */ new Set(), i2 = [];
1945
+ e.forEach(function(o2) {
1946
+ t.set(o2.name, o2);
1947
+ });
1948
+ function n(o2) {
1949
+ r3.add(o2.name);
1950
+ var l2 = [].concat(o2.requires || [], o2.requiresIfExists || []);
1951
+ l2.forEach(function(s2) {
1952
+ if (!r3.has(s2)) {
1953
+ var a2 = t.get(s2);
1954
+ a2 && n(a2);
1955
+ }
1956
+ }), i2.push(o2);
1957
+ }
1958
+ return e.forEach(function(o2) {
1959
+ r3.has(o2.name) || n(o2);
1960
+ }), i2;
1961
+ }
1962
+ function Mr(e) {
1963
+ var t = Sr(e);
1964
+ return zt.reduce(function(r3, i2) {
1965
+ return r3.concat(t.filter(function(n) {
1966
+ return n.phase === i2;
1967
+ }));
1968
+ }, []);
1969
+ }
1970
+ function Wr(e) {
1971
+ var t;
1972
+ return function() {
1973
+ return t || (t = new Promise(function(r3) {
1974
+ Promise.resolve().then(function() {
1975
+ t = void 0, r3(e());
1976
+ });
1977
+ })), t;
1978
+ };
1979
+ }
1980
+ function jr(e) {
1981
+ var t = e.reduce(function(r3, i2) {
1982
+ var n = r3[i2.name];
1983
+ return r3[i2.name] = n ? Object.assign({}, n, i2, {
1984
+ options: Object.assign({}, n.options, i2.options),
1985
+ data: Object.assign({}, n.data, i2.data)
1986
+ }) : i2, r3;
1987
+ }, {});
1988
+ return Object.keys(t).map(function(r3) {
1989
+ return t[r3];
1990
+ });
1991
+ }
1992
+ var it2 = {
1993
+ placement: "bottom",
1994
+ modifiers: [],
1995
+ strategy: "absolute"
1996
+ };
1997
+ function nt() {
1998
+ for (var e = arguments.length, t = new Array(e), r3 = 0; r3 < e; r3++)
1999
+ t[r3] = arguments[r3];
2000
+ return !t.some(function(i2) {
2001
+ return !(i2 && typeof i2.getBoundingClientRect == "function");
2002
+ });
2003
+ }
2004
+ function Hr(e) {
2005
+ e === void 0 && (e = {});
2006
+ var t = e, r3 = t.defaultModifiers, i2 = r3 === void 0 ? [] : r3, n = t.defaultOptions, o2 = n === void 0 ? it2 : n;
2007
+ return function(s2, a2, f2) {
2008
+ f2 === void 0 && (f2 = o2);
2009
+ var c2 = {
2010
+ placement: "bottom",
2011
+ orderedModifiers: [],
2012
+ options: Object.assign({}, it2, o2),
2013
+ modifiersData: {},
2014
+ elements: {
2015
+ reference: s2,
2016
+ popper: a2
2017
+ },
2018
+ attributes: {},
2019
+ styles: {}
2020
+ }, h2 = [], y2 = false, u2 = {
2021
+ state: c2,
2022
+ setOptions: function(w2) {
2023
+ var O2 = typeof w2 == "function" ? w2(c2.options) : w2;
2024
+ v2(), c2.options = Object.assign({}, o2, c2.options, O2), c2.scrollParents = {
2025
+ reference: K(s2) ? ae(s2) : s2.contextElement ? ae(s2.contextElement) : [],
2026
+ popper: ae(a2)
2027
+ };
2028
+ var E2 = Mr(jr([].concat(i2, c2.options.modifiers)));
2029
+ return c2.orderedModifiers = E2.filter(function(p2) {
2030
+ return p2.enabled;
2031
+ }), b2(), u2.update();
2032
+ },
2033
+ // Sync update – it will always be executed, even if not necessary. This
2034
+ // is useful for low frequency updates where sync behavior simplifies the
2035
+ // logic.
2036
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
2037
+ // prefer the async Popper#update method
2038
+ forceUpdate: function() {
2039
+ if (!y2) {
2040
+ var w2 = c2.elements, O2 = w2.reference, E2 = w2.popper;
2041
+ if (nt(O2, E2)) {
2042
+ c2.rects = {
2043
+ reference: Tr(O2, fe(E2), c2.options.strategy === "fixed"),
2044
+ popper: Be(E2)
2045
+ }, c2.reset = false, c2.placement = c2.options.placement, c2.orderedModifiers.forEach(function(A2) {
2046
+ return c2.modifiersData[A2.name] = Object.assign({}, A2.data);
2047
+ });
2048
+ for (var p2 = 0; p2 < c2.orderedModifiers.length; p2++) {
2049
+ if (c2.reset === true) {
2050
+ c2.reset = false, p2 = -1;
2051
+ continue;
2052
+ }
2053
+ var g2 = c2.orderedModifiers[p2], m2 = g2.fn, x3 = g2.options, L2 = x3 === void 0 ? {} : x3, P3 = g2.name;
2054
+ typeof m2 == "function" && (c2 = m2({
2055
+ state: c2,
2056
+ options: L2,
2057
+ name: P3,
2058
+ instance: u2
2059
+ }) || c2);
2060
+ }
2061
+ }
2062
+ }
2063
+ },
2064
+ // Async and optimistically optimized update – it will not be executed if
2065
+ // not necessary (debounced to run at most once-per-tick)
2066
+ update: Wr(function() {
2067
+ return new Promise(function(d2) {
2068
+ u2.forceUpdate(), d2(c2);
2069
+ });
2070
+ }),
2071
+ destroy: function() {
2072
+ v2(), y2 = true;
2073
+ }
2074
+ };
2075
+ if (!nt(s2, a2))
2076
+ return u2;
2077
+ u2.setOptions(f2).then(function(d2) {
2078
+ !y2 && f2.onFirstUpdate && f2.onFirstUpdate(d2);
2079
+ });
2080
+ function b2() {
2081
+ c2.orderedModifiers.forEach(function(d2) {
2082
+ var w2 = d2.name, O2 = d2.options, E2 = O2 === void 0 ? {} : O2, p2 = d2.effect;
2083
+ if (typeof p2 == "function") {
2084
+ var g2 = p2({
2085
+ state: c2,
2086
+ name: w2,
2087
+ instance: u2,
2088
+ options: E2
2089
+ }), m2 = function() {
2090
+ };
2091
+ h2.push(g2 || m2);
2092
+ }
2093
+ });
2094
+ }
2095
+ function v2() {
2096
+ h2.forEach(function(d2) {
2097
+ return d2();
2098
+ }), h2 = [];
2099
+ }
2100
+ return u2;
2101
+ };
2102
+ }
2103
+ var Nr = [cr, Lr, ar, Kt, Ar, wr, kr, rr, xr], Ir = /* @__PURE__ */ Hr({
2104
+ defaultModifiers: Nr
2105
+ });
2106
+ async function Ce(e) {
2107
+ if (!e)
2108
+ return this.collection;
2109
+ const t = this.collection.findIndex((r3) => r3.id === e.id);
2110
+ if (t >= 0) {
2111
+ const r3 = this.collection[t];
2112
+ r3.state === "opened" && r3.close(), r3.popper.destroy(), bt(r3), Object.getOwnPropertyNames(r3).forEach((i2) => {
2113
+ delete r3[i2];
2114
+ }), this.collection.splice(t, 1);
2115
+ }
2116
+ return this.collection;
2117
+ }
2118
+ function bt(e) {
2119
+ return e.__eventListeners && (e.__eventListeners.forEach((t) => {
2120
+ t.el.forEach((r3) => {
2121
+ t.type.forEach((i2) => {
2122
+ e[r3].removeEventListener(i2, t.listener, false);
2123
+ });
2124
+ });
2125
+ }), delete e.__eventListeners), e;
2126
+ }
2127
+ async function je(e) {
2128
+ const t = at.call(this, e);
2129
+ return t.el.classList.add(this.settings.stateActive), t.trigger.hasAttribute("aria-controls") && t.trigger.setAttribute("aria-expanded", "true"), t.config = ot(t.el, this.settings), t.popper.setOptions({
2130
+ placement: t.config.placement,
2131
+ modifiers: [
2132
+ { name: "eventListeners", enabled: true },
2133
+ ...Rt(t.config)
2134
+ ]
2135
+ }), t.popper.update(), t.state = "opened", t;
2136
+ }
2137
+ async function Vr(e, t) {
2138
+ Ce.call(this, e);
2139
+ const r3 = this, i2 = {
2140
+ open() {
2141
+ return je.call(r3, this);
2142
+ },
2143
+ close() {
2144
+ return ke.call(r3, this);
2145
+ },
2146
+ deregister() {
2147
+ return Ce.call(r3, this);
2148
+ }
2149
+ }, n = {
2150
+ id: e.id,
2151
+ state: "closed",
2152
+ el: e,
2153
+ trigger: t,
2154
+ popper: Ir(t, e),
2155
+ config: ot(e, this.settings),
2156
+ ...i2
2157
+ };
2158
+ return n.trigger.hasAttribute("aria-controls") && n.trigger.setAttribute("aria-expanded", "false"), xt.call(this, n), this.collection.push(n), n.el.classList.contains(this.settings.stateActive) && (await n.open(), ft.call(this, n)), n;
2159
+ }
2160
+ function xt(e) {
2161
+ return e.__eventListeners || (e.config.event === "hover" ? (e.__eventListeners = [{
2162
+ el: ["trigger"],
2163
+ type: ["mouseenter", "focus"],
2164
+ listener: je.bind(this, e)
2165
+ }, {
2166
+ el: ["el", "trigger"],
2167
+ type: ["mouseleave", "focusout"],
2168
+ listener: lt.bind(this, e)
2169
+ }], e.__eventListeners.forEach((r3) => {
2170
+ r3.el.forEach((i2) => {
2171
+ r3.type.forEach((n) => {
2172
+ e[i2].addEventListener(n, r3.listener, false);
2173
+ });
2174
+ });
2175
+ })) : (e.__eventListeners = [{
2176
+ el: ["trigger"],
2177
+ type: ["click"],
2178
+ listener: Tt.bind(this, e)
2179
+ }], e.__eventListeners.forEach((r3) => {
2180
+ r3.el.forEach((i2) => {
2181
+ r3.type.forEach((n) => {
2182
+ e[i2].addEventListener(n, r3.listener, false);
2183
+ });
2184
+ });
2185
+ }))), e;
2186
+ }
2187
+ var J;
2188
+ class qr extends Ct {
2189
+ constructor(r3) {
2190
+ super();
2191
+ _e(this, J, void 0);
2192
+ this.defaults = Dt, this.settings = { ...this.defaults, ...r3 }, this.trigger = null, Ke(this, J, St.bind(this)), this.settings.autoInit && this.init();
2193
+ }
2194
+ async init(r3) {
2195
+ r3 && (this.settings = { ...this.settings, ...r3 });
2196
+ const i2 = document.querySelectorAll(this.settings.selectorPopover);
2197
+ return await this.registerCollection(i2), this.settings.eventListeners && this.initEventListeners(false), this;
2198
+ }
2199
+ async destroy() {
2200
+ return this.trigger = null, await this.deregisterCollection(), this.settings.eventListeners && this.destroyEventListeners(false), this;
2201
+ }
2202
+ initEventListeners(r3 = true) {
2203
+ r3 && this.collection.forEach((i2) => {
2204
+ xt.call(this, i2);
2205
+ }), document.addEventListener("keydown", Ae(this, J), false);
2206
+ }
2207
+ destroyEventListeners(r3 = true) {
2208
+ r3 && this.collection.forEach((i2) => {
2209
+ bt(i2);
2210
+ }), document.removeEventListener("keydown", Ae(this, J), false);
2211
+ }
2212
+ register(r3) {
2213
+ const i2 = Bt.call(this, r3);
2214
+ return i2.error ? Promise.reject(i2.error) : Vr.call(this, i2.popover, i2.trigger);
2215
+ }
2216
+ deregister(r3) {
2217
+ const i2 = this.get(st.call(this, r3));
2218
+ return Ce.call(this, i2);
2219
+ }
2220
+ open(r3) {
2221
+ return je.call(this, r3);
2222
+ }
2223
+ close(r3) {
2224
+ return ke.call(this, r3);
2225
+ }
2226
+ }
2227
+ J = /* @__PURE__ */ new WeakMap();
2228
+ export {
2229
+ r$1 as Checkbox,
2230
+ it$1 as Drawer,
2231
+ U as Modal,
2232
+ qr as Popover,
2233
+ index as core
2234
+ };
2235
+ //# sourceMappingURL=index.js.map