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