vrembem 4.0.0-next.24 → 4.0.0-next.26

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