tgui-core 1.8.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/constants.d.ts +4 -0
- package/dist/common/constants.js +17 -0
- package/dist/common/hotkeys.js +48 -48
- package/dist/common/ui.d.ts +6 -0
- package/dist/common/ui.js +63 -59
- package/dist/components/AnimatedNumber.d.ts +1 -1
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/Button.js +21 -22
- package/dist/components/Chart.d.ts +3 -15
- package/dist/components/Chart.js +68 -86
- package/dist/components/ColorBox.js +3 -3
- package/dist/components/Dialog.d.ts +16 -0
- package/dist/components/Dialog.js +5 -5
- package/dist/components/DmIcon.d.ts +1 -1
- package/dist/components/DraggableControl.d.ts +56 -0
- package/dist/components/DraggableControl.js +126 -176
- package/dist/components/Dropdown.d.ts +8 -6
- package/dist/components/Dropdown.js +137 -129
- package/dist/components/FitText.d.ts +1 -1
- package/dist/components/Floating.d.ts +75 -0
- package/dist/components/Floating.js +2235 -0
- package/dist/components/ImageButton.d.ts +2 -3
- package/dist/components/ImageButton.js +88 -98
- package/dist/components/InfinitePlane.d.ts +35 -32
- package/dist/components/InfinitePlane.js +123 -133
- package/dist/components/Knob.d.ts +22 -6
- package/dist/components/Knob.js +45 -46
- package/dist/components/MenuBar.js +81 -97
- package/dist/components/Modal.js +12 -12
- package/dist/components/NumberInput.d.ts +1 -1
- package/dist/components/Popper.d.ts +5 -1
- package/dist/components/Popper.js +1026 -121
- package/dist/components/ProgressBar.js +3 -3
- package/dist/components/RoundGauge.js +30 -30
- package/dist/components/Section.js +7 -7
- package/dist/components/Slider.d.ts +22 -6
- package/dist/components/Slider.js +55 -56
- package/dist/components/Stack.js +3 -3
- package/dist/components/Table.js +7 -7
- package/dist/components/Tabs.js +7 -7
- package/dist/components/TextArea.d.ts +17 -0
- package/dist/components/TextArea.js +35 -33
- package/dist/components/Tooltip.d.ts +3 -34
- package/dist/components/Tooltip.js +14 -77
- package/dist/components/TrackOutsideClicks.d.ts +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +64 -62
- package/package.json +26 -27
- package/styles/base.scss +13 -11
- package/styles/colors.scss +63 -67
- package/styles/components/BlockQuote.scss +5 -8
- package/styles/components/Button.scss +123 -99
- package/styles/components/Dialog.scss +23 -30
- package/styles/components/Dimmer.scss +3 -8
- package/styles/components/Divider.scss +6 -7
- package/styles/components/Dropdown.scss +103 -51
- package/styles/components/Flex.scss +0 -1
- package/styles/components/Floating.scss +60 -0
- package/styles/components/ImageButton.scss +136 -192
- package/styles/components/Input.scss +24 -26
- package/styles/components/Knob.scss +37 -41
- package/styles/components/LabeledList.scss +8 -6
- package/styles/components/MenuBar.scss +17 -21
- package/styles/components/Modal.scss +8 -7
- package/styles/components/NoticeBox.scss +22 -26
- package/styles/components/NumberInput.scss +30 -28
- package/styles/components/ProgressBar.scss +27 -19
- package/styles/components/RoundGauge.scss +46 -26
- package/styles/components/Section.scss +17 -32
- package/styles/components/Slider.scss +18 -15
- package/styles/components/Stack.scss +8 -48
- package/styles/components/Table.scss +2 -2
- package/styles/components/Tabs.scss +92 -66
- package/styles/components/TextArea.scss +32 -36
- package/styles/components/Tooltip.scss +10 -13
- package/styles/functions.scss +1 -62
- package/styles/main.scss +6 -1
- package/styles/reset.scss +7 -11
- package/styles/vars-colors.scss +108 -0
- package/styles/vars-components.scss +162 -0
- package/styles/vars-values.scss +110 -0
- package/dist/popper-CiqSDJTE.js +0 -906
|
@@ -0,0 +1,2235 @@
|
|
|
1
|
+
import { jsxs as mt, jsx as ne, Fragment as zt } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import { useLayoutEffect as gt, useEffect as pt, useRef as Xt, useState as Gt, isValidElement as Zt, cloneElement as Jt } from "react";
|
|
4
|
+
import * as ht from "react-dom";
|
|
5
|
+
import { classes as Qt } from "../common/react.js";
|
|
6
|
+
function Te() {
|
|
7
|
+
return typeof window < "u";
|
|
8
|
+
}
|
|
9
|
+
function ce(e) {
|
|
10
|
+
return vt(e) ? (e.nodeName || "").toLowerCase() : "#document";
|
|
11
|
+
}
|
|
12
|
+
function K(e) {
|
|
13
|
+
var t;
|
|
14
|
+
return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
|
|
15
|
+
}
|
|
16
|
+
function X(e) {
|
|
17
|
+
var t;
|
|
18
|
+
return (t = (vt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
|
|
19
|
+
}
|
|
20
|
+
function vt(e) {
|
|
21
|
+
return Te() ? e instanceof Node || e instanceof K(e).Node : !1;
|
|
22
|
+
}
|
|
23
|
+
function k(e) {
|
|
24
|
+
return Te() ? e instanceof Element || e instanceof K(e).Element : !1;
|
|
25
|
+
}
|
|
26
|
+
function _(e) {
|
|
27
|
+
return Te() ? e instanceof HTMLElement || e instanceof K(e).HTMLElement : !1;
|
|
28
|
+
}
|
|
29
|
+
function Ve(e) {
|
|
30
|
+
return !Te() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof K(e).ShadowRoot;
|
|
31
|
+
}
|
|
32
|
+
function ge(e) {
|
|
33
|
+
const {
|
|
34
|
+
overflow: t,
|
|
35
|
+
overflowX: n,
|
|
36
|
+
overflowY: r,
|
|
37
|
+
display: o
|
|
38
|
+
} = U(e);
|
|
39
|
+
return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o);
|
|
40
|
+
}
|
|
41
|
+
function en(e) {
|
|
42
|
+
return ["table", "td", "th"].includes(ce(e));
|
|
43
|
+
}
|
|
44
|
+
function Oe(e) {
|
|
45
|
+
return [":popover-open", ":modal"].some((t) => {
|
|
46
|
+
try {
|
|
47
|
+
return e.matches(t);
|
|
48
|
+
} catch {
|
|
49
|
+
return !1;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function Ue(e) {
|
|
54
|
+
const t = Pe(), n = k(e) ? U(e) : e;
|
|
55
|
+
return ["transform", "translate", "scale", "rotate", "perspective"].some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r));
|
|
56
|
+
}
|
|
57
|
+
function tn(e) {
|
|
58
|
+
let t = ee(e);
|
|
59
|
+
for (; _(t) && !Q(t); ) {
|
|
60
|
+
if (Ue(t))
|
|
61
|
+
return t;
|
|
62
|
+
if (Oe(t))
|
|
63
|
+
return null;
|
|
64
|
+
t = ee(t);
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function Pe() {
|
|
69
|
+
return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
|
|
70
|
+
}
|
|
71
|
+
function Q(e) {
|
|
72
|
+
return ["html", "body", "#document"].includes(ce(e));
|
|
73
|
+
}
|
|
74
|
+
function U(e) {
|
|
75
|
+
return K(e).getComputedStyle(e);
|
|
76
|
+
}
|
|
77
|
+
function Ae(e) {
|
|
78
|
+
return k(e) ? {
|
|
79
|
+
scrollLeft: e.scrollLeft,
|
|
80
|
+
scrollTop: e.scrollTop
|
|
81
|
+
} : {
|
|
82
|
+
scrollLeft: e.scrollX,
|
|
83
|
+
scrollTop: e.scrollY
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function ee(e) {
|
|
87
|
+
if (ce(e) === "html")
|
|
88
|
+
return e;
|
|
89
|
+
const t = (
|
|
90
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
91
|
+
e.assignedSlot || // DOM Element detected.
|
|
92
|
+
e.parentNode || // ShadowRoot detected.
|
|
93
|
+
Ve(e) && e.host || // Fallback.
|
|
94
|
+
X(e)
|
|
95
|
+
);
|
|
96
|
+
return Ve(t) ? t.host : t;
|
|
97
|
+
}
|
|
98
|
+
function bt(e) {
|
|
99
|
+
const t = ee(e);
|
|
100
|
+
return Q(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : _(t) && ge(t) ? t : bt(t);
|
|
101
|
+
}
|
|
102
|
+
function te(e, t, n) {
|
|
103
|
+
var r;
|
|
104
|
+
t === void 0 && (t = []), n === void 0 && (n = !0);
|
|
105
|
+
const o = bt(e), s = o === ((r = e.ownerDocument) == null ? void 0 : r.body), i = K(o);
|
|
106
|
+
if (s) {
|
|
107
|
+
const c = _e(i);
|
|
108
|
+
return t.concat(i, i.visualViewport || [], ge(o) ? o : [], c && n ? te(c) : []);
|
|
109
|
+
}
|
|
110
|
+
return t.concat(o, te(o, [], n));
|
|
111
|
+
}
|
|
112
|
+
function _e(e) {
|
|
113
|
+
return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
|
|
114
|
+
}
|
|
115
|
+
function nn(e) {
|
|
116
|
+
let t = e.activeElement;
|
|
117
|
+
for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
|
|
118
|
+
var n;
|
|
119
|
+
t = t.shadowRoot.activeElement;
|
|
120
|
+
}
|
|
121
|
+
return t;
|
|
122
|
+
}
|
|
123
|
+
function ye(e, t) {
|
|
124
|
+
if (!e || !t)
|
|
125
|
+
return !1;
|
|
126
|
+
const n = t.getRootNode == null ? void 0 : t.getRootNode();
|
|
127
|
+
if (e.contains(t))
|
|
128
|
+
return !0;
|
|
129
|
+
if (n && Ve(n)) {
|
|
130
|
+
let r = t;
|
|
131
|
+
for (; r; ) {
|
|
132
|
+
if (e === r)
|
|
133
|
+
return !0;
|
|
134
|
+
r = r.parentNode || r.host;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return !1;
|
|
138
|
+
}
|
|
139
|
+
function rn() {
|
|
140
|
+
return /apple/i.test(navigator.vendor);
|
|
141
|
+
}
|
|
142
|
+
function fe(e, t) {
|
|
143
|
+
const n = ["mouse", "pen"];
|
|
144
|
+
return t || n.push("", void 0), n.includes(e);
|
|
145
|
+
}
|
|
146
|
+
function on(e) {
|
|
147
|
+
return "nativeEvent" in e;
|
|
148
|
+
}
|
|
149
|
+
function sn(e) {
|
|
150
|
+
return e.matches("html,body");
|
|
151
|
+
}
|
|
152
|
+
function J(e) {
|
|
153
|
+
return (e == null ? void 0 : e.ownerDocument) || document;
|
|
154
|
+
}
|
|
155
|
+
function Le(e, t) {
|
|
156
|
+
if (t == null)
|
|
157
|
+
return !1;
|
|
158
|
+
if ("composedPath" in e)
|
|
159
|
+
return e.composedPath().includes(t);
|
|
160
|
+
const n = e;
|
|
161
|
+
return n.target != null && t.contains(n.target);
|
|
162
|
+
}
|
|
163
|
+
function ue(e) {
|
|
164
|
+
return "composedPath" in e ? e.composedPath()[0] : e.target;
|
|
165
|
+
}
|
|
166
|
+
const cn = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
167
|
+
function ln(e) {
|
|
168
|
+
return _(e) && e.matches(cn);
|
|
169
|
+
}
|
|
170
|
+
const de = Math.min, Y = Math.max, we = Math.round, ve = Math.floor, z = (e) => ({
|
|
171
|
+
x: e,
|
|
172
|
+
y: e
|
|
173
|
+
}), an = {
|
|
174
|
+
left: "right",
|
|
175
|
+
right: "left",
|
|
176
|
+
bottom: "top",
|
|
177
|
+
top: "bottom"
|
|
178
|
+
}, un = {
|
|
179
|
+
start: "end",
|
|
180
|
+
end: "start"
|
|
181
|
+
};
|
|
182
|
+
function Me(e, t) {
|
|
183
|
+
return typeof e == "function" ? e(t) : e;
|
|
184
|
+
}
|
|
185
|
+
function re(e) {
|
|
186
|
+
return e.split("-")[0];
|
|
187
|
+
}
|
|
188
|
+
function pe(e) {
|
|
189
|
+
return e.split("-")[1];
|
|
190
|
+
}
|
|
191
|
+
function fn(e) {
|
|
192
|
+
return e === "x" ? "y" : "x";
|
|
193
|
+
}
|
|
194
|
+
function yt(e) {
|
|
195
|
+
return e === "y" ? "height" : "width";
|
|
196
|
+
}
|
|
197
|
+
function se(e) {
|
|
198
|
+
return ["top", "bottom"].includes(re(e)) ? "y" : "x";
|
|
199
|
+
}
|
|
200
|
+
function wt(e) {
|
|
201
|
+
return fn(se(e));
|
|
202
|
+
}
|
|
203
|
+
function dn(e, t, n) {
|
|
204
|
+
n === void 0 && (n = !1);
|
|
205
|
+
const r = pe(e), o = wt(e), s = yt(o);
|
|
206
|
+
let i = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
|
|
207
|
+
return t.reference[s] > t.floating[s] && (i = xe(i)), [i, xe(i)];
|
|
208
|
+
}
|
|
209
|
+
function mn(e) {
|
|
210
|
+
const t = xe(e);
|
|
211
|
+
return [He(e), t, He(t)];
|
|
212
|
+
}
|
|
213
|
+
function He(e) {
|
|
214
|
+
return e.replace(/start|end/g, (t) => un[t]);
|
|
215
|
+
}
|
|
216
|
+
function gn(e, t, n) {
|
|
217
|
+
const r = ["left", "right"], o = ["right", "left"], s = ["top", "bottom"], i = ["bottom", "top"];
|
|
218
|
+
switch (e) {
|
|
219
|
+
case "top":
|
|
220
|
+
case "bottom":
|
|
221
|
+
return n ? t ? o : r : t ? r : o;
|
|
222
|
+
case "left":
|
|
223
|
+
case "right":
|
|
224
|
+
return t ? s : i;
|
|
225
|
+
default:
|
|
226
|
+
return [];
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function pn(e, t, n, r) {
|
|
230
|
+
const o = pe(e);
|
|
231
|
+
let s = gn(re(e), n === "start", r);
|
|
232
|
+
return o && (s = s.map((i) => i + "-" + o), t && (s = s.concat(s.map(He)))), s;
|
|
233
|
+
}
|
|
234
|
+
function xe(e) {
|
|
235
|
+
return e.replace(/left|right|bottom|top/g, (t) => an[t]);
|
|
236
|
+
}
|
|
237
|
+
function hn(e) {
|
|
238
|
+
return {
|
|
239
|
+
top: 0,
|
|
240
|
+
right: 0,
|
|
241
|
+
bottom: 0,
|
|
242
|
+
left: 0,
|
|
243
|
+
...e
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
function vn(e) {
|
|
247
|
+
return typeof e != "number" ? hn(e) : {
|
|
248
|
+
top: e,
|
|
249
|
+
right: e,
|
|
250
|
+
bottom: e,
|
|
251
|
+
left: e
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function Re(e) {
|
|
255
|
+
const {
|
|
256
|
+
x: t,
|
|
257
|
+
y: n,
|
|
258
|
+
width: r,
|
|
259
|
+
height: o
|
|
260
|
+
} = e;
|
|
261
|
+
return {
|
|
262
|
+
width: r,
|
|
263
|
+
height: o,
|
|
264
|
+
top: n,
|
|
265
|
+
left: t,
|
|
266
|
+
right: t + r,
|
|
267
|
+
bottom: n + o,
|
|
268
|
+
x: t,
|
|
269
|
+
y: n
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/*!
|
|
273
|
+
* tabbable 6.2.0
|
|
274
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
275
|
+
*/
|
|
276
|
+
var bn = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"], Ke = /* @__PURE__ */ bn.join(","), xt = typeof Element > "u", me = xt ? function() {
|
|
277
|
+
} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, Ee = !xt && Element.prototype.getRootNode ? function(e) {
|
|
278
|
+
var t;
|
|
279
|
+
return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
|
|
280
|
+
} : function(e) {
|
|
281
|
+
return e == null ? void 0 : e.ownerDocument;
|
|
282
|
+
}, Ce = function e(t, n) {
|
|
283
|
+
var r;
|
|
284
|
+
n === void 0 && (n = !0);
|
|
285
|
+
var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), s = o === "" || o === "true", i = s || n && t && e(t.parentNode);
|
|
286
|
+
return i;
|
|
287
|
+
}, yn = function(t) {
|
|
288
|
+
var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
|
|
289
|
+
return r === "" || r === "true";
|
|
290
|
+
}, wn = function(t, n, r) {
|
|
291
|
+
if (Ce(t))
|
|
292
|
+
return [];
|
|
293
|
+
var o = Array.prototype.slice.apply(t.querySelectorAll(Ke));
|
|
294
|
+
return n && me.call(t, Ke) && o.unshift(t), o = o.filter(r), o;
|
|
295
|
+
}, xn = function e(t, n, r) {
|
|
296
|
+
for (var o = [], s = Array.from(t); s.length; ) {
|
|
297
|
+
var i = s.shift();
|
|
298
|
+
if (!Ce(i, !1))
|
|
299
|
+
if (i.tagName === "SLOT") {
|
|
300
|
+
var c = i.assignedElements(), l = c.length ? c : i.children, a = e(l, !0, r);
|
|
301
|
+
r.flatten ? o.push.apply(o, a) : o.push({
|
|
302
|
+
scopeParent: i,
|
|
303
|
+
candidates: a
|
|
304
|
+
});
|
|
305
|
+
} else {
|
|
306
|
+
var u = me.call(i, Ke);
|
|
307
|
+
u && r.filter(i) && (n || !t.includes(i)) && o.push(i);
|
|
308
|
+
var g = i.shadowRoot || // check for an undisclosed shadow
|
|
309
|
+
typeof r.getShadowRoot == "function" && r.getShadowRoot(i), h = !Ce(g, !1) && (!r.shadowRootFilter || r.shadowRootFilter(i));
|
|
310
|
+
if (g && h) {
|
|
311
|
+
var d = e(g === !0 ? i.children : g.children, !0, r);
|
|
312
|
+
r.flatten ? o.push.apply(o, d) : o.push({
|
|
313
|
+
scopeParent: i,
|
|
314
|
+
candidates: d
|
|
315
|
+
});
|
|
316
|
+
} else
|
|
317
|
+
s.unshift.apply(s, i.children);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return o;
|
|
321
|
+
}, Rt = function(t) {
|
|
322
|
+
return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
|
|
323
|
+
}, Et = function(t) {
|
|
324
|
+
if (!t)
|
|
325
|
+
throw new Error("No node provided");
|
|
326
|
+
return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || yn(t)) && !Rt(t) ? 0 : t.tabIndex;
|
|
327
|
+
}, Rn = function(t, n) {
|
|
328
|
+
var r = Et(t);
|
|
329
|
+
return r < 0 && n && !Rt(t) ? 0 : r;
|
|
330
|
+
}, En = function(t, n) {
|
|
331
|
+
return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
|
|
332
|
+
}, Ct = function(t) {
|
|
333
|
+
return t.tagName === "INPUT";
|
|
334
|
+
}, Cn = function(t) {
|
|
335
|
+
return Ct(t) && t.type === "hidden";
|
|
336
|
+
}, Sn = function(t) {
|
|
337
|
+
var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
|
|
338
|
+
return r.tagName === "SUMMARY";
|
|
339
|
+
});
|
|
340
|
+
return n;
|
|
341
|
+
}, Tn = function(t, n) {
|
|
342
|
+
for (var r = 0; r < t.length; r++)
|
|
343
|
+
if (t[r].checked && t[r].form === n)
|
|
344
|
+
return t[r];
|
|
345
|
+
}, On = function(t) {
|
|
346
|
+
if (!t.name)
|
|
347
|
+
return !0;
|
|
348
|
+
var n = t.form || Ee(t), r = function(c) {
|
|
349
|
+
return n.querySelectorAll('input[type="radio"][name="' + c + '"]');
|
|
350
|
+
}, o;
|
|
351
|
+
if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
|
|
352
|
+
o = r(window.CSS.escape(t.name));
|
|
353
|
+
else
|
|
354
|
+
try {
|
|
355
|
+
o = r(t.name);
|
|
356
|
+
} catch (i) {
|
|
357
|
+
return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", i.message), !1;
|
|
358
|
+
}
|
|
359
|
+
var s = Tn(o, t.form);
|
|
360
|
+
return !s || s === t;
|
|
361
|
+
}, Pn = function(t) {
|
|
362
|
+
return Ct(t) && t.type === "radio";
|
|
363
|
+
}, An = function(t) {
|
|
364
|
+
return Pn(t) && !On(t);
|
|
365
|
+
}, Mn = function(t) {
|
|
366
|
+
var n, r = t && Ee(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, s = !1;
|
|
367
|
+
if (r && r !== t) {
|
|
368
|
+
var i, c, l;
|
|
369
|
+
for (s = !!((i = o) !== null && i !== void 0 && (c = i.ownerDocument) !== null && c !== void 0 && c.contains(o) || t != null && (l = t.ownerDocument) !== null && l !== void 0 && l.contains(t)); !s && o; ) {
|
|
370
|
+
var a, u, g;
|
|
371
|
+
r = Ee(o), o = (a = r) === null || a === void 0 ? void 0 : a.host, s = !!((u = o) !== null && u !== void 0 && (g = u.ownerDocument) !== null && g !== void 0 && g.contains(o));
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
return s;
|
|
375
|
+
}, Ge = function(t) {
|
|
376
|
+
var n = t.getBoundingClientRect(), r = n.width, o = n.height;
|
|
377
|
+
return r === 0 && o === 0;
|
|
378
|
+
}, Dn = function(t, n) {
|
|
379
|
+
var r = n.displayCheck, o = n.getShadowRoot;
|
|
380
|
+
if (getComputedStyle(t).visibility === "hidden")
|
|
381
|
+
return !0;
|
|
382
|
+
var s = me.call(t, "details>summary:first-of-type"), i = s ? t.parentElement : t;
|
|
383
|
+
if (me.call(i, "details:not([open]) *"))
|
|
384
|
+
return !0;
|
|
385
|
+
if (!r || r === "full" || r === "legacy-full") {
|
|
386
|
+
if (typeof o == "function") {
|
|
387
|
+
for (var c = t; t; ) {
|
|
388
|
+
var l = t.parentElement, a = Ee(t);
|
|
389
|
+
if (l && !l.shadowRoot && o(l) === !0)
|
|
390
|
+
return Ge(t);
|
|
391
|
+
t.assignedSlot ? t = t.assignedSlot : !l && a !== t.ownerDocument ? t = a.host : t = l;
|
|
392
|
+
}
|
|
393
|
+
t = c;
|
|
394
|
+
}
|
|
395
|
+
if (Mn(t))
|
|
396
|
+
return !t.getClientRects().length;
|
|
397
|
+
if (r !== "legacy-full")
|
|
398
|
+
return !0;
|
|
399
|
+
} else if (r === "non-zero-area")
|
|
400
|
+
return Ge(t);
|
|
401
|
+
return !1;
|
|
402
|
+
}, Ln = function(t) {
|
|
403
|
+
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
|
|
404
|
+
for (var n = t.parentElement; n; ) {
|
|
405
|
+
if (n.tagName === "FIELDSET" && n.disabled) {
|
|
406
|
+
for (var r = 0; r < n.children.length; r++) {
|
|
407
|
+
var o = n.children.item(r);
|
|
408
|
+
if (o.tagName === "LEGEND")
|
|
409
|
+
return me.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
|
|
410
|
+
}
|
|
411
|
+
return !0;
|
|
412
|
+
}
|
|
413
|
+
n = n.parentElement;
|
|
414
|
+
}
|
|
415
|
+
return !1;
|
|
416
|
+
}, In = function(t, n) {
|
|
417
|
+
return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
|
|
418
|
+
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
419
|
+
// note related to `candidateSelectors`)
|
|
420
|
+
Ce(n) || Cn(n) || Dn(n, t) || // For a details element with a summary, the summary element gets the focus
|
|
421
|
+
Sn(n) || Ln(n));
|
|
422
|
+
}, Ze = function(t, n) {
|
|
423
|
+
return !(An(n) || Et(n) < 0 || !In(t, n));
|
|
424
|
+
}, kn = function(t) {
|
|
425
|
+
var n = parseInt(t.getAttribute("tabindex"), 10);
|
|
426
|
+
return !!(isNaN(n) || n >= 0);
|
|
427
|
+
}, Fn = function e(t) {
|
|
428
|
+
var n = [], r = [];
|
|
429
|
+
return t.forEach(function(o, s) {
|
|
430
|
+
var i = !!o.scopeParent, c = i ? o.scopeParent : o, l = Rn(c, i), a = i ? e(o.candidates) : c;
|
|
431
|
+
l === 0 ? i ? n.push.apply(n, a) : n.push(c) : r.push({
|
|
432
|
+
documentOrder: s,
|
|
433
|
+
tabIndex: l,
|
|
434
|
+
item: o,
|
|
435
|
+
isScope: i,
|
|
436
|
+
content: a
|
|
437
|
+
});
|
|
438
|
+
}), r.sort(En).reduce(function(o, s) {
|
|
439
|
+
return s.isScope ? o.push.apply(o, s.content) : o.push(s.content), o;
|
|
440
|
+
}, []).concat(n);
|
|
441
|
+
}, St = function(t, n) {
|
|
442
|
+
n = n || {};
|
|
443
|
+
var r;
|
|
444
|
+
return n.getShadowRoot ? r = xn([t], n.includeContainer, {
|
|
445
|
+
filter: Ze.bind(null, n),
|
|
446
|
+
flatten: !1,
|
|
447
|
+
getShadowRoot: n.getShadowRoot,
|
|
448
|
+
shadowRootFilter: kn
|
|
449
|
+
}) : r = wn(t, n.includeContainer, Ze.bind(null, n)), Fn(r);
|
|
450
|
+
};
|
|
451
|
+
function Je(e, t, n) {
|
|
452
|
+
let {
|
|
453
|
+
reference: r,
|
|
454
|
+
floating: o
|
|
455
|
+
} = e;
|
|
456
|
+
const s = se(t), i = wt(t), c = yt(i), l = re(t), a = s === "y", u = r.x + r.width / 2 - o.width / 2, g = r.y + r.height / 2 - o.height / 2, h = r[c] / 2 - o[c] / 2;
|
|
457
|
+
let d;
|
|
458
|
+
switch (l) {
|
|
459
|
+
case "top":
|
|
460
|
+
d = {
|
|
461
|
+
x: u,
|
|
462
|
+
y: r.y - o.height
|
|
463
|
+
};
|
|
464
|
+
break;
|
|
465
|
+
case "bottom":
|
|
466
|
+
d = {
|
|
467
|
+
x: u,
|
|
468
|
+
y: r.y + r.height
|
|
469
|
+
};
|
|
470
|
+
break;
|
|
471
|
+
case "right":
|
|
472
|
+
d = {
|
|
473
|
+
x: r.x + r.width,
|
|
474
|
+
y: g
|
|
475
|
+
};
|
|
476
|
+
break;
|
|
477
|
+
case "left":
|
|
478
|
+
d = {
|
|
479
|
+
x: r.x - o.width,
|
|
480
|
+
y: g
|
|
481
|
+
};
|
|
482
|
+
break;
|
|
483
|
+
default:
|
|
484
|
+
d = {
|
|
485
|
+
x: r.x,
|
|
486
|
+
y: r.y
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
switch (pe(t)) {
|
|
490
|
+
case "start":
|
|
491
|
+
d[i] -= h * (n && a ? -1 : 1);
|
|
492
|
+
break;
|
|
493
|
+
case "end":
|
|
494
|
+
d[i] += h * (n && a ? -1 : 1);
|
|
495
|
+
break;
|
|
496
|
+
}
|
|
497
|
+
return d;
|
|
498
|
+
}
|
|
499
|
+
const Nn = async (e, t, n) => {
|
|
500
|
+
const {
|
|
501
|
+
placement: r = "bottom",
|
|
502
|
+
strategy: o = "absolute",
|
|
503
|
+
middleware: s = [],
|
|
504
|
+
platform: i
|
|
505
|
+
} = n, c = s.filter(Boolean), l = await (i.isRTL == null ? void 0 : i.isRTL(t));
|
|
506
|
+
let a = await i.getElementRects({
|
|
507
|
+
reference: e,
|
|
508
|
+
floating: t,
|
|
509
|
+
strategy: o
|
|
510
|
+
}), {
|
|
511
|
+
x: u,
|
|
512
|
+
y: g
|
|
513
|
+
} = Je(a, r, l), h = r, d = {}, x = 0;
|
|
514
|
+
for (let f = 0; f < c.length; f++) {
|
|
515
|
+
const {
|
|
516
|
+
name: y,
|
|
517
|
+
fn: R
|
|
518
|
+
} = c[f], {
|
|
519
|
+
x: E,
|
|
520
|
+
y: w,
|
|
521
|
+
data: T,
|
|
522
|
+
reset: C
|
|
523
|
+
} = await R({
|
|
524
|
+
x: u,
|
|
525
|
+
y: g,
|
|
526
|
+
initialPlacement: r,
|
|
527
|
+
placement: h,
|
|
528
|
+
strategy: o,
|
|
529
|
+
middlewareData: d,
|
|
530
|
+
rects: a,
|
|
531
|
+
platform: i,
|
|
532
|
+
elements: {
|
|
533
|
+
reference: e,
|
|
534
|
+
floating: t
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
u = E ?? u, g = w ?? g, d = {
|
|
538
|
+
...d,
|
|
539
|
+
[y]: {
|
|
540
|
+
...d[y],
|
|
541
|
+
...T
|
|
542
|
+
}
|
|
543
|
+
}, C && x <= 50 && (x++, typeof C == "object" && (C.placement && (h = C.placement), C.rects && (a = C.rects === !0 ? await i.getElementRects({
|
|
544
|
+
reference: e,
|
|
545
|
+
floating: t,
|
|
546
|
+
strategy: o
|
|
547
|
+
}) : C.rects), {
|
|
548
|
+
x: u,
|
|
549
|
+
y: g
|
|
550
|
+
} = Je(a, h, l)), f = -1);
|
|
551
|
+
}
|
|
552
|
+
return {
|
|
553
|
+
x: u,
|
|
554
|
+
y: g,
|
|
555
|
+
placement: h,
|
|
556
|
+
strategy: o,
|
|
557
|
+
middlewareData: d
|
|
558
|
+
};
|
|
559
|
+
};
|
|
560
|
+
async function Tt(e, t) {
|
|
561
|
+
var n;
|
|
562
|
+
t === void 0 && (t = {});
|
|
563
|
+
const {
|
|
564
|
+
x: r,
|
|
565
|
+
y: o,
|
|
566
|
+
platform: s,
|
|
567
|
+
rects: i,
|
|
568
|
+
elements: c,
|
|
569
|
+
strategy: l
|
|
570
|
+
} = e, {
|
|
571
|
+
boundary: a = "clippingAncestors",
|
|
572
|
+
rootBoundary: u = "viewport",
|
|
573
|
+
elementContext: g = "floating",
|
|
574
|
+
altBoundary: h = !1,
|
|
575
|
+
padding: d = 0
|
|
576
|
+
} = Me(t, e), x = vn(d), y = c[h ? g === "floating" ? "reference" : "floating" : g], R = Re(await s.getClippingRect({
|
|
577
|
+
element: (n = await (s.isElement == null ? void 0 : s.isElement(y))) == null || n ? y : y.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(c.floating)),
|
|
578
|
+
boundary: a,
|
|
579
|
+
rootBoundary: u,
|
|
580
|
+
strategy: l
|
|
581
|
+
})), E = g === "floating" ? {
|
|
582
|
+
x: r,
|
|
583
|
+
y: o,
|
|
584
|
+
width: i.floating.width,
|
|
585
|
+
height: i.floating.height
|
|
586
|
+
} : i.reference, w = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(c.floating)), T = await (s.isElement == null ? void 0 : s.isElement(w)) ? await (s.getScale == null ? void 0 : s.getScale(w)) || {
|
|
587
|
+
x: 1,
|
|
588
|
+
y: 1
|
|
589
|
+
} : {
|
|
590
|
+
x: 1,
|
|
591
|
+
y: 1
|
|
592
|
+
}, C = Re(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
593
|
+
elements: c,
|
|
594
|
+
rect: E,
|
|
595
|
+
offsetParent: w,
|
|
596
|
+
strategy: l
|
|
597
|
+
}) : E);
|
|
598
|
+
return {
|
|
599
|
+
top: (R.top - C.top + x.top) / T.y,
|
|
600
|
+
bottom: (C.bottom - R.bottom + x.bottom) / T.y,
|
|
601
|
+
left: (R.left - C.left + x.left) / T.x,
|
|
602
|
+
right: (C.right - R.right + x.right) / T.x
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
const Bn = function(e) {
|
|
606
|
+
return e === void 0 && (e = {}), {
|
|
607
|
+
name: "flip",
|
|
608
|
+
options: e,
|
|
609
|
+
async fn(t) {
|
|
610
|
+
var n, r;
|
|
611
|
+
const {
|
|
612
|
+
placement: o,
|
|
613
|
+
middlewareData: s,
|
|
614
|
+
rects: i,
|
|
615
|
+
initialPlacement: c,
|
|
616
|
+
platform: l,
|
|
617
|
+
elements: a
|
|
618
|
+
} = t, {
|
|
619
|
+
mainAxis: u = !0,
|
|
620
|
+
crossAxis: g = !0,
|
|
621
|
+
fallbackPlacements: h,
|
|
622
|
+
fallbackStrategy: d = "bestFit",
|
|
623
|
+
fallbackAxisSideDirection: x = "none",
|
|
624
|
+
flipAlignment: f = !0,
|
|
625
|
+
...y
|
|
626
|
+
} = Me(e, t);
|
|
627
|
+
if ((n = s.arrow) != null && n.alignmentOffset)
|
|
628
|
+
return {};
|
|
629
|
+
const R = re(o), E = se(c), w = re(c) === c, T = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), C = h || (w || !f ? [xe(c)] : mn(c)), D = x !== "none";
|
|
630
|
+
!h && D && C.push(...pn(c, f, x, T));
|
|
631
|
+
const M = [c, ...C], W = await Tt(t, y), L = [];
|
|
632
|
+
let N = ((r = s.flip) == null ? void 0 : r.overflows) || [];
|
|
633
|
+
if (u && L.push(W[R]), g) {
|
|
634
|
+
const I = dn(o, i, T);
|
|
635
|
+
L.push(W[I[0]], W[I[1]]);
|
|
636
|
+
}
|
|
637
|
+
if (N = [...N, {
|
|
638
|
+
placement: o,
|
|
639
|
+
overflows: L
|
|
640
|
+
}], !L.every((I) => I <= 0)) {
|
|
641
|
+
var B, $;
|
|
642
|
+
const I = (((B = s.flip) == null ? void 0 : B.index) || 0) + 1, S = M[I];
|
|
643
|
+
if (S)
|
|
644
|
+
return {
|
|
645
|
+
data: {
|
|
646
|
+
index: I,
|
|
647
|
+
overflows: N
|
|
648
|
+
},
|
|
649
|
+
reset: {
|
|
650
|
+
placement: S
|
|
651
|
+
}
|
|
652
|
+
};
|
|
653
|
+
let A = ($ = N.filter((b) => b.overflows[0] <= 0).sort((b, p) => b.overflows[1] - p.overflows[1])[0]) == null ? void 0 : $.placement;
|
|
654
|
+
if (!A)
|
|
655
|
+
switch (d) {
|
|
656
|
+
case "bestFit": {
|
|
657
|
+
var F;
|
|
658
|
+
const b = (F = N.filter((p) => {
|
|
659
|
+
if (D) {
|
|
660
|
+
const v = se(p.placement);
|
|
661
|
+
return v === E || // Create a bias to the `y` side axis due to horizontal
|
|
662
|
+
// reading directions favoring greater width.
|
|
663
|
+
v === "y";
|
|
664
|
+
}
|
|
665
|
+
return !0;
|
|
666
|
+
}).map((p) => [p.placement, p.overflows.filter((v) => v > 0).reduce((v, P) => v + P, 0)]).sort((p, v) => p[1] - v[1])[0]) == null ? void 0 : F[0];
|
|
667
|
+
b && (A = b);
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
case "initialPlacement":
|
|
671
|
+
A = c;
|
|
672
|
+
break;
|
|
673
|
+
}
|
|
674
|
+
if (o !== A)
|
|
675
|
+
return {
|
|
676
|
+
reset: {
|
|
677
|
+
placement: A
|
|
678
|
+
}
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
return {};
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
async function Wn(e, t) {
|
|
686
|
+
const {
|
|
687
|
+
placement: n,
|
|
688
|
+
platform: r,
|
|
689
|
+
elements: o
|
|
690
|
+
} = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), i = re(n), c = pe(n), l = se(n) === "y", a = ["left", "top"].includes(i) ? -1 : 1, u = s && l ? -1 : 1, g = Me(t, e);
|
|
691
|
+
let {
|
|
692
|
+
mainAxis: h,
|
|
693
|
+
crossAxis: d,
|
|
694
|
+
alignmentAxis: x
|
|
695
|
+
} = typeof g == "number" ? {
|
|
696
|
+
mainAxis: g,
|
|
697
|
+
crossAxis: 0,
|
|
698
|
+
alignmentAxis: null
|
|
699
|
+
} : {
|
|
700
|
+
mainAxis: g.mainAxis || 0,
|
|
701
|
+
crossAxis: g.crossAxis || 0,
|
|
702
|
+
alignmentAxis: g.alignmentAxis
|
|
703
|
+
};
|
|
704
|
+
return c && typeof x == "number" && (d = c === "end" ? x * -1 : x), l ? {
|
|
705
|
+
x: d * u,
|
|
706
|
+
y: h * a
|
|
707
|
+
} : {
|
|
708
|
+
x: h * a,
|
|
709
|
+
y: d * u
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
const $n = function(e) {
|
|
713
|
+
return e === void 0 && (e = 0), {
|
|
714
|
+
name: "offset",
|
|
715
|
+
options: e,
|
|
716
|
+
async fn(t) {
|
|
717
|
+
var n, r;
|
|
718
|
+
const {
|
|
719
|
+
x: o,
|
|
720
|
+
y: s,
|
|
721
|
+
placement: i,
|
|
722
|
+
middlewareData: c
|
|
723
|
+
} = t, l = await Wn(t, e);
|
|
724
|
+
return i === ((n = c.offset) == null ? void 0 : n.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : {
|
|
725
|
+
x: o + l.x,
|
|
726
|
+
y: s + l.y,
|
|
727
|
+
data: {
|
|
728
|
+
...l,
|
|
729
|
+
placement: i
|
|
730
|
+
}
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
}, Vn = function(e) {
|
|
735
|
+
return e === void 0 && (e = {}), {
|
|
736
|
+
name: "size",
|
|
737
|
+
options: e,
|
|
738
|
+
async fn(t) {
|
|
739
|
+
var n, r;
|
|
740
|
+
const {
|
|
741
|
+
placement: o,
|
|
742
|
+
rects: s,
|
|
743
|
+
platform: i,
|
|
744
|
+
elements: c
|
|
745
|
+
} = t, {
|
|
746
|
+
apply: l = () => {
|
|
747
|
+
},
|
|
748
|
+
...a
|
|
749
|
+
} = Me(e, t), u = await Tt(t, a), g = re(o), h = pe(o), d = se(o) === "y", {
|
|
750
|
+
width: x,
|
|
751
|
+
height: f
|
|
752
|
+
} = s.floating;
|
|
753
|
+
let y, R;
|
|
754
|
+
g === "top" || g === "bottom" ? (y = g, R = h === (await (i.isRTL == null ? void 0 : i.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (R = g, y = h === "end" ? "top" : "bottom");
|
|
755
|
+
const E = f - u.top - u.bottom, w = x - u.left - u.right, T = de(f - u[y], E), C = de(x - u[R], w), D = !t.middlewareData.shift;
|
|
756
|
+
let M = T, W = C;
|
|
757
|
+
if ((n = t.middlewareData.shift) != null && n.enabled.x && (W = w), (r = t.middlewareData.shift) != null && r.enabled.y && (M = E), D && !h) {
|
|
758
|
+
const N = Y(u.left, 0), B = Y(u.right, 0), $ = Y(u.top, 0), F = Y(u.bottom, 0);
|
|
759
|
+
d ? W = x - 2 * (N !== 0 || B !== 0 ? N + B : Y(u.left, u.right)) : M = f - 2 * ($ !== 0 || F !== 0 ? $ + F : Y(u.top, u.bottom));
|
|
760
|
+
}
|
|
761
|
+
await l({
|
|
762
|
+
...t,
|
|
763
|
+
availableWidth: W,
|
|
764
|
+
availableHeight: M
|
|
765
|
+
});
|
|
766
|
+
const L = await i.getDimensions(c.floating);
|
|
767
|
+
return x !== L.width || f !== L.height ? {
|
|
768
|
+
reset: {
|
|
769
|
+
rects: !0
|
|
770
|
+
}
|
|
771
|
+
} : {};
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
};
|
|
775
|
+
function Ot(e) {
|
|
776
|
+
const t = U(e);
|
|
777
|
+
let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
|
|
778
|
+
const o = _(e), s = o ? e.offsetWidth : n, i = o ? e.offsetHeight : r, c = we(n) !== s || we(r) !== i;
|
|
779
|
+
return c && (n = s, r = i), {
|
|
780
|
+
width: n,
|
|
781
|
+
height: r,
|
|
782
|
+
$: c
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
function je(e) {
|
|
786
|
+
return k(e) ? e : e.contextElement;
|
|
787
|
+
}
|
|
788
|
+
function ie(e) {
|
|
789
|
+
const t = je(e);
|
|
790
|
+
if (!_(t))
|
|
791
|
+
return z(1);
|
|
792
|
+
const n = t.getBoundingClientRect(), {
|
|
793
|
+
width: r,
|
|
794
|
+
height: o,
|
|
795
|
+
$: s
|
|
796
|
+
} = Ot(t);
|
|
797
|
+
let i = (s ? we(n.width) : n.width) / r, c = (s ? we(n.height) : n.height) / o;
|
|
798
|
+
return (!i || !Number.isFinite(i)) && (i = 1), (!c || !Number.isFinite(c)) && (c = 1), {
|
|
799
|
+
x: i,
|
|
800
|
+
y: c
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
const _n = /* @__PURE__ */ z(0);
|
|
804
|
+
function Pt(e) {
|
|
805
|
+
const t = K(e);
|
|
806
|
+
return !Pe() || !t.visualViewport ? _n : {
|
|
807
|
+
x: t.visualViewport.offsetLeft,
|
|
808
|
+
y: t.visualViewport.offsetTop
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
function Hn(e, t, n) {
|
|
812
|
+
return t === void 0 && (t = !1), !n || t && n !== K(e) ? !1 : t;
|
|
813
|
+
}
|
|
814
|
+
function oe(e, t, n, r) {
|
|
815
|
+
t === void 0 && (t = !1), n === void 0 && (n = !1);
|
|
816
|
+
const o = e.getBoundingClientRect(), s = je(e);
|
|
817
|
+
let i = z(1);
|
|
818
|
+
t && (r ? k(r) && (i = ie(r)) : i = ie(e));
|
|
819
|
+
const c = Hn(s, n, r) ? Pt(s) : z(0);
|
|
820
|
+
let l = (o.left + c.x) / i.x, a = (o.top + c.y) / i.y, u = o.width / i.x, g = o.height / i.y;
|
|
821
|
+
if (s) {
|
|
822
|
+
const h = K(s), d = r && k(r) ? K(r) : r;
|
|
823
|
+
let x = h, f = _e(x);
|
|
824
|
+
for (; f && r && d !== x; ) {
|
|
825
|
+
const y = ie(f), R = f.getBoundingClientRect(), E = U(f), w = R.left + (f.clientLeft + parseFloat(E.paddingLeft)) * y.x, T = R.top + (f.clientTop + parseFloat(E.paddingTop)) * y.y;
|
|
826
|
+
l *= y.x, a *= y.y, u *= y.x, g *= y.y, l += w, a += T, x = K(f), f = _e(x);
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
return Re({
|
|
830
|
+
width: u,
|
|
831
|
+
height: g,
|
|
832
|
+
x: l,
|
|
833
|
+
y: a
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
function qe(e, t) {
|
|
837
|
+
const n = Ae(e).scrollLeft;
|
|
838
|
+
return t ? t.left + n : oe(X(e)).left + n;
|
|
839
|
+
}
|
|
840
|
+
function At(e, t, n) {
|
|
841
|
+
n === void 0 && (n = !1);
|
|
842
|
+
const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
|
|
843
|
+
// RTL <body> scrollbar.
|
|
844
|
+
qe(e, r)
|
|
845
|
+
)), s = r.top + t.scrollTop;
|
|
846
|
+
return {
|
|
847
|
+
x: o,
|
|
848
|
+
y: s
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
function Kn(e) {
|
|
852
|
+
let {
|
|
853
|
+
elements: t,
|
|
854
|
+
rect: n,
|
|
855
|
+
offsetParent: r,
|
|
856
|
+
strategy: o
|
|
857
|
+
} = e;
|
|
858
|
+
const s = o === "fixed", i = X(r), c = t ? Oe(t.floating) : !1;
|
|
859
|
+
if (r === i || c && s)
|
|
860
|
+
return n;
|
|
861
|
+
let l = {
|
|
862
|
+
scrollLeft: 0,
|
|
863
|
+
scrollTop: 0
|
|
864
|
+
}, a = z(1);
|
|
865
|
+
const u = z(0), g = _(r);
|
|
866
|
+
if ((g || !g && !s) && ((ce(r) !== "body" || ge(i)) && (l = Ae(r)), _(r))) {
|
|
867
|
+
const d = oe(r);
|
|
868
|
+
a = ie(r), u.x = d.x + r.clientLeft, u.y = d.y + r.clientTop;
|
|
869
|
+
}
|
|
870
|
+
const h = i && !g && !s ? At(i, l, !0) : z(0);
|
|
871
|
+
return {
|
|
872
|
+
width: n.width * a.x,
|
|
873
|
+
height: n.height * a.y,
|
|
874
|
+
x: n.x * a.x - l.scrollLeft * a.x + u.x + h.x,
|
|
875
|
+
y: n.y * a.y - l.scrollTop * a.y + u.y + h.y
|
|
876
|
+
};
|
|
877
|
+
}
|
|
878
|
+
function Yn(e) {
|
|
879
|
+
return Array.from(e.getClientRects());
|
|
880
|
+
}
|
|
881
|
+
function Un(e) {
|
|
882
|
+
const t = X(e), n = Ae(e), r = e.ownerDocument.body, o = Y(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = Y(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
|
|
883
|
+
let i = -n.scrollLeft + qe(e);
|
|
884
|
+
const c = -n.scrollTop;
|
|
885
|
+
return U(r).direction === "rtl" && (i += Y(t.clientWidth, r.clientWidth) - o), {
|
|
886
|
+
width: o,
|
|
887
|
+
height: s,
|
|
888
|
+
x: i,
|
|
889
|
+
y: c
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
function jn(e, t) {
|
|
893
|
+
const n = K(e), r = X(e), o = n.visualViewport;
|
|
894
|
+
let s = r.clientWidth, i = r.clientHeight, c = 0, l = 0;
|
|
895
|
+
if (o) {
|
|
896
|
+
s = o.width, i = o.height;
|
|
897
|
+
const a = Pe();
|
|
898
|
+
(!a || a && t === "fixed") && (c = o.offsetLeft, l = o.offsetTop);
|
|
899
|
+
}
|
|
900
|
+
return {
|
|
901
|
+
width: s,
|
|
902
|
+
height: i,
|
|
903
|
+
x: c,
|
|
904
|
+
y: l
|
|
905
|
+
};
|
|
906
|
+
}
|
|
907
|
+
function qn(e, t) {
|
|
908
|
+
const n = oe(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, s = _(e) ? ie(e) : z(1), i = e.clientWidth * s.x, c = e.clientHeight * s.y, l = o * s.x, a = r * s.y;
|
|
909
|
+
return {
|
|
910
|
+
width: i,
|
|
911
|
+
height: c,
|
|
912
|
+
x: l,
|
|
913
|
+
y: a
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function Qe(e, t, n) {
|
|
917
|
+
let r;
|
|
918
|
+
if (t === "viewport")
|
|
919
|
+
r = jn(e, n);
|
|
920
|
+
else if (t === "document")
|
|
921
|
+
r = Un(X(e));
|
|
922
|
+
else if (k(t))
|
|
923
|
+
r = qn(t, n);
|
|
924
|
+
else {
|
|
925
|
+
const o = Pt(e);
|
|
926
|
+
r = {
|
|
927
|
+
x: t.x - o.x,
|
|
928
|
+
y: t.y - o.y,
|
|
929
|
+
width: t.width,
|
|
930
|
+
height: t.height
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
return Re(r);
|
|
934
|
+
}
|
|
935
|
+
function Mt(e, t) {
|
|
936
|
+
const n = ee(e);
|
|
937
|
+
return n === t || !k(n) || Q(n) ? !1 : U(n).position === "fixed" || Mt(n, t);
|
|
938
|
+
}
|
|
939
|
+
function zn(e, t) {
|
|
940
|
+
const n = t.get(e);
|
|
941
|
+
if (n)
|
|
942
|
+
return n;
|
|
943
|
+
let r = te(e, [], !1).filter((c) => k(c) && ce(c) !== "body"), o = null;
|
|
944
|
+
const s = U(e).position === "fixed";
|
|
945
|
+
let i = s ? ee(e) : e;
|
|
946
|
+
for (; k(i) && !Q(i); ) {
|
|
947
|
+
const c = U(i), l = Ue(i);
|
|
948
|
+
!l && c.position === "fixed" && (o = null), (s ? !l && !o : !l && c.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || ge(i) && !l && Mt(e, i)) ? r = r.filter((u) => u !== i) : o = c, i = ee(i);
|
|
949
|
+
}
|
|
950
|
+
return t.set(e, r), r;
|
|
951
|
+
}
|
|
952
|
+
function Xn(e) {
|
|
953
|
+
let {
|
|
954
|
+
element: t,
|
|
955
|
+
boundary: n,
|
|
956
|
+
rootBoundary: r,
|
|
957
|
+
strategy: o
|
|
958
|
+
} = e;
|
|
959
|
+
const i = [...n === "clippingAncestors" ? Oe(t) ? [] : zn(t, this._c) : [].concat(n), r], c = i[0], l = i.reduce((a, u) => {
|
|
960
|
+
const g = Qe(t, u, o);
|
|
961
|
+
return a.top = Y(g.top, a.top), a.right = de(g.right, a.right), a.bottom = de(g.bottom, a.bottom), a.left = Y(g.left, a.left), a;
|
|
962
|
+
}, Qe(t, c, o));
|
|
963
|
+
return {
|
|
964
|
+
width: l.right - l.left,
|
|
965
|
+
height: l.bottom - l.top,
|
|
966
|
+
x: l.left,
|
|
967
|
+
y: l.top
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
function Gn(e) {
|
|
971
|
+
const {
|
|
972
|
+
width: t,
|
|
973
|
+
height: n
|
|
974
|
+
} = Ot(e);
|
|
975
|
+
return {
|
|
976
|
+
width: t,
|
|
977
|
+
height: n
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
function Zn(e, t, n) {
|
|
981
|
+
const r = _(t), o = X(t), s = n === "fixed", i = oe(e, !0, s, t);
|
|
982
|
+
let c = {
|
|
983
|
+
scrollLeft: 0,
|
|
984
|
+
scrollTop: 0
|
|
985
|
+
};
|
|
986
|
+
const l = z(0);
|
|
987
|
+
if (r || !r && !s)
|
|
988
|
+
if ((ce(t) !== "body" || ge(o)) && (c = Ae(t)), r) {
|
|
989
|
+
const h = oe(t, !0, s, t);
|
|
990
|
+
l.x = h.x + t.clientLeft, l.y = h.y + t.clientTop;
|
|
991
|
+
} else o && (l.x = qe(o));
|
|
992
|
+
const a = o && !r && !s ? At(o, c) : z(0), u = i.left + c.scrollLeft - l.x - a.x, g = i.top + c.scrollTop - l.y - a.y;
|
|
993
|
+
return {
|
|
994
|
+
x: u,
|
|
995
|
+
y: g,
|
|
996
|
+
width: i.width,
|
|
997
|
+
height: i.height
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
function Ie(e) {
|
|
1001
|
+
return U(e).position === "static";
|
|
1002
|
+
}
|
|
1003
|
+
function et(e, t) {
|
|
1004
|
+
if (!_(e) || U(e).position === "fixed")
|
|
1005
|
+
return null;
|
|
1006
|
+
if (t)
|
|
1007
|
+
return t(e);
|
|
1008
|
+
let n = e.offsetParent;
|
|
1009
|
+
return X(e) === n && (n = n.ownerDocument.body), n;
|
|
1010
|
+
}
|
|
1011
|
+
function Dt(e, t) {
|
|
1012
|
+
const n = K(e);
|
|
1013
|
+
if (Oe(e))
|
|
1014
|
+
return n;
|
|
1015
|
+
if (!_(e)) {
|
|
1016
|
+
let o = ee(e);
|
|
1017
|
+
for (; o && !Q(o); ) {
|
|
1018
|
+
if (k(o) && !Ie(o))
|
|
1019
|
+
return o;
|
|
1020
|
+
o = ee(o);
|
|
1021
|
+
}
|
|
1022
|
+
return n;
|
|
1023
|
+
}
|
|
1024
|
+
let r = et(e, t);
|
|
1025
|
+
for (; r && en(r) && Ie(r); )
|
|
1026
|
+
r = et(r, t);
|
|
1027
|
+
return r && Q(r) && Ie(r) && !Ue(r) ? n : r || tn(e) || n;
|
|
1028
|
+
}
|
|
1029
|
+
const Jn = async function(e) {
|
|
1030
|
+
const t = this.getOffsetParent || Dt, n = this.getDimensions, r = await n(e.floating);
|
|
1031
|
+
return {
|
|
1032
|
+
reference: Zn(e.reference, await t(e.floating), e.strategy),
|
|
1033
|
+
floating: {
|
|
1034
|
+
x: 0,
|
|
1035
|
+
y: 0,
|
|
1036
|
+
width: r.width,
|
|
1037
|
+
height: r.height
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
};
|
|
1041
|
+
function Qn(e) {
|
|
1042
|
+
return U(e).direction === "rtl";
|
|
1043
|
+
}
|
|
1044
|
+
const er = {
|
|
1045
|
+
convertOffsetParentRelativeRectToViewportRelativeRect: Kn,
|
|
1046
|
+
getDocumentElement: X,
|
|
1047
|
+
getClippingRect: Xn,
|
|
1048
|
+
getOffsetParent: Dt,
|
|
1049
|
+
getElementRects: Jn,
|
|
1050
|
+
getClientRects: Yn,
|
|
1051
|
+
getDimensions: Gn,
|
|
1052
|
+
getScale: ie,
|
|
1053
|
+
isElement: k,
|
|
1054
|
+
isRTL: Qn
|
|
1055
|
+
};
|
|
1056
|
+
function Lt(e, t) {
|
|
1057
|
+
return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
|
|
1058
|
+
}
|
|
1059
|
+
function tr(e, t) {
|
|
1060
|
+
let n = null, r;
|
|
1061
|
+
const o = X(e);
|
|
1062
|
+
function s() {
|
|
1063
|
+
var c;
|
|
1064
|
+
clearTimeout(r), (c = n) == null || c.disconnect(), n = null;
|
|
1065
|
+
}
|
|
1066
|
+
function i(c, l) {
|
|
1067
|
+
c === void 0 && (c = !1), l === void 0 && (l = 1), s();
|
|
1068
|
+
const a = e.getBoundingClientRect(), {
|
|
1069
|
+
left: u,
|
|
1070
|
+
top: g,
|
|
1071
|
+
width: h,
|
|
1072
|
+
height: d
|
|
1073
|
+
} = a;
|
|
1074
|
+
if (c || t(), !h || !d)
|
|
1075
|
+
return;
|
|
1076
|
+
const x = ve(g), f = ve(o.clientWidth - (u + h)), y = ve(o.clientHeight - (g + d)), R = ve(u), w = {
|
|
1077
|
+
rootMargin: -x + "px " + -f + "px " + -y + "px " + -R + "px",
|
|
1078
|
+
threshold: Y(0, de(1, l)) || 1
|
|
1079
|
+
};
|
|
1080
|
+
let T = !0;
|
|
1081
|
+
function C(D) {
|
|
1082
|
+
const M = D[0].intersectionRatio;
|
|
1083
|
+
if (M !== l) {
|
|
1084
|
+
if (!T)
|
|
1085
|
+
return i();
|
|
1086
|
+
M ? i(!1, M) : r = setTimeout(() => {
|
|
1087
|
+
i(!1, 1e-7);
|
|
1088
|
+
}, 1e3);
|
|
1089
|
+
}
|
|
1090
|
+
M === 1 && !Lt(a, e.getBoundingClientRect()) && i(), T = !1;
|
|
1091
|
+
}
|
|
1092
|
+
try {
|
|
1093
|
+
n = new IntersectionObserver(C, {
|
|
1094
|
+
...w,
|
|
1095
|
+
// Handle <iframe>s
|
|
1096
|
+
root: o.ownerDocument
|
|
1097
|
+
});
|
|
1098
|
+
} catch {
|
|
1099
|
+
n = new IntersectionObserver(C, w);
|
|
1100
|
+
}
|
|
1101
|
+
n.observe(e);
|
|
1102
|
+
}
|
|
1103
|
+
return i(!0), s;
|
|
1104
|
+
}
|
|
1105
|
+
function nr(e, t, n, r) {
|
|
1106
|
+
r === void 0 && (r = {});
|
|
1107
|
+
const {
|
|
1108
|
+
ancestorScroll: o = !0,
|
|
1109
|
+
ancestorResize: s = !0,
|
|
1110
|
+
elementResize: i = typeof ResizeObserver == "function",
|
|
1111
|
+
layoutShift: c = typeof IntersectionObserver == "function",
|
|
1112
|
+
animationFrame: l = !1
|
|
1113
|
+
} = r, a = je(e), u = o || s ? [...a ? te(a) : [], ...te(t)] : [];
|
|
1114
|
+
u.forEach((R) => {
|
|
1115
|
+
o && R.addEventListener("scroll", n, {
|
|
1116
|
+
passive: !0
|
|
1117
|
+
}), s && R.addEventListener("resize", n);
|
|
1118
|
+
});
|
|
1119
|
+
const g = a && c ? tr(a, n) : null;
|
|
1120
|
+
let h = -1, d = null;
|
|
1121
|
+
i && (d = new ResizeObserver((R) => {
|
|
1122
|
+
let [E] = R;
|
|
1123
|
+
E && E.target === a && d && (d.unobserve(t), cancelAnimationFrame(h), h = requestAnimationFrame(() => {
|
|
1124
|
+
var w;
|
|
1125
|
+
(w = d) == null || w.observe(t);
|
|
1126
|
+
})), n();
|
|
1127
|
+
}), a && !l && d.observe(a), d.observe(t));
|
|
1128
|
+
let x, f = l ? oe(e) : null;
|
|
1129
|
+
l && y();
|
|
1130
|
+
function y() {
|
|
1131
|
+
const R = oe(e);
|
|
1132
|
+
f && !Lt(f, R) && n(), f = R, x = requestAnimationFrame(y);
|
|
1133
|
+
}
|
|
1134
|
+
return n(), () => {
|
|
1135
|
+
var R;
|
|
1136
|
+
u.forEach((E) => {
|
|
1137
|
+
o && E.removeEventListener("scroll", n), s && E.removeEventListener("resize", n);
|
|
1138
|
+
}), g == null || g(), (R = d) == null || R.disconnect(), d = null, l && cancelAnimationFrame(x);
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
const rr = $n, or = Bn, ir = Vn, sr = (e, t, n) => {
|
|
1142
|
+
const r = /* @__PURE__ */ new Map(), o = {
|
|
1143
|
+
platform: er,
|
|
1144
|
+
...n
|
|
1145
|
+
}, s = {
|
|
1146
|
+
...o.platform,
|
|
1147
|
+
_c: r
|
|
1148
|
+
};
|
|
1149
|
+
return Nn(e, t, {
|
|
1150
|
+
...o,
|
|
1151
|
+
platform: s
|
|
1152
|
+
});
|
|
1153
|
+
};
|
|
1154
|
+
var be = typeof document < "u" ? gt : pt;
|
|
1155
|
+
function Se(e, t) {
|
|
1156
|
+
if (e === t)
|
|
1157
|
+
return !0;
|
|
1158
|
+
if (typeof e != typeof t)
|
|
1159
|
+
return !1;
|
|
1160
|
+
if (typeof e == "function" && e.toString() === t.toString())
|
|
1161
|
+
return !0;
|
|
1162
|
+
let n, r, o;
|
|
1163
|
+
if (e && t && typeof e == "object") {
|
|
1164
|
+
if (Array.isArray(e)) {
|
|
1165
|
+
if (n = e.length, n !== t.length) return !1;
|
|
1166
|
+
for (r = n; r-- !== 0; )
|
|
1167
|
+
if (!Se(e[r], t[r]))
|
|
1168
|
+
return !1;
|
|
1169
|
+
return !0;
|
|
1170
|
+
}
|
|
1171
|
+
if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
|
|
1172
|
+
return !1;
|
|
1173
|
+
for (r = n; r-- !== 0; )
|
|
1174
|
+
if (!{}.hasOwnProperty.call(t, o[r]))
|
|
1175
|
+
return !1;
|
|
1176
|
+
for (r = n; r-- !== 0; ) {
|
|
1177
|
+
const s = o[r];
|
|
1178
|
+
if (!(s === "_owner" && e.$$typeof) && !Se(e[s], t[s]))
|
|
1179
|
+
return !1;
|
|
1180
|
+
}
|
|
1181
|
+
return !0;
|
|
1182
|
+
}
|
|
1183
|
+
return e !== e && t !== t;
|
|
1184
|
+
}
|
|
1185
|
+
function It(e) {
|
|
1186
|
+
return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
|
|
1187
|
+
}
|
|
1188
|
+
function tt(e, t) {
|
|
1189
|
+
const n = It(e);
|
|
1190
|
+
return Math.round(t * n) / n;
|
|
1191
|
+
}
|
|
1192
|
+
function ke(e) {
|
|
1193
|
+
const t = m.useRef(e);
|
|
1194
|
+
return be(() => {
|
|
1195
|
+
t.current = e;
|
|
1196
|
+
}), t;
|
|
1197
|
+
}
|
|
1198
|
+
function cr(e) {
|
|
1199
|
+
e === void 0 && (e = {});
|
|
1200
|
+
const {
|
|
1201
|
+
placement: t = "bottom",
|
|
1202
|
+
strategy: n = "absolute",
|
|
1203
|
+
middleware: r = [],
|
|
1204
|
+
platform: o,
|
|
1205
|
+
elements: {
|
|
1206
|
+
reference: s,
|
|
1207
|
+
floating: i
|
|
1208
|
+
} = {},
|
|
1209
|
+
transform: c = !0,
|
|
1210
|
+
whileElementsMounted: l,
|
|
1211
|
+
open: a
|
|
1212
|
+
} = e, [u, g] = m.useState({
|
|
1213
|
+
x: 0,
|
|
1214
|
+
y: 0,
|
|
1215
|
+
strategy: n,
|
|
1216
|
+
placement: t,
|
|
1217
|
+
middlewareData: {},
|
|
1218
|
+
isPositioned: !1
|
|
1219
|
+
}), [h, d] = m.useState(r);
|
|
1220
|
+
Se(h, r) || d(r);
|
|
1221
|
+
const [x, f] = m.useState(null), [y, R] = m.useState(null), E = m.useCallback((p) => {
|
|
1222
|
+
p !== D.current && (D.current = p, f(p));
|
|
1223
|
+
}, []), w = m.useCallback((p) => {
|
|
1224
|
+
p !== M.current && (M.current = p, R(p));
|
|
1225
|
+
}, []), T = s || x, C = i || y, D = m.useRef(null), M = m.useRef(null), W = m.useRef(u), L = l != null, N = ke(l), B = ke(o), $ = ke(a), F = m.useCallback(() => {
|
|
1226
|
+
if (!D.current || !M.current)
|
|
1227
|
+
return;
|
|
1228
|
+
const p = {
|
|
1229
|
+
placement: t,
|
|
1230
|
+
strategy: n,
|
|
1231
|
+
middleware: h
|
|
1232
|
+
};
|
|
1233
|
+
B.current && (p.platform = B.current), sr(D.current, M.current, p).then((v) => {
|
|
1234
|
+
const P = {
|
|
1235
|
+
...v,
|
|
1236
|
+
// The floating element's position may be recomputed while it's closed
|
|
1237
|
+
// but still mounted (such as when transitioning out). To ensure
|
|
1238
|
+
// `isPositioned` will be `false` initially on the next open, avoid
|
|
1239
|
+
// setting it to `true` when `open === false` (must be specified).
|
|
1240
|
+
isPositioned: $.current !== !1
|
|
1241
|
+
};
|
|
1242
|
+
I.current && !Se(W.current, P) && (W.current = P, ht.flushSync(() => {
|
|
1243
|
+
g(P);
|
|
1244
|
+
}));
|
|
1245
|
+
});
|
|
1246
|
+
}, [h, t, n, B, $]);
|
|
1247
|
+
be(() => {
|
|
1248
|
+
a === !1 && W.current.isPositioned && (W.current.isPositioned = !1, g((p) => ({
|
|
1249
|
+
...p,
|
|
1250
|
+
isPositioned: !1
|
|
1251
|
+
})));
|
|
1252
|
+
}, [a]);
|
|
1253
|
+
const I = m.useRef(!1);
|
|
1254
|
+
be(() => (I.current = !0, () => {
|
|
1255
|
+
I.current = !1;
|
|
1256
|
+
}), []), be(() => {
|
|
1257
|
+
if (T && (D.current = T), C && (M.current = C), T && C) {
|
|
1258
|
+
if (N.current)
|
|
1259
|
+
return N.current(T, C, F);
|
|
1260
|
+
F();
|
|
1261
|
+
}
|
|
1262
|
+
}, [T, C, F, N, L]);
|
|
1263
|
+
const S = m.useMemo(() => ({
|
|
1264
|
+
reference: D,
|
|
1265
|
+
floating: M,
|
|
1266
|
+
setReference: E,
|
|
1267
|
+
setFloating: w
|
|
1268
|
+
}), [E, w]), A = m.useMemo(() => ({
|
|
1269
|
+
reference: T,
|
|
1270
|
+
floating: C
|
|
1271
|
+
}), [T, C]), b = m.useMemo(() => {
|
|
1272
|
+
const p = {
|
|
1273
|
+
position: n,
|
|
1274
|
+
left: 0,
|
|
1275
|
+
top: 0
|
|
1276
|
+
};
|
|
1277
|
+
if (!A.floating)
|
|
1278
|
+
return p;
|
|
1279
|
+
const v = tt(A.floating, u.x), P = tt(A.floating, u.y);
|
|
1280
|
+
return c ? {
|
|
1281
|
+
...p,
|
|
1282
|
+
transform: "translate(" + v + "px, " + P + "px)",
|
|
1283
|
+
...It(A.floating) >= 1.5 && {
|
|
1284
|
+
willChange: "transform"
|
|
1285
|
+
}
|
|
1286
|
+
} : {
|
|
1287
|
+
position: n,
|
|
1288
|
+
left: v,
|
|
1289
|
+
top: P
|
|
1290
|
+
};
|
|
1291
|
+
}, [n, c, A.floating, u.x, u.y]);
|
|
1292
|
+
return m.useMemo(() => ({
|
|
1293
|
+
...u,
|
|
1294
|
+
update: F,
|
|
1295
|
+
refs: S,
|
|
1296
|
+
elements: A,
|
|
1297
|
+
floatingStyles: b
|
|
1298
|
+
}), [u, F, S, A, b]);
|
|
1299
|
+
}
|
|
1300
|
+
const lr = (e, t) => ({
|
|
1301
|
+
...rr(e),
|
|
1302
|
+
options: [e, t]
|
|
1303
|
+
}), ar = (e, t) => ({
|
|
1304
|
+
...or(e),
|
|
1305
|
+
options: [e, t]
|
|
1306
|
+
}), ur = (e, t) => ({
|
|
1307
|
+
...ir(e),
|
|
1308
|
+
options: [e, t]
|
|
1309
|
+
}), kt = {
|
|
1310
|
+
...m
|
|
1311
|
+
}, fr = kt.useInsertionEffect, dr = fr || ((e) => e());
|
|
1312
|
+
function Z(e) {
|
|
1313
|
+
const t = m.useRef(() => {
|
|
1314
|
+
if (process.env.NODE_ENV !== "production")
|
|
1315
|
+
throw new Error("Cannot call an event handler while rendering.");
|
|
1316
|
+
});
|
|
1317
|
+
return dr(() => {
|
|
1318
|
+
t.current = e;
|
|
1319
|
+
}), m.useCallback(function() {
|
|
1320
|
+
for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
|
|
1321
|
+
r[o] = arguments[o];
|
|
1322
|
+
return t.current == null ? void 0 : t.current(...r);
|
|
1323
|
+
}, []);
|
|
1324
|
+
}
|
|
1325
|
+
var q = typeof document < "u" ? gt : pt;
|
|
1326
|
+
let nt = !1, mr = 0;
|
|
1327
|
+
const rt = () => (
|
|
1328
|
+
// Ensure the id is unique with multiple independent versions of Floating UI
|
|
1329
|
+
// on <React 18
|
|
1330
|
+
"floating-ui-" + Math.random().toString(36).slice(2, 6) + mr++
|
|
1331
|
+
);
|
|
1332
|
+
function gr() {
|
|
1333
|
+
const [e, t] = m.useState(() => nt ? rt() : void 0);
|
|
1334
|
+
return q(() => {
|
|
1335
|
+
e == null && t(rt());
|
|
1336
|
+
}, []), m.useEffect(() => {
|
|
1337
|
+
nt = !0;
|
|
1338
|
+
}, []), e;
|
|
1339
|
+
}
|
|
1340
|
+
const pr = kt.useId, Ft = pr || gr;
|
|
1341
|
+
let Ye;
|
|
1342
|
+
process.env.NODE_ENV !== "production" && (Ye = /* @__PURE__ */ new Set());
|
|
1343
|
+
function hr() {
|
|
1344
|
+
for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
|
|
1345
|
+
n[r] = arguments[r];
|
|
1346
|
+
const o = "Floating UI: " + n.join(" ");
|
|
1347
|
+
if (!((e = Ye) != null && e.has(o))) {
|
|
1348
|
+
var s;
|
|
1349
|
+
(s = Ye) == null || s.add(o), console.error(o);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
function vr() {
|
|
1353
|
+
const e = /* @__PURE__ */ new Map();
|
|
1354
|
+
return {
|
|
1355
|
+
emit(t, n) {
|
|
1356
|
+
var r;
|
|
1357
|
+
(r = e.get(t)) == null || r.forEach((o) => o(n));
|
|
1358
|
+
},
|
|
1359
|
+
on(t, n) {
|
|
1360
|
+
e.set(t, [...e.get(t) || [], n]);
|
|
1361
|
+
},
|
|
1362
|
+
off(t, n) {
|
|
1363
|
+
var r;
|
|
1364
|
+
e.set(t, ((r = e.get(t)) == null ? void 0 : r.filter((o) => o !== n)) || []);
|
|
1365
|
+
}
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
const br = /* @__PURE__ */ m.createContext(null), yr = /* @__PURE__ */ m.createContext(null), Nt = () => {
|
|
1369
|
+
var e;
|
|
1370
|
+
return ((e = m.useContext(br)) == null ? void 0 : e.id) || null;
|
|
1371
|
+
}, ze = () => m.useContext(yr);
|
|
1372
|
+
function De(e) {
|
|
1373
|
+
return "data-floating-ui-" + e;
|
|
1374
|
+
}
|
|
1375
|
+
function j(e) {
|
|
1376
|
+
e.current !== -1 && (clearTimeout(e.current), e.current = -1);
|
|
1377
|
+
}
|
|
1378
|
+
function Fe(e) {
|
|
1379
|
+
const t = Xt(e);
|
|
1380
|
+
return q(() => {
|
|
1381
|
+
t.current = e;
|
|
1382
|
+
}), t;
|
|
1383
|
+
}
|
|
1384
|
+
const ot = /* @__PURE__ */ De("safe-polygon");
|
|
1385
|
+
function Ne(e, t, n) {
|
|
1386
|
+
return n && !fe(n) ? 0 : typeof e == "number" ? e : e == null ? void 0 : e[t];
|
|
1387
|
+
}
|
|
1388
|
+
function wr(e, t) {
|
|
1389
|
+
t === void 0 && (t = {});
|
|
1390
|
+
const {
|
|
1391
|
+
open: n,
|
|
1392
|
+
onOpenChange: r,
|
|
1393
|
+
dataRef: o,
|
|
1394
|
+
events: s,
|
|
1395
|
+
elements: i
|
|
1396
|
+
} = e, {
|
|
1397
|
+
enabled: c = !0,
|
|
1398
|
+
delay: l = 0,
|
|
1399
|
+
handleClose: a = null,
|
|
1400
|
+
mouseOnly: u = !1,
|
|
1401
|
+
restMs: g = 0,
|
|
1402
|
+
move: h = !0
|
|
1403
|
+
} = t, d = ze(), x = Nt(), f = Fe(a), y = Fe(l), R = Fe(n), E = m.useRef(), w = m.useRef(-1), T = m.useRef(), C = m.useRef(-1), D = m.useRef(!0), M = m.useRef(!1), W = m.useRef(() => {
|
|
1404
|
+
}), L = m.useRef(!1), N = m.useCallback(() => {
|
|
1405
|
+
var b;
|
|
1406
|
+
const p = (b = o.current.openEvent) == null ? void 0 : b.type;
|
|
1407
|
+
return (p == null ? void 0 : p.includes("mouse")) && p !== "mousedown";
|
|
1408
|
+
}, [o]);
|
|
1409
|
+
m.useEffect(() => {
|
|
1410
|
+
if (!c) return;
|
|
1411
|
+
function b(p) {
|
|
1412
|
+
let {
|
|
1413
|
+
open: v
|
|
1414
|
+
} = p;
|
|
1415
|
+
v || (j(w), j(C), D.current = !0, L.current = !1);
|
|
1416
|
+
}
|
|
1417
|
+
return s.on("openchange", b), () => {
|
|
1418
|
+
s.off("openchange", b);
|
|
1419
|
+
};
|
|
1420
|
+
}, [c, s]), m.useEffect(() => {
|
|
1421
|
+
if (!c || !f.current || !n) return;
|
|
1422
|
+
function b(v) {
|
|
1423
|
+
N() && r(!1, v, "hover");
|
|
1424
|
+
}
|
|
1425
|
+
const p = J(i.floating).documentElement;
|
|
1426
|
+
return p.addEventListener("mouseleave", b), () => {
|
|
1427
|
+
p.removeEventListener("mouseleave", b);
|
|
1428
|
+
};
|
|
1429
|
+
}, [i.floating, n, r, c, f, N]);
|
|
1430
|
+
const B = m.useCallback(function(b, p, v) {
|
|
1431
|
+
p === void 0 && (p = !0), v === void 0 && (v = "hover");
|
|
1432
|
+
const P = Ne(y.current, "close", E.current);
|
|
1433
|
+
P && !T.current ? (j(w), w.current = window.setTimeout(() => r(!1, b, v), P)) : p && (j(w), r(!1, b, v));
|
|
1434
|
+
}, [y, r]), $ = Z(() => {
|
|
1435
|
+
W.current(), T.current = void 0;
|
|
1436
|
+
}), F = Z(() => {
|
|
1437
|
+
if (M.current) {
|
|
1438
|
+
const b = J(i.floating).body;
|
|
1439
|
+
b.style.pointerEvents = "", b.removeAttribute(ot), M.current = !1;
|
|
1440
|
+
}
|
|
1441
|
+
}), I = Z(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1);
|
|
1442
|
+
m.useEffect(() => {
|
|
1443
|
+
if (!c) return;
|
|
1444
|
+
function b(O) {
|
|
1445
|
+
if (j(w), D.current = !1, u && !fe(E.current) || g > 0 && !Ne(y.current, "open"))
|
|
1446
|
+
return;
|
|
1447
|
+
const V = Ne(y.current, "open", E.current);
|
|
1448
|
+
V ? w.current = window.setTimeout(() => {
|
|
1449
|
+
R.current || r(!0, O, "hover");
|
|
1450
|
+
}, V) : n || r(!0, O, "hover");
|
|
1451
|
+
}
|
|
1452
|
+
function p(O) {
|
|
1453
|
+
if (I()) return;
|
|
1454
|
+
W.current();
|
|
1455
|
+
const V = J(i.floating);
|
|
1456
|
+
if (j(C), L.current = !1, f.current && o.current.floatingContext) {
|
|
1457
|
+
n || j(w), T.current = f.current({
|
|
1458
|
+
...o.current.floatingContext,
|
|
1459
|
+
tree: d,
|
|
1460
|
+
x: O.clientX,
|
|
1461
|
+
y: O.clientY,
|
|
1462
|
+
onClose() {
|
|
1463
|
+
F(), $(), I() || B(O, !0, "safe-polygon");
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
const he = T.current;
|
|
1467
|
+
V.addEventListener("mousemove", he), W.current = () => {
|
|
1468
|
+
V.removeEventListener("mousemove", he);
|
|
1469
|
+
};
|
|
1470
|
+
return;
|
|
1471
|
+
}
|
|
1472
|
+
(E.current === "touch" ? !ye(i.floating, O.relatedTarget) : !0) && B(O);
|
|
1473
|
+
}
|
|
1474
|
+
function v(O) {
|
|
1475
|
+
I() || o.current.floatingContext && (f.current == null || f.current({
|
|
1476
|
+
...o.current.floatingContext,
|
|
1477
|
+
tree: d,
|
|
1478
|
+
x: O.clientX,
|
|
1479
|
+
y: O.clientY,
|
|
1480
|
+
onClose() {
|
|
1481
|
+
F(), $(), I() || B(O);
|
|
1482
|
+
}
|
|
1483
|
+
})(O));
|
|
1484
|
+
}
|
|
1485
|
+
if (k(i.domReference)) {
|
|
1486
|
+
var P;
|
|
1487
|
+
const O = i.domReference;
|
|
1488
|
+
return n && O.addEventListener("mouseleave", v), (P = i.floating) == null || P.addEventListener("mouseleave", v), h && O.addEventListener("mousemove", b, {
|
|
1489
|
+
once: !0
|
|
1490
|
+
}), O.addEventListener("mouseenter", b), O.addEventListener("mouseleave", p), () => {
|
|
1491
|
+
var V;
|
|
1492
|
+
n && O.removeEventListener("mouseleave", v), (V = i.floating) == null || V.removeEventListener("mouseleave", v), h && O.removeEventListener("mousemove", b), O.removeEventListener("mouseenter", b), O.removeEventListener("mouseleave", p);
|
|
1493
|
+
};
|
|
1494
|
+
}
|
|
1495
|
+
}, [i, c, e, u, g, h, B, $, F, r, n, R, d, y, f, o, I]), q(() => {
|
|
1496
|
+
var b;
|
|
1497
|
+
if (c && n && (b = f.current) != null && b.__options.blockPointerEvents && N()) {
|
|
1498
|
+
M.current = !0;
|
|
1499
|
+
const v = i.floating;
|
|
1500
|
+
if (k(i.domReference) && v) {
|
|
1501
|
+
var p;
|
|
1502
|
+
const P = J(i.floating).body;
|
|
1503
|
+
P.setAttribute(ot, "");
|
|
1504
|
+
const O = i.domReference, V = d == null || (p = d.nodesRef.current.find((le) => le.id === x)) == null || (p = p.context) == null ? void 0 : p.elements.floating;
|
|
1505
|
+
return V && (V.style.pointerEvents = ""), P.style.pointerEvents = "none", O.style.pointerEvents = "auto", v.style.pointerEvents = "auto", () => {
|
|
1506
|
+
P.style.pointerEvents = "", O.style.pointerEvents = "", v.style.pointerEvents = "";
|
|
1507
|
+
};
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
}, [c, n, x, i, d, f, N]), q(() => {
|
|
1511
|
+
n || (E.current = void 0, L.current = !1, $(), F());
|
|
1512
|
+
}, [n, $, F]), m.useEffect(() => () => {
|
|
1513
|
+
$(), j(w), j(C), F();
|
|
1514
|
+
}, [c, i.domReference, $, F]);
|
|
1515
|
+
const S = m.useMemo(() => {
|
|
1516
|
+
function b(p) {
|
|
1517
|
+
E.current = p.pointerType;
|
|
1518
|
+
}
|
|
1519
|
+
return {
|
|
1520
|
+
onPointerDown: b,
|
|
1521
|
+
onPointerEnter: b,
|
|
1522
|
+
onMouseMove(p) {
|
|
1523
|
+
const {
|
|
1524
|
+
nativeEvent: v
|
|
1525
|
+
} = p;
|
|
1526
|
+
function P() {
|
|
1527
|
+
!D.current && !R.current && r(!0, v, "hover");
|
|
1528
|
+
}
|
|
1529
|
+
u && !fe(E.current) || n || g === 0 || L.current && p.movementX ** 2 + p.movementY ** 2 < 2 || (j(C), E.current === "touch" ? P() : (L.current = !0, C.current = window.setTimeout(P, g)));
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1532
|
+
}, [u, r, n, R, g]), A = m.useMemo(() => ({
|
|
1533
|
+
onMouseEnter() {
|
|
1534
|
+
j(w);
|
|
1535
|
+
},
|
|
1536
|
+
onMouseLeave(b) {
|
|
1537
|
+
I() || B(b.nativeEvent, !1);
|
|
1538
|
+
}
|
|
1539
|
+
}), [B, I]);
|
|
1540
|
+
return m.useMemo(() => c ? {
|
|
1541
|
+
reference: S,
|
|
1542
|
+
floating: A
|
|
1543
|
+
} : {}, [c, S, A]);
|
|
1544
|
+
}
|
|
1545
|
+
function Be(e, t) {
|
|
1546
|
+
let n = e.filter((o) => {
|
|
1547
|
+
var s;
|
|
1548
|
+
return o.parentId === t && ((s = o.context) == null ? void 0 : s.open);
|
|
1549
|
+
}), r = n;
|
|
1550
|
+
for (; r.length; )
|
|
1551
|
+
r = e.filter((o) => {
|
|
1552
|
+
var s;
|
|
1553
|
+
return (s = r) == null ? void 0 : s.some((i) => {
|
|
1554
|
+
var c;
|
|
1555
|
+
return o.parentId === i.id && ((c = o.context) == null ? void 0 : c.open);
|
|
1556
|
+
});
|
|
1557
|
+
}), n = n.concat(r);
|
|
1558
|
+
return n;
|
|
1559
|
+
}
|
|
1560
|
+
const Bt = () => ({
|
|
1561
|
+
getShadowRoot: !0,
|
|
1562
|
+
displayCheck: (
|
|
1563
|
+
// JSDOM does not support the `tabbable` library. To solve this we can
|
|
1564
|
+
// check if `ResizeObserver` is a real function (not polyfilled), which
|
|
1565
|
+
// determines if the current environment is JSDOM-like.
|
|
1566
|
+
typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
|
|
1567
|
+
)
|
|
1568
|
+
});
|
|
1569
|
+
function Wt(e, t) {
|
|
1570
|
+
const n = St(e, Bt());
|
|
1571
|
+
t === "prev" && n.reverse();
|
|
1572
|
+
const r = n.indexOf(nn(J(e)));
|
|
1573
|
+
return n.slice(r + 1)[0];
|
|
1574
|
+
}
|
|
1575
|
+
function xr(e) {
|
|
1576
|
+
return Wt(J(e).body, "next") || e;
|
|
1577
|
+
}
|
|
1578
|
+
function Rr(e) {
|
|
1579
|
+
return Wt(J(e).body, "prev") || e;
|
|
1580
|
+
}
|
|
1581
|
+
function We(e, t) {
|
|
1582
|
+
const n = t || e.currentTarget, r = e.relatedTarget;
|
|
1583
|
+
return !r || !ye(n, r);
|
|
1584
|
+
}
|
|
1585
|
+
function Er(e) {
|
|
1586
|
+
St(e, Bt()).forEach((n) => {
|
|
1587
|
+
n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
function it(e) {
|
|
1591
|
+
e.querySelectorAll("[data-tabindex]").forEach((n) => {
|
|
1592
|
+
const r = n.dataset.tabindex;
|
|
1593
|
+
delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
|
|
1594
|
+
});
|
|
1595
|
+
}
|
|
1596
|
+
const $t = {
|
|
1597
|
+
border: 0,
|
|
1598
|
+
clip: "rect(0 0 0 0)",
|
|
1599
|
+
height: "1px",
|
|
1600
|
+
margin: "-1px",
|
|
1601
|
+
overflow: "hidden",
|
|
1602
|
+
padding: 0,
|
|
1603
|
+
position: "fixed",
|
|
1604
|
+
whiteSpace: "nowrap",
|
|
1605
|
+
width: "1px",
|
|
1606
|
+
top: 0,
|
|
1607
|
+
left: 0
|
|
1608
|
+
}, st = /* @__PURE__ */ m.forwardRef(function(t, n) {
|
|
1609
|
+
const [r, o] = m.useState();
|
|
1610
|
+
q(() => {
|
|
1611
|
+
rn() && o("button");
|
|
1612
|
+
}, []);
|
|
1613
|
+
const s = {
|
|
1614
|
+
ref: n,
|
|
1615
|
+
tabIndex: 0,
|
|
1616
|
+
// Role is only for VoiceOver
|
|
1617
|
+
role: r,
|
|
1618
|
+
"aria-hidden": r ? void 0 : !0,
|
|
1619
|
+
[De("focus-guard")]: "",
|
|
1620
|
+
style: $t
|
|
1621
|
+
};
|
|
1622
|
+
return /* @__PURE__ */ ne("span", {
|
|
1623
|
+
...t,
|
|
1624
|
+
...s
|
|
1625
|
+
});
|
|
1626
|
+
}), Vt = /* @__PURE__ */ m.createContext(null), ct = /* @__PURE__ */ De("portal");
|
|
1627
|
+
function Cr(e) {
|
|
1628
|
+
e === void 0 && (e = {});
|
|
1629
|
+
const {
|
|
1630
|
+
id: t,
|
|
1631
|
+
root: n
|
|
1632
|
+
} = e, r = Ft(), o = Tr(), [s, i] = m.useState(null), c = m.useRef(null);
|
|
1633
|
+
return q(() => () => {
|
|
1634
|
+
s == null || s.remove(), queueMicrotask(() => {
|
|
1635
|
+
c.current = null;
|
|
1636
|
+
});
|
|
1637
|
+
}, [s]), q(() => {
|
|
1638
|
+
if (!r || c.current) return;
|
|
1639
|
+
const l = t ? document.getElementById(t) : null;
|
|
1640
|
+
if (!l) return;
|
|
1641
|
+
const a = document.createElement("div");
|
|
1642
|
+
a.id = r, a.setAttribute(ct, ""), l.appendChild(a), c.current = a, i(a);
|
|
1643
|
+
}, [t, r]), q(() => {
|
|
1644
|
+
if (n === null || !r || c.current) return;
|
|
1645
|
+
let l = n || (o == null ? void 0 : o.portalNode);
|
|
1646
|
+
l && !k(l) && (l = l.current), l = l || document.body;
|
|
1647
|
+
let a = null;
|
|
1648
|
+
t && (a = document.createElement("div"), a.id = t, l.appendChild(a));
|
|
1649
|
+
const u = document.createElement("div");
|
|
1650
|
+
u.id = r, u.setAttribute(ct, ""), l = a || l, l.appendChild(u), c.current = u, i(u);
|
|
1651
|
+
}, [t, n, r, o]), s;
|
|
1652
|
+
}
|
|
1653
|
+
function Sr(e) {
|
|
1654
|
+
const {
|
|
1655
|
+
children: t,
|
|
1656
|
+
id: n,
|
|
1657
|
+
root: r,
|
|
1658
|
+
preserveTabOrder: o = !0
|
|
1659
|
+
} = e, s = Cr({
|
|
1660
|
+
id: n,
|
|
1661
|
+
root: r
|
|
1662
|
+
}), [i, c] = m.useState(null), l = m.useRef(null), a = m.useRef(null), u = m.useRef(null), g = m.useRef(null), h = i == null ? void 0 : i.modal, d = i == null ? void 0 : i.open, x = (
|
|
1663
|
+
// The FocusManager and therefore floating element are currently open/
|
|
1664
|
+
// rendered.
|
|
1665
|
+
!!i && // Guards are only for non-modal focus management.
|
|
1666
|
+
!i.modal && // Don't render if unmount is transitioning.
|
|
1667
|
+
i.open && o && !!(r || s)
|
|
1668
|
+
);
|
|
1669
|
+
return m.useEffect(() => {
|
|
1670
|
+
if (!s || !o || h)
|
|
1671
|
+
return;
|
|
1672
|
+
function f(y) {
|
|
1673
|
+
s && We(y) && (y.type === "focusin" ? it : Er)(s);
|
|
1674
|
+
}
|
|
1675
|
+
return s.addEventListener("focusin", f, !0), s.addEventListener("focusout", f, !0), () => {
|
|
1676
|
+
s.removeEventListener("focusin", f, !0), s.removeEventListener("focusout", f, !0);
|
|
1677
|
+
};
|
|
1678
|
+
}, [s, o, h]), m.useEffect(() => {
|
|
1679
|
+
s && (d || it(s));
|
|
1680
|
+
}, [d, s]), /* @__PURE__ */ mt(Vt.Provider, {
|
|
1681
|
+
value: m.useMemo(() => ({
|
|
1682
|
+
preserveTabOrder: o,
|
|
1683
|
+
beforeOutsideRef: l,
|
|
1684
|
+
afterOutsideRef: a,
|
|
1685
|
+
beforeInsideRef: u,
|
|
1686
|
+
afterInsideRef: g,
|
|
1687
|
+
portalNode: s,
|
|
1688
|
+
setFocusManagerState: c
|
|
1689
|
+
}), [o, s]),
|
|
1690
|
+
children: [x && s && /* @__PURE__ */ ne(st, {
|
|
1691
|
+
"data-type": "outside",
|
|
1692
|
+
ref: l,
|
|
1693
|
+
onFocus: (f) => {
|
|
1694
|
+
if (We(f, s)) {
|
|
1695
|
+
var y;
|
|
1696
|
+
(y = u.current) == null || y.focus();
|
|
1697
|
+
} else {
|
|
1698
|
+
const R = i ? i.domReference : null, E = Rr(R);
|
|
1699
|
+
E == null || E.focus();
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
}), x && s && /* @__PURE__ */ ne("span", {
|
|
1703
|
+
"aria-owns": s.id,
|
|
1704
|
+
style: $t
|
|
1705
|
+
}), s && /* @__PURE__ */ ht.createPortal(t, s), x && s && /* @__PURE__ */ ne(st, {
|
|
1706
|
+
"data-type": "outside",
|
|
1707
|
+
ref: a,
|
|
1708
|
+
onFocus: (f) => {
|
|
1709
|
+
if (We(f, s)) {
|
|
1710
|
+
var y;
|
|
1711
|
+
(y = g.current) == null || y.focus();
|
|
1712
|
+
} else {
|
|
1713
|
+
const R = i ? i.domReference : null, E = xr(R);
|
|
1714
|
+
E == null || E.focus(), i != null && i.closeOnFocusOut && (i == null || i.onOpenChange(!1, f.nativeEvent, "focus-out"));
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
})]
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
const Tr = () => m.useContext(Vt), Or = "data-floating-ui-focusable";
|
|
1721
|
+
function lt(e) {
|
|
1722
|
+
return _(e.target) && e.target.tagName === "BUTTON";
|
|
1723
|
+
}
|
|
1724
|
+
function Pr(e) {
|
|
1725
|
+
return _(e.target) && e.target.tagName === "A";
|
|
1726
|
+
}
|
|
1727
|
+
function at(e) {
|
|
1728
|
+
return ln(e);
|
|
1729
|
+
}
|
|
1730
|
+
function Ar(e, t) {
|
|
1731
|
+
t === void 0 && (t = {});
|
|
1732
|
+
const {
|
|
1733
|
+
open: n,
|
|
1734
|
+
onOpenChange: r,
|
|
1735
|
+
dataRef: o,
|
|
1736
|
+
elements: {
|
|
1737
|
+
domReference: s
|
|
1738
|
+
}
|
|
1739
|
+
} = e, {
|
|
1740
|
+
enabled: i = !0,
|
|
1741
|
+
event: c = "click",
|
|
1742
|
+
toggle: l = !0,
|
|
1743
|
+
ignoreMouse: a = !1,
|
|
1744
|
+
keyboardHandlers: u = !0,
|
|
1745
|
+
stickIfOpen: g = !0
|
|
1746
|
+
} = t, h = m.useRef(), d = m.useRef(!1), x = m.useMemo(() => ({
|
|
1747
|
+
onPointerDown(f) {
|
|
1748
|
+
h.current = f.pointerType;
|
|
1749
|
+
},
|
|
1750
|
+
onMouseDown(f) {
|
|
1751
|
+
const y = h.current;
|
|
1752
|
+
f.button === 0 && c !== "click" && (fe(y, !0) && a || (n && l && (!(o.current.openEvent && g) || o.current.openEvent.type === "mousedown") ? r(!1, f.nativeEvent, "click") : (f.preventDefault(), r(!0, f.nativeEvent, "click"))));
|
|
1753
|
+
},
|
|
1754
|
+
onClick(f) {
|
|
1755
|
+
const y = h.current;
|
|
1756
|
+
if (c === "mousedown" && h.current) {
|
|
1757
|
+
h.current = void 0;
|
|
1758
|
+
return;
|
|
1759
|
+
}
|
|
1760
|
+
fe(y, !0) && a || (n && l && (!(o.current.openEvent && g) || o.current.openEvent.type === "click") ? r(!1, f.nativeEvent, "click") : r(!0, f.nativeEvent, "click"));
|
|
1761
|
+
},
|
|
1762
|
+
onKeyDown(f) {
|
|
1763
|
+
h.current = void 0, !(f.defaultPrevented || !u || lt(f)) && (f.key === " " && !at(s) && (f.preventDefault(), d.current = !0), !Pr(f) && f.key === "Enter" && r(!(n && l), f.nativeEvent, "click"));
|
|
1764
|
+
},
|
|
1765
|
+
onKeyUp(f) {
|
|
1766
|
+
f.defaultPrevented || !u || lt(f) || at(s) || f.key === " " && d.current && (d.current = !1, r(!(n && l), f.nativeEvent, "click"));
|
|
1767
|
+
}
|
|
1768
|
+
}), [o, s, c, a, u, r, n, g, l]);
|
|
1769
|
+
return m.useMemo(() => i ? {
|
|
1770
|
+
reference: x
|
|
1771
|
+
} : {}, [i, x]);
|
|
1772
|
+
}
|
|
1773
|
+
const Mr = {
|
|
1774
|
+
pointerdown: "onPointerDown",
|
|
1775
|
+
mousedown: "onMouseDown",
|
|
1776
|
+
click: "onClick"
|
|
1777
|
+
}, Dr = {
|
|
1778
|
+
pointerdown: "onPointerDownCapture",
|
|
1779
|
+
mousedown: "onMouseDownCapture",
|
|
1780
|
+
click: "onClickCapture"
|
|
1781
|
+
}, ut = (e) => {
|
|
1782
|
+
var t, n;
|
|
1783
|
+
return {
|
|
1784
|
+
escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1,
|
|
1785
|
+
outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0
|
|
1786
|
+
};
|
|
1787
|
+
};
|
|
1788
|
+
function Lr(e, t) {
|
|
1789
|
+
t === void 0 && (t = {});
|
|
1790
|
+
const {
|
|
1791
|
+
open: n,
|
|
1792
|
+
onOpenChange: r,
|
|
1793
|
+
elements: o,
|
|
1794
|
+
dataRef: s
|
|
1795
|
+
} = e, {
|
|
1796
|
+
enabled: i = !0,
|
|
1797
|
+
escapeKey: c = !0,
|
|
1798
|
+
outsidePress: l = !0,
|
|
1799
|
+
outsidePressEvent: a = "pointerdown",
|
|
1800
|
+
referencePress: u = !1,
|
|
1801
|
+
referencePressEvent: g = "pointerdown",
|
|
1802
|
+
ancestorScroll: h = !1,
|
|
1803
|
+
bubbles: d,
|
|
1804
|
+
capture: x
|
|
1805
|
+
} = t, f = ze(), y = Z(typeof l == "function" ? l : () => !1), R = typeof l == "function" ? y : l, E = m.useRef(!1), w = m.useRef(!1), {
|
|
1806
|
+
escapeKey: T,
|
|
1807
|
+
outsidePress: C
|
|
1808
|
+
} = ut(d), {
|
|
1809
|
+
escapeKey: D,
|
|
1810
|
+
outsidePress: M
|
|
1811
|
+
} = ut(x), W = m.useRef(!1), L = Z((S) => {
|
|
1812
|
+
var A;
|
|
1813
|
+
if (!n || !i || !c || S.key !== "Escape" || W.current)
|
|
1814
|
+
return;
|
|
1815
|
+
const b = (A = s.current.floatingContext) == null ? void 0 : A.nodeId, p = f ? Be(f.nodesRef.current, b) : [];
|
|
1816
|
+
if (!T && (S.stopPropagation(), p.length > 0)) {
|
|
1817
|
+
let v = !0;
|
|
1818
|
+
if (p.forEach((P) => {
|
|
1819
|
+
var O;
|
|
1820
|
+
if ((O = P.context) != null && O.open && !P.context.dataRef.current.__escapeKeyBubbles) {
|
|
1821
|
+
v = !1;
|
|
1822
|
+
return;
|
|
1823
|
+
}
|
|
1824
|
+
}), !v)
|
|
1825
|
+
return;
|
|
1826
|
+
}
|
|
1827
|
+
r(!1, on(S) ? S.nativeEvent : S, "escape-key");
|
|
1828
|
+
}), N = Z((S) => {
|
|
1829
|
+
var A;
|
|
1830
|
+
const b = () => {
|
|
1831
|
+
var p;
|
|
1832
|
+
L(S), (p = ue(S)) == null || p.removeEventListener("keydown", b);
|
|
1833
|
+
};
|
|
1834
|
+
(A = ue(S)) == null || A.addEventListener("keydown", b);
|
|
1835
|
+
}), B = Z((S) => {
|
|
1836
|
+
var A;
|
|
1837
|
+
const b = E.current;
|
|
1838
|
+
E.current = !1;
|
|
1839
|
+
const p = w.current;
|
|
1840
|
+
if (w.current = !1, a === "click" && p || b || typeof R == "function" && !R(S))
|
|
1841
|
+
return;
|
|
1842
|
+
const v = ue(S), P = "[" + De("inert") + "]", O = J(o.floating).querySelectorAll(P);
|
|
1843
|
+
let V = k(v) ? v : null;
|
|
1844
|
+
for (; V && !Q(V); ) {
|
|
1845
|
+
const H = ee(V);
|
|
1846
|
+
if (Q(H) || !k(H))
|
|
1847
|
+
break;
|
|
1848
|
+
V = H;
|
|
1849
|
+
}
|
|
1850
|
+
if (O.length && k(v) && !sn(v) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
|
|
1851
|
+
!ye(v, o.floating) && // If the target root element contains none of the markers, then the
|
|
1852
|
+
// element was injected after the floating element rendered.
|
|
1853
|
+
Array.from(O).every((H) => !ye(V, H)))
|
|
1854
|
+
return;
|
|
1855
|
+
if (_(v) && I) {
|
|
1856
|
+
const H = Q(v), G = U(v), ae = /auto|scroll/, _t = H || ae.test(G.overflowX), Ht = H || ae.test(G.overflowY), Kt = _t && v.clientWidth > 0 && v.scrollWidth > v.clientWidth, Yt = Ht && v.clientHeight > 0 && v.scrollHeight > v.clientHeight, Ut = G.direction === "rtl", jt = Yt && (Ut ? S.offsetX <= v.offsetWidth - v.clientWidth : S.offsetX > v.clientWidth), qt = Kt && S.offsetY > v.clientHeight;
|
|
1857
|
+
if (jt || qt)
|
|
1858
|
+
return;
|
|
1859
|
+
}
|
|
1860
|
+
const le = (A = s.current.floatingContext) == null ? void 0 : A.nodeId, he = f && Be(f.nodesRef.current, le).some((H) => {
|
|
1861
|
+
var G;
|
|
1862
|
+
return Le(S, (G = H.context) == null ? void 0 : G.elements.floating);
|
|
1863
|
+
});
|
|
1864
|
+
if (Le(S, o.floating) || Le(S, o.domReference) || he)
|
|
1865
|
+
return;
|
|
1866
|
+
const Xe = f ? Be(f.nodesRef.current, le) : [];
|
|
1867
|
+
if (Xe.length > 0) {
|
|
1868
|
+
let H = !0;
|
|
1869
|
+
if (Xe.forEach((G) => {
|
|
1870
|
+
var ae;
|
|
1871
|
+
if ((ae = G.context) != null && ae.open && !G.context.dataRef.current.__outsidePressBubbles) {
|
|
1872
|
+
H = !1;
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
}), !H)
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
r(!1, S, "outside-press");
|
|
1879
|
+
}), $ = Z((S) => {
|
|
1880
|
+
var A;
|
|
1881
|
+
const b = () => {
|
|
1882
|
+
var p;
|
|
1883
|
+
B(S), (p = ue(S)) == null || p.removeEventListener(a, b);
|
|
1884
|
+
};
|
|
1885
|
+
(A = ue(S)) == null || A.addEventListener(a, b);
|
|
1886
|
+
});
|
|
1887
|
+
m.useEffect(() => {
|
|
1888
|
+
if (!n || !i)
|
|
1889
|
+
return;
|
|
1890
|
+
s.current.__escapeKeyBubbles = T, s.current.__outsidePressBubbles = C;
|
|
1891
|
+
let S = -1;
|
|
1892
|
+
function A(O) {
|
|
1893
|
+
r(!1, O, "ancestor-scroll");
|
|
1894
|
+
}
|
|
1895
|
+
function b() {
|
|
1896
|
+
window.clearTimeout(S), W.current = !0;
|
|
1897
|
+
}
|
|
1898
|
+
function p() {
|
|
1899
|
+
S = window.setTimeout(
|
|
1900
|
+
() => {
|
|
1901
|
+
W.current = !1;
|
|
1902
|
+
},
|
|
1903
|
+
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
|
|
1904
|
+
// Only apply to WebKit for the test to remain 0ms.
|
|
1905
|
+
Pe() ? 5 : 0
|
|
1906
|
+
);
|
|
1907
|
+
}
|
|
1908
|
+
const v = J(o.floating);
|
|
1909
|
+
c && (v.addEventListener("keydown", D ? N : L, D), v.addEventListener("compositionstart", b), v.addEventListener("compositionend", p)), R && v.addEventListener(a, M ? $ : B, M);
|
|
1910
|
+
let P = [];
|
|
1911
|
+
return h && (k(o.domReference) && (P = te(o.domReference)), k(o.floating) && (P = P.concat(te(o.floating))), !k(o.reference) && o.reference && o.reference.contextElement && (P = P.concat(te(o.reference.contextElement)))), P = P.filter((O) => {
|
|
1912
|
+
var V;
|
|
1913
|
+
return O !== ((V = v.defaultView) == null ? void 0 : V.visualViewport);
|
|
1914
|
+
}), P.forEach((O) => {
|
|
1915
|
+
O.addEventListener("scroll", A, {
|
|
1916
|
+
passive: !0
|
|
1917
|
+
});
|
|
1918
|
+
}), () => {
|
|
1919
|
+
c && (v.removeEventListener("keydown", D ? N : L, D), v.removeEventListener("compositionstart", b), v.removeEventListener("compositionend", p)), R && v.removeEventListener(a, M ? $ : B, M), P.forEach((O) => {
|
|
1920
|
+
O.removeEventListener("scroll", A);
|
|
1921
|
+
}), window.clearTimeout(S);
|
|
1922
|
+
};
|
|
1923
|
+
}, [s, o, c, R, a, n, r, h, i, T, C, L, D, N, B, M, $]), m.useEffect(() => {
|
|
1924
|
+
E.current = !1;
|
|
1925
|
+
}, [R, a]);
|
|
1926
|
+
const F = m.useMemo(() => ({
|
|
1927
|
+
onKeyDown: L,
|
|
1928
|
+
...u && {
|
|
1929
|
+
[Mr[g]]: (S) => {
|
|
1930
|
+
r(!1, S.nativeEvent, "reference-press");
|
|
1931
|
+
},
|
|
1932
|
+
...g !== "click" && {
|
|
1933
|
+
onClick(S) {
|
|
1934
|
+
r(!1, S.nativeEvent, "reference-press");
|
|
1935
|
+
}
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
}), [L, r, u, g]), I = m.useMemo(() => ({
|
|
1939
|
+
onKeyDown: L,
|
|
1940
|
+
onMouseDown() {
|
|
1941
|
+
w.current = !0;
|
|
1942
|
+
},
|
|
1943
|
+
onMouseUp() {
|
|
1944
|
+
w.current = !0;
|
|
1945
|
+
},
|
|
1946
|
+
[Dr[a]]: () => {
|
|
1947
|
+
E.current = !0;
|
|
1948
|
+
}
|
|
1949
|
+
}), [L, a]);
|
|
1950
|
+
return m.useMemo(() => i ? {
|
|
1951
|
+
reference: F,
|
|
1952
|
+
floating: I
|
|
1953
|
+
} : {}, [i, F, I]);
|
|
1954
|
+
}
|
|
1955
|
+
function Ir(e) {
|
|
1956
|
+
const {
|
|
1957
|
+
open: t = !1,
|
|
1958
|
+
onOpenChange: n,
|
|
1959
|
+
elements: r
|
|
1960
|
+
} = e, o = Ft(), s = m.useRef({}), [i] = m.useState(() => vr()), c = Nt() != null;
|
|
1961
|
+
if (process.env.NODE_ENV !== "production") {
|
|
1962
|
+
const d = r.reference;
|
|
1963
|
+
d && !k(d) && hr("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
|
|
1964
|
+
}
|
|
1965
|
+
const [l, a] = m.useState(r.reference), u = Z((d, x, f) => {
|
|
1966
|
+
s.current.openEvent = d ? x : void 0, i.emit("openchange", {
|
|
1967
|
+
open: d,
|
|
1968
|
+
event: x,
|
|
1969
|
+
reason: f,
|
|
1970
|
+
nested: c
|
|
1971
|
+
}), n == null || n(d, x, f);
|
|
1972
|
+
}), g = m.useMemo(() => ({
|
|
1973
|
+
setPositionReference: a
|
|
1974
|
+
}), []), h = m.useMemo(() => ({
|
|
1975
|
+
reference: l || r.reference || null,
|
|
1976
|
+
floating: r.floating || null,
|
|
1977
|
+
domReference: r.reference
|
|
1978
|
+
}), [l, r.reference, r.floating]);
|
|
1979
|
+
return m.useMemo(() => ({
|
|
1980
|
+
dataRef: s,
|
|
1981
|
+
open: t,
|
|
1982
|
+
onOpenChange: u,
|
|
1983
|
+
elements: h,
|
|
1984
|
+
events: i,
|
|
1985
|
+
floatingId: o,
|
|
1986
|
+
refs: g
|
|
1987
|
+
}), [t, u, h, i, o, g]);
|
|
1988
|
+
}
|
|
1989
|
+
function kr(e) {
|
|
1990
|
+
e === void 0 && (e = {});
|
|
1991
|
+
const {
|
|
1992
|
+
nodeId: t
|
|
1993
|
+
} = e, n = Ir({
|
|
1994
|
+
...e,
|
|
1995
|
+
elements: {
|
|
1996
|
+
reference: null,
|
|
1997
|
+
floating: null,
|
|
1998
|
+
...e.elements
|
|
1999
|
+
}
|
|
2000
|
+
}), r = e.rootContext || n, o = r.elements, [s, i] = m.useState(null), [c, l] = m.useState(null), u = (o == null ? void 0 : o.domReference) || s, g = m.useRef(null), h = ze();
|
|
2001
|
+
q(() => {
|
|
2002
|
+
u && (g.current = u);
|
|
2003
|
+
}, [u]);
|
|
2004
|
+
const d = cr({
|
|
2005
|
+
...e,
|
|
2006
|
+
elements: {
|
|
2007
|
+
...o,
|
|
2008
|
+
...c && {
|
|
2009
|
+
reference: c
|
|
2010
|
+
}
|
|
2011
|
+
}
|
|
2012
|
+
}), x = m.useCallback((w) => {
|
|
2013
|
+
const T = k(w) ? {
|
|
2014
|
+
getBoundingClientRect: () => w.getBoundingClientRect(),
|
|
2015
|
+
getClientRects: () => w.getClientRects(),
|
|
2016
|
+
contextElement: w
|
|
2017
|
+
} : w;
|
|
2018
|
+
l(T), d.refs.setReference(T);
|
|
2019
|
+
}, [d.refs]), f = m.useCallback((w) => {
|
|
2020
|
+
(k(w) || w === null) && (g.current = w, i(w)), (k(d.refs.reference.current) || d.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
|
|
2021
|
+
// `null` to support `positionReference` + an unstable `reference`
|
|
2022
|
+
// callback ref.
|
|
2023
|
+
w !== null && !k(w)) && d.refs.setReference(w);
|
|
2024
|
+
}, [d.refs]), y = m.useMemo(() => ({
|
|
2025
|
+
...d.refs,
|
|
2026
|
+
setReference: f,
|
|
2027
|
+
setPositionReference: x,
|
|
2028
|
+
domReference: g
|
|
2029
|
+
}), [d.refs, f, x]), R = m.useMemo(() => ({
|
|
2030
|
+
...d.elements,
|
|
2031
|
+
domReference: u
|
|
2032
|
+
}), [d.elements, u]), E = m.useMemo(() => ({
|
|
2033
|
+
...d,
|
|
2034
|
+
...r,
|
|
2035
|
+
refs: y,
|
|
2036
|
+
elements: R,
|
|
2037
|
+
nodeId: t
|
|
2038
|
+
}), [d, y, R, t, r]);
|
|
2039
|
+
return q(() => {
|
|
2040
|
+
r.dataRef.current.floatingContext = E;
|
|
2041
|
+
const w = h == null ? void 0 : h.nodesRef.current.find((T) => T.id === t);
|
|
2042
|
+
w && (w.context = E);
|
|
2043
|
+
}), m.useMemo(() => ({
|
|
2044
|
+
...d,
|
|
2045
|
+
context: E,
|
|
2046
|
+
refs: y,
|
|
2047
|
+
elements: R
|
|
2048
|
+
}), [d, y, R, E]);
|
|
2049
|
+
}
|
|
2050
|
+
const ft = "active", dt = "selected";
|
|
2051
|
+
function $e(e, t, n) {
|
|
2052
|
+
const r = /* @__PURE__ */ new Map(), o = n === "item";
|
|
2053
|
+
let s = e;
|
|
2054
|
+
if (o && e) {
|
|
2055
|
+
const {
|
|
2056
|
+
[ft]: i,
|
|
2057
|
+
[dt]: c,
|
|
2058
|
+
...l
|
|
2059
|
+
} = e;
|
|
2060
|
+
s = l;
|
|
2061
|
+
}
|
|
2062
|
+
return {
|
|
2063
|
+
...n === "floating" && {
|
|
2064
|
+
tabIndex: -1,
|
|
2065
|
+
[Or]: ""
|
|
2066
|
+
},
|
|
2067
|
+
...s,
|
|
2068
|
+
...t.map((i) => {
|
|
2069
|
+
const c = i ? i[n] : null;
|
|
2070
|
+
return typeof c == "function" ? e ? c(e) : null : c;
|
|
2071
|
+
}).concat(e).reduce((i, c) => (c && Object.entries(c).forEach((l) => {
|
|
2072
|
+
let [a, u] = l;
|
|
2073
|
+
if (!(o && [ft, dt].includes(a)))
|
|
2074
|
+
if (a.indexOf("on") === 0) {
|
|
2075
|
+
if (r.has(a) || r.set(a, []), typeof u == "function") {
|
|
2076
|
+
var g;
|
|
2077
|
+
(g = r.get(a)) == null || g.push(u), i[a] = function() {
|
|
2078
|
+
for (var h, d = arguments.length, x = new Array(d), f = 0; f < d; f++)
|
|
2079
|
+
x[f] = arguments[f];
|
|
2080
|
+
return (h = r.get(a)) == null ? void 0 : h.map((y) => y(...x)).find((y) => y !== void 0);
|
|
2081
|
+
};
|
|
2082
|
+
}
|
|
2083
|
+
} else
|
|
2084
|
+
i[a] = u;
|
|
2085
|
+
}), i), {})
|
|
2086
|
+
};
|
|
2087
|
+
}
|
|
2088
|
+
function Fr(e) {
|
|
2089
|
+
e === void 0 && (e = []);
|
|
2090
|
+
const t = e.map((c) => c == null ? void 0 : c.reference), n = e.map((c) => c == null ? void 0 : c.floating), r = e.map((c) => c == null ? void 0 : c.item), o = m.useCallback(
|
|
2091
|
+
(c) => $e(c, e, "reference"),
|
|
2092
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2093
|
+
t
|
|
2094
|
+
), s = m.useCallback(
|
|
2095
|
+
(c) => $e(c, e, "floating"),
|
|
2096
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2097
|
+
n
|
|
2098
|
+
), i = m.useCallback(
|
|
2099
|
+
(c) => $e(c, e, "item"),
|
|
2100
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2101
|
+
r
|
|
2102
|
+
);
|
|
2103
|
+
return m.useMemo(() => ({
|
|
2104
|
+
getReferenceProps: o,
|
|
2105
|
+
getFloatingProps: s,
|
|
2106
|
+
getItemProps: i
|
|
2107
|
+
}), [o, s, i]);
|
|
2108
|
+
}
|
|
2109
|
+
function Nr(e, t) {
|
|
2110
|
+
const [n, r] = m.useState(e);
|
|
2111
|
+
return e && !n && r(!0), m.useEffect(() => {
|
|
2112
|
+
if (!e && n) {
|
|
2113
|
+
const o = setTimeout(() => r(!1), t);
|
|
2114
|
+
return () => clearTimeout(o);
|
|
2115
|
+
}
|
|
2116
|
+
}, [e, n, t]), n;
|
|
2117
|
+
}
|
|
2118
|
+
function Br(e, t) {
|
|
2119
|
+
t === void 0 && (t = {});
|
|
2120
|
+
const {
|
|
2121
|
+
open: n,
|
|
2122
|
+
elements: {
|
|
2123
|
+
floating: r
|
|
2124
|
+
}
|
|
2125
|
+
} = e, {
|
|
2126
|
+
duration: o = 250
|
|
2127
|
+
} = t, i = (typeof o == "number" ? o : o.close) || 0, [c, l] = m.useState("unmounted"), a = Nr(n, i);
|
|
2128
|
+
return !a && c === "close" && l("unmounted"), q(() => {
|
|
2129
|
+
if (r) {
|
|
2130
|
+
if (n) {
|
|
2131
|
+
l("initial");
|
|
2132
|
+
const u = requestAnimationFrame(() => {
|
|
2133
|
+
l("open");
|
|
2134
|
+
});
|
|
2135
|
+
return () => {
|
|
2136
|
+
cancelAnimationFrame(u);
|
|
2137
|
+
};
|
|
2138
|
+
}
|
|
2139
|
+
l("close");
|
|
2140
|
+
}
|
|
2141
|
+
}, [n, r]), {
|
|
2142
|
+
isMounted: a,
|
|
2143
|
+
status: c
|
|
2144
|
+
};
|
|
2145
|
+
}
|
|
2146
|
+
function _r(e) {
|
|
2147
|
+
const {
|
|
2148
|
+
allowedOutsideClasses: t,
|
|
2149
|
+
animationDuration: n,
|
|
2150
|
+
children: r,
|
|
2151
|
+
closeAfterInteract: o,
|
|
2152
|
+
content: s,
|
|
2153
|
+
contentAutoWidth: i,
|
|
2154
|
+
contentClasses: c,
|
|
2155
|
+
contentOffset: l = 6,
|
|
2156
|
+
contentStyles: a,
|
|
2157
|
+
disabled: u,
|
|
2158
|
+
hoverDelay: g,
|
|
2159
|
+
hoverOpen: h,
|
|
2160
|
+
onMounted: d,
|
|
2161
|
+
placement: x,
|
|
2162
|
+
stopChildPropagation: f,
|
|
2163
|
+
onOpenChange: y
|
|
2164
|
+
} = e, [R, E] = Gt(!1), { refs: w, floatingStyles: T, context: C } = kr({
|
|
2165
|
+
open: R,
|
|
2166
|
+
onOpenChange(b) {
|
|
2167
|
+
E(b), y == null || y(b);
|
|
2168
|
+
},
|
|
2169
|
+
whileElementsMounted: (b, p, v) => (d !== void 0 && d(), nr(b, p, v)),
|
|
2170
|
+
placement: x || "bottom",
|
|
2171
|
+
transform: !1,
|
|
2172
|
+
// More expensive but allows to use transform for animations
|
|
2173
|
+
middleware: [
|
|
2174
|
+
lr(l),
|
|
2175
|
+
ar({
|
|
2176
|
+
padding: 6,
|
|
2177
|
+
fallbackPlacements: [
|
|
2178
|
+
"bottom-start",
|
|
2179
|
+
"bottom-end",
|
|
2180
|
+
"top",
|
|
2181
|
+
"top-start",
|
|
2182
|
+
"top-end"
|
|
2183
|
+
]
|
|
2184
|
+
}),
|
|
2185
|
+
i && ur({
|
|
2186
|
+
apply({ rects: b, elements: p }) {
|
|
2187
|
+
p.floating.style.width = `${b.reference.width}px`;
|
|
2188
|
+
}
|
|
2189
|
+
})
|
|
2190
|
+
]
|
|
2191
|
+
}), { isMounted: D, status: M } = Br(C, {
|
|
2192
|
+
duration: n || 200
|
|
2193
|
+
}), W = Lr(C, {
|
|
2194
|
+
ancestorScroll: !0,
|
|
2195
|
+
outsidePress: (b) => t && b.target instanceof Element && !b.target.closest(t) || !1
|
|
2196
|
+
}), L = Ar(C, { enabled: !u }), N = wr(C, {
|
|
2197
|
+
enabled: !u,
|
|
2198
|
+
restMs: g || 200
|
|
2199
|
+
}), B = h ? N : L, { getReferenceProps: $, getFloatingProps: F } = Fr([
|
|
2200
|
+
W,
|
|
2201
|
+
B
|
|
2202
|
+
]), I = $({
|
|
2203
|
+
ref: w.setReference,
|
|
2204
|
+
...f && {
|
|
2205
|
+
onClick: (b) => b.stopPropagation()
|
|
2206
|
+
}
|
|
2207
|
+
}), S = F({
|
|
2208
|
+
onClick: () => {
|
|
2209
|
+
o && C.onOpenChange(!1);
|
|
2210
|
+
}
|
|
2211
|
+
});
|
|
2212
|
+
let A;
|
|
2213
|
+
return Zt(r) ? A = Jt(r, I) : A = /* @__PURE__ */ ne("div", { ...I, children: r }), /* @__PURE__ */ mt(zt, { children: [
|
|
2214
|
+
A,
|
|
2215
|
+
D && /* @__PURE__ */ ne(Sr, { children: /* @__PURE__ */ ne(
|
|
2216
|
+
"div",
|
|
2217
|
+
{
|
|
2218
|
+
ref: w.setFloating,
|
|
2219
|
+
className: Qt([
|
|
2220
|
+
"Floating",
|
|
2221
|
+
!n && "Floating--animated",
|
|
2222
|
+
c
|
|
2223
|
+
]),
|
|
2224
|
+
"data-position": C.placement,
|
|
2225
|
+
"data-transition": M,
|
|
2226
|
+
style: { ...T, ...a },
|
|
2227
|
+
...S,
|
|
2228
|
+
children: s
|
|
2229
|
+
}
|
|
2230
|
+
) })
|
|
2231
|
+
] });
|
|
2232
|
+
}
|
|
2233
|
+
export {
|
|
2234
|
+
_r as Floating
|
|
2235
|
+
};
|