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