@cfx-dev/ui-components 4.0.2 → 4.1.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.
Files changed (85) hide show
  1. package/dist/{Combination-BRUj3CHE.js → Combination-Cbiw1XRb.js} +1 -1
  2. package/dist/assets/css/DropdownSelect.css +1 -1
  3. package/dist/assets/css/Flex.css +1 -1
  4. package/dist/assets/css/Input.css +1 -1
  5. package/dist/assets/css/RichInput.css +1 -1
  6. package/dist/assets/css/Select.css +1 -1
  7. package/dist/assets/general/global.css +1 -1
  8. package/dist/components/Accordion/Accordion.js +18 -17
  9. package/dist/components/Accordion/AccordionShowcase.js +3 -2
  10. package/dist/components/Avatar/AvatarShowcase.js +3 -2
  11. package/dist/components/Badge/BadgeShowcase.js +5 -4
  12. package/dist/components/Button/ButtonShowcase.js +3 -2
  13. package/dist/components/Checkbox/Checkbox.js +6 -5
  14. package/dist/components/DropdownSelect/DropdownSelect.d.ts +4 -1
  15. package/dist/components/DropdownSelect/DropdownSelect.js +739 -715
  16. package/dist/components/DropdownSelect/DropdownSelectShowcase.js +11 -10
  17. package/dist/components/Flyout/Flyout.js +1 -1
  18. package/dist/components/Icon/Icon.d.ts +4 -3
  19. package/dist/components/Icon/Icon.js +27 -25
  20. package/dist/components/IconBig/IconBig.js +3 -2
  21. package/dist/components/InfoPanel/InfoPanelShowcase.js +11 -10
  22. package/dist/components/Input/Input.d.ts +2 -1
  23. package/dist/components/Input/Input.js +96 -75
  24. package/dist/components/Input/InputShowcase.js +6 -5
  25. package/dist/components/Input/RichInput.d.ts +2 -1
  26. package/dist/components/Input/RichInput.js +60 -43
  27. package/dist/components/Layout/Box/Box.d.ts +4 -11
  28. package/dist/components/Layout/Box/Box.js +58 -96
  29. package/dist/components/Layout/Flex/Flex.d.ts +7 -3
  30. package/dist/components/Layout/Flex/Flex.js +70 -62
  31. package/dist/components/Layout/Flex/Flex.types.d.ts +42 -0
  32. package/dist/components/Layout/Flex/Flex.types.js +7 -0
  33. package/dist/components/Layout/Scrollable/ScrollableShowcase.js +1 -0
  34. package/dist/components/Link/LinkShowcase.js +1 -0
  35. package/dist/components/Logos/LogosShowcase.js +3 -2
  36. package/dist/components/Modal/Modal.js +1 -0
  37. package/dist/components/Overlay/Overlay.js +1 -1
  38. package/dist/components/Select/Select.d.ts +2 -3
  39. package/dist/components/Select/Select.js +1922 -7
  40. package/dist/components/Select/SelectShowcase.js +4 -3
  41. package/dist/components/Select/index.d.ts +1 -1
  42. package/dist/components/Select/index.js +2 -3
  43. package/dist/components/Separator/Separator.d.ts +2 -2
  44. package/dist/components/Separator/Separator.js +35 -25
  45. package/dist/components/Skeleton/Skeleton.d.ts +7 -6
  46. package/dist/components/Skeleton/Skeleton.js +35 -22
  47. package/dist/components/Skeleton/SkeletonShowcase.js +14 -13
  48. package/dist/components/Slider/Slider.js +11 -9
  49. package/dist/components/Slider/SliderShowcase.js +10 -9
  50. package/dist/components/Spacer/Spacer.d.ts +1 -1
  51. package/dist/components/Switch/Switch.js +6 -5
  52. package/dist/components/Table/Table.js +3 -2
  53. package/dist/components/Table/TableShowcase.js +7 -6
  54. package/dist/components/Tabular/TabularShowcase.js +3 -2
  55. package/dist/components/Text/Text.d.ts +3 -1
  56. package/dist/components/Text/Text.js +61 -52
  57. package/dist/components/Text/Text.types.d.ts +4 -13
  58. package/dist/components/Text/Text.types.js +1 -4
  59. package/dist/components/Text/index.d.ts +3 -2
  60. package/dist/components/Text/index.js +9 -6
  61. package/dist/components/Title/TitleShowcase.js +4 -3
  62. package/dist/components/ui.d.ts +37 -12
  63. package/dist/components/ui.js +61 -57
  64. package/dist/index-BZPx6jYI.js +8 -0
  65. package/dist/index-ByaXH_ih.js +10 -0
  66. package/dist/index-Cf5Yu9oD.js +67 -0
  67. package/dist/index-DBus3GoO.js +1342 -0
  68. package/dist/index-rKs9bXHr.js +6 -0
  69. package/dist/main.d.ts +1 -1
  70. package/dist/main.js +14 -14
  71. package/dist/{medium-JVtzoF2c.js → medium-BA3EQDZW.js} +2 -2
  72. package/dist/styles-scss/_ui.scss +10 -1
  73. package/dist/styles-scss/global.scss +39 -26
  74. package/dist/styles-scss/themes/theme_cfx.scss +2 -0
  75. package/dist/styles-scss/themes/theme_fivem.scss +2 -0
  76. package/dist/styles-scss/themes/theme_redm.scss +2 -0
  77. package/dist/styles-scss/themes/theme_wireframe.scss +2 -0
  78. package/dist/styles-scss/themes.scss +4 -4
  79. package/dist/styles-scss/tokens.scss +22 -15
  80. package/package.json +1 -1
  81. package/dist/Select-Ds-fm4CN.js +0 -3245
  82. package/dist/index-BCnz73Lm.js +0 -72
  83. package/dist/index-BW3WdIgK.js +0 -14
  84. package/dist/types/Offset.d.ts +0 -1
  85. package/dist/types/Offset.js +0 -1
@@ -1,3245 +0,0 @@
1
- import { jsx as C, Fragment as Tt, jsxs as fe } from "react/jsx-runtime";
2
- import * as u from "react";
3
- import K, { useLayoutEffect as To, useEffect as _o } from "react";
4
- import { r as _t, R as Oo } from "./index-2hJuj4UN.js";
5
- import { u as No, c as $t } from "./index-BW3WdIgK.js";
6
- import { S as wt, P as U, d as Io } from "./index-BlbvKsmN.js";
7
- import { d as Se, c as q, b as Mo, a as Lo, u as Ht } from "./index-BCnz73Lm.js";
8
- import { f as dn, _ as xe, c as Do } from "./tslib.es6-CBKHJX9H.js";
9
- import { a as ko, u as Bo } from "./medium-JVtzoF2c.js";
10
- import { Icon as Fo } from "./components/Icon/Icon.js";
11
- import { clsx as Vt } from "./utils/clsx.js";
12
- var pn = function(e) {
13
- var t = e.sideCar, n = dn(e, ["sideCar"]);
14
- if (!t)
15
- throw new Error("Sidecar: please provide `sideCar` property to import the right car");
16
- var o = t.read();
17
- if (!o)
18
- throw new Error("Sidecar medium not found");
19
- return u.createElement(o, xe({}, n));
20
- };
21
- pn.isSideCarExport = !0;
22
- function Wo(e, t) {
23
- return e.useMedium(t), pn;
24
- }
25
- function Y(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
26
- return function(r) {
27
- if (e == null || e(r), n === !1 || !r.defaultPrevented)
28
- return t == null ? void 0 : t(r);
29
- };
30
- }
31
- function mn(e, t = []) {
32
- let n = [];
33
- function o(s, c) {
34
- const i = u.createContext(c), a = n.length;
35
- n = [...n, c];
36
- function l(d) {
37
- const { scope: v, children: h, ...p } = d, f = (v == null ? void 0 : v[e][a]) || i, w = u.useMemo(() => p, Object.values(p));
38
- return /* @__PURE__ */ C(f.Provider, { value: w, children: h });
39
- }
40
- function m(d, v) {
41
- const h = (v == null ? void 0 : v[e][a]) || i, p = u.useContext(h);
42
- if (p) return p;
43
- if (c !== void 0) return c;
44
- throw new Error(`\`${d}\` must be used within \`${s}\``);
45
- }
46
- return l.displayName = s + "Provider", [l, m];
47
- }
48
- const r = () => {
49
- const s = n.map((c) => u.createContext(c));
50
- return function(i) {
51
- const a = (i == null ? void 0 : i[e]) || s;
52
- return u.useMemo(
53
- () => ({ [`__scope${e}`]: { ...i, [e]: a } }),
54
- [i, a]
55
- );
56
- };
57
- };
58
- return r.scopeName = e, [o, $o(r, ...t)];
59
- }
60
- function $o(...e) {
61
- const t = e[0];
62
- if (e.length === 1) return t;
63
- const n = () => {
64
- const o = e.map((r) => ({
65
- useScope: r(),
66
- scopeName: r.scopeName
67
- }));
68
- return function(s) {
69
- const c = o.reduce((i, { useScope: a, scopeName: l }) => {
70
- const d = a(s)[`__scope${l}`];
71
- return { ...i, ...d };
72
- }, {});
73
- return u.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
74
- };
75
- };
76
- return n.scopeName = t.scopeName, n;
77
- }
78
- function Ho(e, t) {
79
- typeof e == "function" ? e(t) : e != null && (e.current = t);
80
- }
81
- function Vo(...e) {
82
- return (t) => e.forEach((n) => Ho(n, t));
83
- }
84
- function Z(...e) {
85
- return u.useCallback(Vo(...e), e);
86
- }
87
- function Uo(e) {
88
- const t = e + "CollectionProvider", [n, o] = mn(t), [r, s] = n(
89
- t,
90
- { collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
91
- ), c = (h) => {
92
- const { scope: p, children: f } = h, w = K.useRef(null), g = K.useRef(/* @__PURE__ */ new Map()).current;
93
- return /* @__PURE__ */ C(r, { scope: p, itemMap: g, collectionRef: w, children: f });
94
- };
95
- c.displayName = t;
96
- const i = e + "CollectionSlot", a = K.forwardRef(
97
- (h, p) => {
98
- const { scope: f, children: w } = h, g = s(i, f), y = Z(p, g.collectionRef);
99
- return /* @__PURE__ */ C(wt, { ref: y, children: w });
100
- }
101
- );
102
- a.displayName = i;
103
- const l = e + "CollectionItemSlot", m = "data-radix-collection-item", d = K.forwardRef(
104
- (h, p) => {
105
- const { scope: f, children: w, ...g } = h, y = K.useRef(null), x = Z(p, y), S = s(l, f);
106
- return K.useEffect(() => (S.itemMap.set(y, { ref: y, ...g }), () => void S.itemMap.delete(y))), /* @__PURE__ */ C(wt, { [m]: "", ref: x, children: w });
107
- }
108
- );
109
- d.displayName = l;
110
- function v(h) {
111
- const p = s(e + "CollectionConsumer", h);
112
- return K.useCallback(() => {
113
- const w = p.collectionRef.current;
114
- if (!w) return [];
115
- const g = Array.from(w.querySelectorAll(`[${m}]`));
116
- return Array.from(p.itemMap.values()).sort(
117
- (S, b) => g.indexOf(S.ref.current) - g.indexOf(b.ref.current)
118
- );
119
- }, [p.collectionRef, p.itemMap]);
120
- }
121
- return [
122
- { Provider: c, Slot: a, ItemSlot: d },
123
- v,
124
- o
125
- ];
126
- }
127
- function ut(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
128
- return function(r) {
129
- if (e == null || e(r), n === !1 || !r.defaultPrevented)
130
- return t == null ? void 0 : t(r);
131
- };
132
- }
133
- function zo(e, t) {
134
- typeof e == "function" ? e(t) : e != null && (e.current = t);
135
- }
136
- function Ko(...e) {
137
- return (t) => e.forEach((n) => zo(n, t));
138
- }
139
- function hn(...e) {
140
- return u.useCallback(Ko(...e), e);
141
- }
142
- function Yo(e, t = globalThis == null ? void 0 : globalThis.document) {
143
- const n = Se(e);
144
- u.useEffect(() => {
145
- const o = (r) => {
146
- r.key === "Escape" && n(r);
147
- };
148
- return t.addEventListener("keydown", o, { capture: !0 }), () => t.removeEventListener("keydown", o, { capture: !0 });
149
- }, [n, t]);
150
- }
151
- var jo = "DismissableLayer", yt = "dismissableLayer.update", Xo = "dismissableLayer.pointerDownOutside", Go = "dismissableLayer.focusOutside", Ut, vn = u.createContext({
152
- layers: /* @__PURE__ */ new Set(),
153
- layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
154
- branches: /* @__PURE__ */ new Set()
155
- }), gn = u.forwardRef(
156
- (e, t) => {
157
- const {
158
- disableOutsidePointerEvents: n = !1,
159
- onEscapeKeyDown: o,
160
- onPointerDownOutside: r,
161
- onFocusOutside: s,
162
- onInteractOutside: c,
163
- onDismiss: i,
164
- ...a
165
- } = e, l = u.useContext(vn), [m, d] = u.useState(null), v = (m == null ? void 0 : m.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = u.useState({}), p = hn(t, (E) => d(E)), f = Array.from(l.layers), [w] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), g = f.indexOf(w), y = m ? f.indexOf(m) : -1, x = l.layersWithOutsidePointerEventsDisabled.size > 0, S = y >= g, b = Qo((E) => {
166
- const T = E.target, N = [...l.branches].some((I) => I.contains(T));
167
- !S || N || (r == null || r(E), c == null || c(E), E.defaultPrevented || i == null || i());
168
- }, v), P = Jo((E) => {
169
- const T = E.target;
170
- [...l.branches].some((I) => I.contains(T)) || (s == null || s(E), c == null || c(E), E.defaultPrevented || i == null || i());
171
- }, v);
172
- return Yo((E) => {
173
- y === l.layers.size - 1 && (o == null || o(E), !E.defaultPrevented && i && (E.preventDefault(), i()));
174
- }, v), u.useEffect(() => {
175
- if (m)
176
- return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (Ut = v.body.style.pointerEvents, v.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(m)), l.layers.add(m), zt(), () => {
177
- n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (v.body.style.pointerEvents = Ut);
178
- };
179
- }, [m, v, n, l]), u.useEffect(() => () => {
180
- m && (l.layers.delete(m), l.layersWithOutsidePointerEventsDisabled.delete(m), zt());
181
- }, [m, l]), u.useEffect(() => {
182
- const E = () => h({});
183
- return document.addEventListener(yt, E), () => document.removeEventListener(yt, E);
184
- }, []), /* @__PURE__ */ C(
185
- U.div,
186
- {
187
- ...a,
188
- ref: p,
189
- style: {
190
- pointerEvents: x ? S ? "auto" : "none" : void 0,
191
- ...e.style
192
- },
193
- onFocusCapture: ut(e.onFocusCapture, P.onFocusCapture),
194
- onBlurCapture: ut(e.onBlurCapture, P.onBlurCapture),
195
- onPointerDownCapture: ut(
196
- e.onPointerDownCapture,
197
- b.onPointerDownCapture
198
- )
199
- }
200
- );
201
- }
202
- );
203
- gn.displayName = jo;
204
- var qo = "DismissableLayerBranch", Zo = u.forwardRef((e, t) => {
205
- const n = u.useContext(vn), o = u.useRef(null), r = hn(t, o);
206
- return u.useEffect(() => {
207
- const s = o.current;
208
- if (s)
209
- return n.branches.add(s), () => {
210
- n.branches.delete(s);
211
- };
212
- }, [n.branches]), /* @__PURE__ */ C(U.div, { ...e, ref: r });
213
- });
214
- Zo.displayName = qo;
215
- function Qo(e, t = globalThis == null ? void 0 : globalThis.document) {
216
- const n = Se(e), o = u.useRef(!1), r = u.useRef(() => {
217
- });
218
- return u.useEffect(() => {
219
- const s = (i) => {
220
- if (i.target && !o.current) {
221
- let a = function() {
222
- wn(
223
- Xo,
224
- n,
225
- l,
226
- { discrete: !0 }
227
- );
228
- };
229
- const l = { originalEvent: i };
230
- i.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = a, t.addEventListener("click", r.current, { once: !0 })) : a();
231
- } else
232
- t.removeEventListener("click", r.current);
233
- o.current = !1;
234
- }, c = window.setTimeout(() => {
235
- t.addEventListener("pointerdown", s);
236
- }, 0);
237
- return () => {
238
- window.clearTimeout(c), t.removeEventListener("pointerdown", s), t.removeEventListener("click", r.current);
239
- };
240
- }, [t, n]), {
241
- // ensures we check React component tree (not just DOM tree)
242
- onPointerDownCapture: () => o.current = !0
243
- };
244
- }
245
- function Jo(e, t = globalThis == null ? void 0 : globalThis.document) {
246
- const n = Se(e), o = u.useRef(!1);
247
- return u.useEffect(() => {
248
- const r = (s) => {
249
- s.target && !o.current && wn(Go, n, { originalEvent: s }, {
250
- discrete: !1
251
- });
252
- };
253
- return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
254
- }, [t, n]), {
255
- onFocusCapture: () => o.current = !0,
256
- onBlurCapture: () => o.current = !1
257
- };
258
- }
259
- function zt() {
260
- const e = new CustomEvent(yt);
261
- document.dispatchEvent(e);
262
- }
263
- function wn(e, t, n, { discrete: o }) {
264
- const r = n.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
265
- t && r.addEventListener(e, t, { once: !0 }), o ? Io(r, s) : r.dispatchEvent(s);
266
- }
267
- var ft = 0;
268
- function er() {
269
- u.useEffect(() => {
270
- const e = document.querySelectorAll("[data-radix-focus-guard]");
271
- return document.body.insertAdjacentElement("afterbegin", e[0] ?? Kt()), document.body.insertAdjacentElement("beforeend", e[1] ?? Kt()), ft++, () => {
272
- ft === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), ft--;
273
- };
274
- }, []);
275
- }
276
- function Kt() {
277
- const e = document.createElement("span");
278
- return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none", e;
279
- }
280
- function tr(e, t) {
281
- typeof e == "function" ? e(t) : e != null && (e.current = t);
282
- }
283
- function nr(...e) {
284
- return (t) => e.forEach((n) => tr(n, t));
285
- }
286
- function or(...e) {
287
- return u.useCallback(nr(...e), e);
288
- }
289
- var dt = "focusScope.autoFocusOnMount", pt = "focusScope.autoFocusOnUnmount", Yt = { bubbles: !1, cancelable: !0 }, rr = "FocusScope", yn = u.forwardRef((e, t) => {
290
- const {
291
- loop: n = !1,
292
- trapped: o = !1,
293
- onMountAutoFocus: r,
294
- onUnmountAutoFocus: s,
295
- ...c
296
- } = e, [i, a] = u.useState(null), l = Se(r), m = Se(s), d = u.useRef(null), v = or(t, (f) => a(f)), h = u.useRef({
297
- paused: !1,
298
- pause() {
299
- this.paused = !0;
300
- },
301
- resume() {
302
- this.paused = !1;
303
- }
304
- }).current;
305
- u.useEffect(() => {
306
- if (o) {
307
- let f = function(x) {
308
- if (h.paused || !i) return;
309
- const S = x.target;
310
- i.contains(S) ? d.current = S : ue(d.current, { select: !0 });
311
- }, w = function(x) {
312
- if (h.paused || !i) return;
313
- const S = x.relatedTarget;
314
- S !== null && (i.contains(S) || ue(d.current, { select: !0 }));
315
- }, g = function(x) {
316
- if (document.activeElement === document.body)
317
- for (const b of x)
318
- b.removedNodes.length > 0 && ue(i);
319
- };
320
- document.addEventListener("focusin", f), document.addEventListener("focusout", w);
321
- const y = new MutationObserver(g);
322
- return i && y.observe(i, { childList: !0, subtree: !0 }), () => {
323
- document.removeEventListener("focusin", f), document.removeEventListener("focusout", w), y.disconnect();
324
- };
325
- }
326
- }, [o, i, h.paused]), u.useEffect(() => {
327
- if (i) {
328
- Xt.add(h);
329
- const f = document.activeElement;
330
- if (!i.contains(f)) {
331
- const g = new CustomEvent(dt, Yt);
332
- i.addEventListener(dt, l), i.dispatchEvent(g), g.defaultPrevented || (ir(ur(xn(i)), { select: !0 }), document.activeElement === f && ue(i));
333
- }
334
- return () => {
335
- i.removeEventListener(dt, l), setTimeout(() => {
336
- const g = new CustomEvent(pt, Yt);
337
- i.addEventListener(pt, m), i.dispatchEvent(g), g.defaultPrevented || ue(f ?? document.body, { select: !0 }), i.removeEventListener(pt, m), Xt.remove(h);
338
- }, 0);
339
- };
340
- }
341
- }, [i, l, m, h]);
342
- const p = u.useCallback(
343
- (f) => {
344
- if (!n && !o || h.paused) return;
345
- const w = f.key === "Tab" && !f.altKey && !f.ctrlKey && !f.metaKey, g = document.activeElement;
346
- if (w && g) {
347
- const y = f.currentTarget, [x, S] = sr(y);
348
- x && S ? !f.shiftKey && g === S ? (f.preventDefault(), n && ue(x, { select: !0 })) : f.shiftKey && g === x && (f.preventDefault(), n && ue(S, { select: !0 })) : g === y && f.preventDefault();
349
- }
350
- },
351
- [n, o, h.paused]
352
- );
353
- return /* @__PURE__ */ C(U.div, { tabIndex: -1, ...c, ref: v, onKeyDown: p });
354
- });
355
- yn.displayName = rr;
356
- function ir(e, { select: t = !1 } = {}) {
357
- const n = document.activeElement;
358
- for (const o of e)
359
- if (ue(o, { select: t }), document.activeElement !== n) return;
360
- }
361
- function sr(e) {
362
- const t = xn(e), n = jt(t, e), o = jt(t.reverse(), e);
363
- return [n, o];
364
- }
365
- function xn(e) {
366
- const t = [], n = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
367
- acceptNode: (o) => {
368
- const r = o.tagName === "INPUT" && o.type === "hidden";
369
- return o.disabled || o.hidden || r ? NodeFilter.FILTER_SKIP : o.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
370
- }
371
- });
372
- for (; n.nextNode(); ) t.push(n.currentNode);
373
- return t;
374
- }
375
- function jt(e, t) {
376
- for (const n of e)
377
- if (!cr(n, { upTo: t })) return n;
378
- }
379
- function cr(e, { upTo: t }) {
380
- if (getComputedStyle(e).visibility === "hidden") return !0;
381
- for (; e; ) {
382
- if (t !== void 0 && e === t) return !1;
383
- if (getComputedStyle(e).display === "none") return !0;
384
- e = e.parentElement;
385
- }
386
- return !1;
387
- }
388
- function ar(e) {
389
- return e instanceof HTMLInputElement && "select" in e;
390
- }
391
- function ue(e, { select: t = !1 } = {}) {
392
- if (e && e.focus) {
393
- const n = document.activeElement;
394
- e.focus({ preventScroll: !0 }), e !== n && ar(e) && t && e.select();
395
- }
396
- }
397
- var Xt = lr();
398
- function lr() {
399
- let e = [];
400
- return {
401
- add(t) {
402
- const n = e[0];
403
- t !== n && (n == null || n.pause()), e = Gt(e, t), e.unshift(t);
404
- },
405
- remove(t) {
406
- var n;
407
- e = Gt(e, t), (n = e[0]) == null || n.resume();
408
- }
409
- };
410
- }
411
- function Gt(e, t) {
412
- const n = [...e], o = n.indexOf(t);
413
- return o !== -1 && n.splice(o, 1), n;
414
- }
415
- function ur(e) {
416
- return e.filter((t) => t.tagName !== "A");
417
- }
418
- var fr = u.useId || (() => {
419
- }), dr = 0;
420
- function Ot(e) {
421
- const [t, n] = u.useState(fr());
422
- return q(() => {
423
- n((o) => o ?? String(dr++));
424
- }, [e]), t ? `radix-${t}` : "";
425
- }
426
- const pr = ["top", "right", "bottom", "left"], te = Math.min, X = Math.max, Je = Math.round, Ke = Math.floor, pe = (e) => ({
427
- x: e,
428
- y: e
429
- }), mr = {
430
- left: "right",
431
- right: "left",
432
- bottom: "top",
433
- top: "bottom"
434
- }, hr = {
435
- start: "end",
436
- end: "start"
437
- };
438
- function xt(e, t, n) {
439
- return X(e, te(t, n));
440
- }
441
- function se(e, t) {
442
- return typeof e == "function" ? e(t) : e;
443
- }
444
- function ce(e) {
445
- return e.split("-")[0];
446
- }
447
- function Ne(e) {
448
- return e.split("-")[1];
449
- }
450
- function Nt(e) {
451
- return e === "x" ? "y" : "x";
452
- }
453
- function It(e) {
454
- return e === "y" ? "height" : "width";
455
- }
456
- function me(e) {
457
- return ["top", "bottom"].includes(ce(e)) ? "y" : "x";
458
- }
459
- function Mt(e) {
460
- return Nt(me(e));
461
- }
462
- function vr(e, t, n) {
463
- n === void 0 && (n = !1);
464
- const o = Ne(e), r = Mt(e), s = It(r);
465
- let c = r === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
466
- return t.reference[s] > t.floating[s] && (c = et(c)), [c, et(c)];
467
- }
468
- function gr(e) {
469
- const t = et(e);
470
- return [St(e), t, St(t)];
471
- }
472
- function St(e) {
473
- return e.replace(/start|end/g, (t) => hr[t]);
474
- }
475
- function wr(e, t, n) {
476
- const o = ["left", "right"], r = ["right", "left"], s = ["top", "bottom"], c = ["bottom", "top"];
477
- switch (e) {
478
- case "top":
479
- case "bottom":
480
- return n ? t ? r : o : t ? o : r;
481
- case "left":
482
- case "right":
483
- return t ? s : c;
484
- default:
485
- return [];
486
- }
487
- }
488
- function yr(e, t, n, o) {
489
- const r = Ne(e);
490
- let s = wr(ce(e), n === "start", o);
491
- return r && (s = s.map((c) => c + "-" + r), t && (s = s.concat(s.map(St)))), s;
492
- }
493
- function et(e) {
494
- return e.replace(/left|right|bottom|top/g, (t) => mr[t]);
495
- }
496
- function xr(e) {
497
- return {
498
- top: 0,
499
- right: 0,
500
- bottom: 0,
501
- left: 0,
502
- ...e
503
- };
504
- }
505
- function Sn(e) {
506
- return typeof e != "number" ? xr(e) : {
507
- top: e,
508
- right: e,
509
- bottom: e,
510
- left: e
511
- };
512
- }
513
- function tt(e) {
514
- const {
515
- x: t,
516
- y: n,
517
- width: o,
518
- height: r
519
- } = e;
520
- return {
521
- width: o,
522
- height: r,
523
- top: n,
524
- left: t,
525
- right: t + o,
526
- bottom: n + r,
527
- x: t,
528
- y: n
529
- };
530
- }
531
- function qt(e, t, n) {
532
- let {
533
- reference: o,
534
- floating: r
535
- } = e;
536
- const s = me(t), c = Mt(t), i = It(c), a = ce(t), l = s === "y", m = o.x + o.width / 2 - r.width / 2, d = o.y + o.height / 2 - r.height / 2, v = o[i] / 2 - r[i] / 2;
537
- let h;
538
- switch (a) {
539
- case "top":
540
- h = {
541
- x: m,
542
- y: o.y - r.height
543
- };
544
- break;
545
- case "bottom":
546
- h = {
547
- x: m,
548
- y: o.y + o.height
549
- };
550
- break;
551
- case "right":
552
- h = {
553
- x: o.x + o.width,
554
- y: d
555
- };
556
- break;
557
- case "left":
558
- h = {
559
- x: o.x - r.width,
560
- y: d
561
- };
562
- break;
563
- default:
564
- h = {
565
- x: o.x,
566
- y: o.y
567
- };
568
- }
569
- switch (Ne(t)) {
570
- case "start":
571
- h[c] -= v * (n && l ? -1 : 1);
572
- break;
573
- case "end":
574
- h[c] += v * (n && l ? -1 : 1);
575
- break;
576
- }
577
- return h;
578
- }
579
- const Sr = async (e, t, n) => {
580
- const {
581
- placement: o = "bottom",
582
- strategy: r = "absolute",
583
- middleware: s = [],
584
- platform: c
585
- } = n, i = s.filter(Boolean), a = await (c.isRTL == null ? void 0 : c.isRTL(t));
586
- let l = await c.getElementRects({
587
- reference: e,
588
- floating: t,
589
- strategy: r
590
- }), {
591
- x: m,
592
- y: d
593
- } = qt(l, o, a), v = o, h = {}, p = 0;
594
- for (let f = 0; f < i.length; f++) {
595
- const {
596
- name: w,
597
- fn: g
598
- } = i[f], {
599
- x: y,
600
- y: x,
601
- data: S,
602
- reset: b
603
- } = await g({
604
- x: m,
605
- y: d,
606
- initialPlacement: o,
607
- placement: v,
608
- strategy: r,
609
- middlewareData: h,
610
- rects: l,
611
- platform: c,
612
- elements: {
613
- reference: e,
614
- floating: t
615
- }
616
- });
617
- m = y ?? m, d = x ?? d, h = {
618
- ...h,
619
- [w]: {
620
- ...h[w],
621
- ...S
622
- }
623
- }, b && p <= 50 && (p++, typeof b == "object" && (b.placement && (v = b.placement), b.rects && (l = b.rects === !0 ? await c.getElementRects({
624
- reference: e,
625
- floating: t,
626
- strategy: r
627
- }) : b.rects), {
628
- x: m,
629
- y: d
630
- } = qt(l, v, a)), f = -1);
631
- }
632
- return {
633
- x: m,
634
- y: d,
635
- placement: v,
636
- strategy: r,
637
- middlewareData: h
638
- };
639
- };
640
- async function $e(e, t) {
641
- var n;
642
- t === void 0 && (t = {});
643
- const {
644
- x: o,
645
- y: r,
646
- platform: s,
647
- rects: c,
648
- elements: i,
649
- strategy: a
650
- } = e, {
651
- boundary: l = "clippingAncestors",
652
- rootBoundary: m = "viewport",
653
- elementContext: d = "floating",
654
- altBoundary: v = !1,
655
- padding: h = 0
656
- } = se(t, e), p = Sn(h), w = i[v ? d === "floating" ? "reference" : "floating" : d], g = tt(await s.getClippingRect({
657
- element: (n = await (s.isElement == null ? void 0 : s.isElement(w))) == null || n ? w : w.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(i.floating)),
658
- boundary: l,
659
- rootBoundary: m,
660
- strategy: a
661
- })), y = d === "floating" ? {
662
- x: o,
663
- y: r,
664
- width: c.floating.width,
665
- height: c.floating.height
666
- } : c.reference, x = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(i.floating)), S = await (s.isElement == null ? void 0 : s.isElement(x)) ? await (s.getScale == null ? void 0 : s.getScale(x)) || {
667
- x: 1,
668
- y: 1
669
- } : {
670
- x: 1,
671
- y: 1
672
- }, b = tt(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
673
- elements: i,
674
- rect: y,
675
- offsetParent: x,
676
- strategy: a
677
- }) : y);
678
- return {
679
- top: (g.top - b.top + p.top) / S.y,
680
- bottom: (b.bottom - g.bottom + p.bottom) / S.y,
681
- left: (g.left - b.left + p.left) / S.x,
682
- right: (b.right - g.right + p.right) / S.x
683
- };
684
- }
685
- const br = (e) => ({
686
- name: "arrow",
687
- options: e,
688
- async fn(t) {
689
- const {
690
- x: n,
691
- y: o,
692
- placement: r,
693
- rects: s,
694
- platform: c,
695
- elements: i,
696
- middlewareData: a
697
- } = t, {
698
- element: l,
699
- padding: m = 0
700
- } = se(e, t) || {};
701
- if (l == null)
702
- return {};
703
- const d = Sn(m), v = {
704
- x: n,
705
- y: o
706
- }, h = Mt(r), p = It(h), f = await c.getDimensions(l), w = h === "y", g = w ? "top" : "left", y = w ? "bottom" : "right", x = w ? "clientHeight" : "clientWidth", S = s.reference[p] + s.reference[h] - v[h] - s.floating[p], b = v[h] - s.reference[h], P = await (c.getOffsetParent == null ? void 0 : c.getOffsetParent(l));
707
- let E = P ? P[x] : 0;
708
- (!E || !await (c.isElement == null ? void 0 : c.isElement(P))) && (E = i.floating[x] || s.floating[p]);
709
- const T = S / 2 - b / 2, N = E / 2 - f[p] / 2 - 1, I = te(d[g], N), H = te(d[y], N), B = I, V = E - f[p] - H, O = E / 2 - f[p] / 2 + T, _ = xt(B, O, V), W = !a.arrow && Ne(r) != null && O !== _ && s.reference[p] / 2 - (O < B ? I : H) - f[p] / 2 < 0, A = W ? O < B ? O - B : O - V : 0;
710
- return {
711
- [h]: v[h] + A,
712
- data: {
713
- [h]: _,
714
- centerOffset: O - _ - A,
715
- ...W && {
716
- alignmentOffset: A
717
- }
718
- },
719
- reset: W
720
- };
721
- }
722
- }), Cr = function(e) {
723
- return e === void 0 && (e = {}), {
724
- name: "flip",
725
- options: e,
726
- async fn(t) {
727
- var n, o;
728
- const {
729
- placement: r,
730
- middlewareData: s,
731
- rects: c,
732
- initialPlacement: i,
733
- platform: a,
734
- elements: l
735
- } = t, {
736
- mainAxis: m = !0,
737
- crossAxis: d = !0,
738
- fallbackPlacements: v,
739
- fallbackStrategy: h = "bestFit",
740
- fallbackAxisSideDirection: p = "none",
741
- flipAlignment: f = !0,
742
- ...w
743
- } = se(e, t);
744
- if ((n = s.arrow) != null && n.alignmentOffset)
745
- return {};
746
- const g = ce(r), y = me(i), x = ce(i) === i, S = await (a.isRTL == null ? void 0 : a.isRTL(l.floating)), b = v || (x || !f ? [et(i)] : gr(i)), P = p !== "none";
747
- !v && P && b.push(...yr(i, f, p, S));
748
- const E = [i, ...b], T = await $e(t, w), N = [];
749
- let I = ((o = s.flip) == null ? void 0 : o.overflows) || [];
750
- if (m && N.push(T[g]), d) {
751
- const O = vr(r, c, S);
752
- N.push(T[O[0]], T[O[1]]);
753
- }
754
- if (I = [...I, {
755
- placement: r,
756
- overflows: N
757
- }], !N.every((O) => O <= 0)) {
758
- var H, B;
759
- const O = (((H = s.flip) == null ? void 0 : H.index) || 0) + 1, _ = E[O];
760
- if (_)
761
- return {
762
- data: {
763
- index: O,
764
- overflows: I
765
- },
766
- reset: {
767
- placement: _
768
- }
769
- };
770
- let W = (B = I.filter((A) => A.overflows[0] <= 0).sort((A, D) => A.overflows[1] - D.overflows[1])[0]) == null ? void 0 : B.placement;
771
- if (!W)
772
- switch (h) {
773
- case "bestFit": {
774
- var V;
775
- const A = (V = I.filter((D) => {
776
- if (P) {
777
- const k = me(D.placement);
778
- return k === y || // Create a bias to the `y` side axis due to horizontal
779
- // reading directions favoring greater width.
780
- k === "y";
781
- }
782
- return !0;
783
- }).map((D) => [D.placement, D.overflows.filter((k) => k > 0).reduce((k, we) => k + we, 0)]).sort((D, k) => D[1] - k[1])[0]) == null ? void 0 : V[0];
784
- A && (W = A);
785
- break;
786
- }
787
- case "initialPlacement":
788
- W = i;
789
- break;
790
- }
791
- if (r !== W)
792
- return {
793
- reset: {
794
- placement: W
795
- }
796
- };
797
- }
798
- return {};
799
- }
800
- };
801
- };
802
- function Zt(e, t) {
803
- return {
804
- top: e.top - t.height,
805
- right: e.right - t.width,
806
- bottom: e.bottom - t.height,
807
- left: e.left - t.width
808
- };
809
- }
810
- function Qt(e) {
811
- return pr.some((t) => e[t] >= 0);
812
- }
813
- const Er = function(e) {
814
- return e === void 0 && (e = {}), {
815
- name: "hide",
816
- options: e,
817
- async fn(t) {
818
- const {
819
- rects: n
820
- } = t, {
821
- strategy: o = "referenceHidden",
822
- ...r
823
- } = se(e, t);
824
- switch (o) {
825
- case "referenceHidden": {
826
- const s = await $e(t, {
827
- ...r,
828
- elementContext: "reference"
829
- }), c = Zt(s, n.reference);
830
- return {
831
- data: {
832
- referenceHiddenOffsets: c,
833
- referenceHidden: Qt(c)
834
- }
835
- };
836
- }
837
- case "escaped": {
838
- const s = await $e(t, {
839
- ...r,
840
- altBoundary: !0
841
- }), c = Zt(s, n.floating);
842
- return {
843
- data: {
844
- escapedOffsets: c,
845
- escaped: Qt(c)
846
- }
847
- };
848
- }
849
- default:
850
- return {};
851
- }
852
- }
853
- };
854
- };
855
- async function Pr(e, t) {
856
- const {
857
- placement: n,
858
- platform: o,
859
- elements: r
860
- } = e, s = await (o.isRTL == null ? void 0 : o.isRTL(r.floating)), c = ce(n), i = Ne(n), a = me(n) === "y", l = ["left", "top"].includes(c) ? -1 : 1, m = s && a ? -1 : 1, d = se(t, e);
861
- let {
862
- mainAxis: v,
863
- crossAxis: h,
864
- alignmentAxis: p
865
- } = typeof d == "number" ? {
866
- mainAxis: d,
867
- crossAxis: 0,
868
- alignmentAxis: null
869
- } : {
870
- mainAxis: 0,
871
- crossAxis: 0,
872
- alignmentAxis: null,
873
- ...d
874
- };
875
- return i && typeof p == "number" && (h = i === "end" ? p * -1 : p), a ? {
876
- x: h * m,
877
- y: v * l
878
- } : {
879
- x: v * l,
880
- y: h * m
881
- };
882
- }
883
- const Rr = function(e) {
884
- return e === void 0 && (e = 0), {
885
- name: "offset",
886
- options: e,
887
- async fn(t) {
888
- var n, o;
889
- const {
890
- x: r,
891
- y: s,
892
- placement: c,
893
- middlewareData: i
894
- } = t, a = await Pr(t, e);
895
- return c === ((n = i.offset) == null ? void 0 : n.placement) && (o = i.arrow) != null && o.alignmentOffset ? {} : {
896
- x: r + a.x,
897
- y: s + a.y,
898
- data: {
899
- ...a,
900
- placement: c
901
- }
902
- };
903
- }
904
- };
905
- }, Ar = function(e) {
906
- return e === void 0 && (e = {}), {
907
- name: "shift",
908
- options: e,
909
- async fn(t) {
910
- const {
911
- x: n,
912
- y: o,
913
- placement: r
914
- } = t, {
915
- mainAxis: s = !0,
916
- crossAxis: c = !1,
917
- limiter: i = {
918
- fn: (w) => {
919
- let {
920
- x: g,
921
- y
922
- } = w;
923
- return {
924
- x: g,
925
- y
926
- };
927
- }
928
- },
929
- ...a
930
- } = se(e, t), l = {
931
- x: n,
932
- y: o
933
- }, m = await $e(t, a), d = me(ce(r)), v = Nt(d);
934
- let h = l[v], p = l[d];
935
- if (s) {
936
- const w = v === "y" ? "top" : "left", g = v === "y" ? "bottom" : "right", y = h + m[w], x = h - m[g];
937
- h = xt(y, h, x);
938
- }
939
- if (c) {
940
- const w = d === "y" ? "top" : "left", g = d === "y" ? "bottom" : "right", y = p + m[w], x = p - m[g];
941
- p = xt(y, p, x);
942
- }
943
- const f = i.fn({
944
- ...t,
945
- [v]: h,
946
- [d]: p
947
- });
948
- return {
949
- ...f,
950
- data: {
951
- x: f.x - n,
952
- y: f.y - o
953
- }
954
- };
955
- }
956
- };
957
- }, Tr = function(e) {
958
- return e === void 0 && (e = {}), {
959
- options: e,
960
- fn(t) {
961
- const {
962
- x: n,
963
- y: o,
964
- placement: r,
965
- rects: s,
966
- middlewareData: c
967
- } = t, {
968
- offset: i = 0,
969
- mainAxis: a = !0,
970
- crossAxis: l = !0
971
- } = se(e, t), m = {
972
- x: n,
973
- y: o
974
- }, d = me(r), v = Nt(d);
975
- let h = m[v], p = m[d];
976
- const f = se(i, t), w = typeof f == "number" ? {
977
- mainAxis: f,
978
- crossAxis: 0
979
- } : {
980
- mainAxis: 0,
981
- crossAxis: 0,
982
- ...f
983
- };
984
- if (a) {
985
- const x = v === "y" ? "height" : "width", S = s.reference[v] - s.floating[x] + w.mainAxis, b = s.reference[v] + s.reference[x] - w.mainAxis;
986
- h < S ? h = S : h > b && (h = b);
987
- }
988
- if (l) {
989
- var g, y;
990
- const x = v === "y" ? "width" : "height", S = ["top", "left"].includes(ce(r)), b = s.reference[d] - s.floating[x] + (S && ((g = c.offset) == null ? void 0 : g[d]) || 0) + (S ? 0 : w.crossAxis), P = s.reference[d] + s.reference[x] + (S ? 0 : ((y = c.offset) == null ? void 0 : y[d]) || 0) - (S ? w.crossAxis : 0);
991
- p < b ? p = b : p > P && (p = P);
992
- }
993
- return {
994
- [v]: h,
995
- [d]: p
996
- };
997
- }
998
- };
999
- }, _r = function(e) {
1000
- return e === void 0 && (e = {}), {
1001
- name: "size",
1002
- options: e,
1003
- async fn(t) {
1004
- const {
1005
- placement: n,
1006
- rects: o,
1007
- platform: r,
1008
- elements: s
1009
- } = t, {
1010
- apply: c = () => {
1011
- },
1012
- ...i
1013
- } = se(e, t), a = await $e(t, i), l = ce(n), m = Ne(n), d = me(n) === "y", {
1014
- width: v,
1015
- height: h
1016
- } = o.floating;
1017
- let p, f;
1018
- l === "top" || l === "bottom" ? (p = l, f = m === (await (r.isRTL == null ? void 0 : r.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (f = l, p = m === "end" ? "top" : "bottom");
1019
- const w = h - a.top - a.bottom, g = v - a.left - a.right, y = te(h - a[p], w), x = te(v - a[f], g), S = !t.middlewareData.shift;
1020
- let b = y, P = x;
1021
- if (d ? P = m || S ? te(x, g) : g : b = m || S ? te(y, w) : w, S && !m) {
1022
- const T = X(a.left, 0), N = X(a.right, 0), I = X(a.top, 0), H = X(a.bottom, 0);
1023
- d ? P = v - 2 * (T !== 0 || N !== 0 ? T + N : X(a.left, a.right)) : b = h - 2 * (I !== 0 || H !== 0 ? I + H : X(a.top, a.bottom));
1024
- }
1025
- await c({
1026
- ...t,
1027
- availableWidth: P,
1028
- availableHeight: b
1029
- });
1030
- const E = await r.getDimensions(s.floating);
1031
- return v !== E.width || h !== E.height ? {
1032
- reset: {
1033
- rects: !0
1034
- }
1035
- } : {};
1036
- }
1037
- };
1038
- };
1039
- function Ie(e) {
1040
- return bn(e) ? (e.nodeName || "").toLowerCase() : "#document";
1041
- }
1042
- function G(e) {
1043
- var t;
1044
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
1045
- }
1046
- function ae(e) {
1047
- var t;
1048
- return (t = (bn(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
1049
- }
1050
- function bn(e) {
1051
- return e instanceof Node || e instanceof G(e).Node;
1052
- }
1053
- function ne(e) {
1054
- return e instanceof Element || e instanceof G(e).Element;
1055
- }
1056
- function oe(e) {
1057
- return e instanceof HTMLElement || e instanceof G(e).HTMLElement;
1058
- }
1059
- function Jt(e) {
1060
- return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof G(e).ShadowRoot;
1061
- }
1062
- function Ve(e) {
1063
- const {
1064
- overflow: t,
1065
- overflowX: n,
1066
- overflowY: o,
1067
- display: r
1068
- } = J(e);
1069
- return /auto|scroll|overlay|hidden|clip/.test(t + o + n) && !["inline", "contents"].includes(r);
1070
- }
1071
- function Or(e) {
1072
- return ["table", "td", "th"].includes(Ie(e));
1073
- }
1074
- function rt(e) {
1075
- return [":popover-open", ":modal"].some((t) => {
1076
- try {
1077
- return e.matches(t);
1078
- } catch {
1079
- return !1;
1080
- }
1081
- });
1082
- }
1083
- function Lt(e) {
1084
- const t = Dt(), n = J(e);
1085
- return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((o) => (n.willChange || "").includes(o)) || ["paint", "layout", "strict", "content"].some((o) => (n.contain || "").includes(o));
1086
- }
1087
- function Nr(e) {
1088
- let t = he(e);
1089
- for (; oe(t) && !Oe(t); ) {
1090
- if (rt(t))
1091
- return null;
1092
- if (Lt(t))
1093
- return t;
1094
- t = he(t);
1095
- }
1096
- return null;
1097
- }
1098
- function Dt() {
1099
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1100
- }
1101
- function Oe(e) {
1102
- return ["html", "body", "#document"].includes(Ie(e));
1103
- }
1104
- function J(e) {
1105
- return G(e).getComputedStyle(e);
1106
- }
1107
- function it(e) {
1108
- return ne(e) ? {
1109
- scrollLeft: e.scrollLeft,
1110
- scrollTop: e.scrollTop
1111
- } : {
1112
- scrollLeft: e.scrollX,
1113
- scrollTop: e.scrollY
1114
- };
1115
- }
1116
- function he(e) {
1117
- if (Ie(e) === "html")
1118
- return e;
1119
- const t = (
1120
- // Step into the shadow DOM of the parent of a slotted node.
1121
- e.assignedSlot || // DOM Element detected.
1122
- e.parentNode || // ShadowRoot detected.
1123
- Jt(e) && e.host || // Fallback.
1124
- ae(e)
1125
- );
1126
- return Jt(t) ? t.host : t;
1127
- }
1128
- function Cn(e) {
1129
- const t = he(e);
1130
- return Oe(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : oe(t) && Ve(t) ? t : Cn(t);
1131
- }
1132
- function He(e, t, n) {
1133
- var o;
1134
- t === void 0 && (t = []), n === void 0 && (n = !0);
1135
- const r = Cn(e), s = r === ((o = e.ownerDocument) == null ? void 0 : o.body), c = G(r);
1136
- return s ? t.concat(c, c.visualViewport || [], Ve(r) ? r : [], c.frameElement && n ? He(c.frameElement) : []) : t.concat(r, He(r, [], n));
1137
- }
1138
- function En(e) {
1139
- const t = J(e);
1140
- let n = parseFloat(t.width) || 0, o = parseFloat(t.height) || 0;
1141
- const r = oe(e), s = r ? e.offsetWidth : n, c = r ? e.offsetHeight : o, i = Je(n) !== s || Je(o) !== c;
1142
- return i && (n = s, o = c), {
1143
- width: n,
1144
- height: o,
1145
- $: i
1146
- };
1147
- }
1148
- function kt(e) {
1149
- return ne(e) ? e : e.contextElement;
1150
- }
1151
- function Te(e) {
1152
- const t = kt(e);
1153
- if (!oe(t))
1154
- return pe(1);
1155
- const n = t.getBoundingClientRect(), {
1156
- width: o,
1157
- height: r,
1158
- $: s
1159
- } = En(t);
1160
- let c = (s ? Je(n.width) : n.width) / o, i = (s ? Je(n.height) : n.height) / r;
1161
- return (!c || !Number.isFinite(c)) && (c = 1), (!i || !Number.isFinite(i)) && (i = 1), {
1162
- x: c,
1163
- y: i
1164
- };
1165
- }
1166
- const Ir = /* @__PURE__ */ pe(0);
1167
- function Pn(e) {
1168
- const t = G(e);
1169
- return !Dt() || !t.visualViewport ? Ir : {
1170
- x: t.visualViewport.offsetLeft,
1171
- y: t.visualViewport.offsetTop
1172
- };
1173
- }
1174
- function Mr(e, t, n) {
1175
- return t === void 0 && (t = !1), !n || t && n !== G(e) ? !1 : t;
1176
- }
1177
- function be(e, t, n, o) {
1178
- t === void 0 && (t = !1), n === void 0 && (n = !1);
1179
- const r = e.getBoundingClientRect(), s = kt(e);
1180
- let c = pe(1);
1181
- t && (o ? ne(o) && (c = Te(o)) : c = Te(e));
1182
- const i = Mr(s, n, o) ? Pn(s) : pe(0);
1183
- let a = (r.left + i.x) / c.x, l = (r.top + i.y) / c.y, m = r.width / c.x, d = r.height / c.y;
1184
- if (s) {
1185
- const v = G(s), h = o && ne(o) ? G(o) : o;
1186
- let p = v, f = p.frameElement;
1187
- for (; f && o && h !== p; ) {
1188
- const w = Te(f), g = f.getBoundingClientRect(), y = J(f), x = g.left + (f.clientLeft + parseFloat(y.paddingLeft)) * w.x, S = g.top + (f.clientTop + parseFloat(y.paddingTop)) * w.y;
1189
- a *= w.x, l *= w.y, m *= w.x, d *= w.y, a += x, l += S, p = G(f), f = p.frameElement;
1190
- }
1191
- }
1192
- return tt({
1193
- width: m,
1194
- height: d,
1195
- x: a,
1196
- y: l
1197
- });
1198
- }
1199
- function Lr(e) {
1200
- let {
1201
- elements: t,
1202
- rect: n,
1203
- offsetParent: o,
1204
- strategy: r
1205
- } = e;
1206
- const s = r === "fixed", c = ae(o), i = t ? rt(t.floating) : !1;
1207
- if (o === c || i && s)
1208
- return n;
1209
- let a = {
1210
- scrollLeft: 0,
1211
- scrollTop: 0
1212
- }, l = pe(1);
1213
- const m = pe(0), d = oe(o);
1214
- if ((d || !d && !s) && ((Ie(o) !== "body" || Ve(c)) && (a = it(o)), oe(o))) {
1215
- const v = be(o);
1216
- l = Te(o), m.x = v.x + o.clientLeft, m.y = v.y + o.clientTop;
1217
- }
1218
- return {
1219
- width: n.width * l.x,
1220
- height: n.height * l.y,
1221
- x: n.x * l.x - a.scrollLeft * l.x + m.x,
1222
- y: n.y * l.y - a.scrollTop * l.y + m.y
1223
- };
1224
- }
1225
- function Dr(e) {
1226
- return Array.from(e.getClientRects());
1227
- }
1228
- function Rn(e) {
1229
- return be(ae(e)).left + it(e).scrollLeft;
1230
- }
1231
- function kr(e) {
1232
- const t = ae(e), n = it(e), o = e.ownerDocument.body, r = X(t.scrollWidth, t.clientWidth, o.scrollWidth, o.clientWidth), s = X(t.scrollHeight, t.clientHeight, o.scrollHeight, o.clientHeight);
1233
- let c = -n.scrollLeft + Rn(e);
1234
- const i = -n.scrollTop;
1235
- return J(o).direction === "rtl" && (c += X(t.clientWidth, o.clientWidth) - r), {
1236
- width: r,
1237
- height: s,
1238
- x: c,
1239
- y: i
1240
- };
1241
- }
1242
- function Br(e, t) {
1243
- const n = G(e), o = ae(e), r = n.visualViewport;
1244
- let s = o.clientWidth, c = o.clientHeight, i = 0, a = 0;
1245
- if (r) {
1246
- s = r.width, c = r.height;
1247
- const l = Dt();
1248
- (!l || l && t === "fixed") && (i = r.offsetLeft, a = r.offsetTop);
1249
- }
1250
- return {
1251
- width: s,
1252
- height: c,
1253
- x: i,
1254
- y: a
1255
- };
1256
- }
1257
- function Fr(e, t) {
1258
- const n = be(e, !0, t === "fixed"), o = n.top + e.clientTop, r = n.left + e.clientLeft, s = oe(e) ? Te(e) : pe(1), c = e.clientWidth * s.x, i = e.clientHeight * s.y, a = r * s.x, l = o * s.y;
1259
- return {
1260
- width: c,
1261
- height: i,
1262
- x: a,
1263
- y: l
1264
- };
1265
- }
1266
- function en(e, t, n) {
1267
- let o;
1268
- if (t === "viewport")
1269
- o = Br(e, n);
1270
- else if (t === "document")
1271
- o = kr(ae(e));
1272
- else if (ne(t))
1273
- o = Fr(t, n);
1274
- else {
1275
- const r = Pn(e);
1276
- o = {
1277
- ...t,
1278
- x: t.x - r.x,
1279
- y: t.y - r.y
1280
- };
1281
- }
1282
- return tt(o);
1283
- }
1284
- function An(e, t) {
1285
- const n = he(e);
1286
- return n === t || !ne(n) || Oe(n) ? !1 : J(n).position === "fixed" || An(n, t);
1287
- }
1288
- function Wr(e, t) {
1289
- const n = t.get(e);
1290
- if (n)
1291
- return n;
1292
- let o = He(e, [], !1).filter((i) => ne(i) && Ie(i) !== "body"), r = null;
1293
- const s = J(e).position === "fixed";
1294
- let c = s ? he(e) : e;
1295
- for (; ne(c) && !Oe(c); ) {
1296
- const i = J(c), a = Lt(c);
1297
- !a && i.position === "fixed" && (r = null), (s ? !a && !r : !a && i.position === "static" && !!r && ["absolute", "fixed"].includes(r.position) || Ve(c) && !a && An(e, c)) ? o = o.filter((m) => m !== c) : r = i, c = he(c);
1298
- }
1299
- return t.set(e, o), o;
1300
- }
1301
- function $r(e) {
1302
- let {
1303
- element: t,
1304
- boundary: n,
1305
- rootBoundary: o,
1306
- strategy: r
1307
- } = e;
1308
- const c = [...n === "clippingAncestors" ? rt(t) ? [] : Wr(t, this._c) : [].concat(n), o], i = c[0], a = c.reduce((l, m) => {
1309
- const d = en(t, m, r);
1310
- return l.top = X(d.top, l.top), l.right = te(d.right, l.right), l.bottom = te(d.bottom, l.bottom), l.left = X(d.left, l.left), l;
1311
- }, en(t, i, r));
1312
- return {
1313
- width: a.right - a.left,
1314
- height: a.bottom - a.top,
1315
- x: a.left,
1316
- y: a.top
1317
- };
1318
- }
1319
- function Hr(e) {
1320
- const {
1321
- width: t,
1322
- height: n
1323
- } = En(e);
1324
- return {
1325
- width: t,
1326
- height: n
1327
- };
1328
- }
1329
- function Vr(e, t, n) {
1330
- const o = oe(t), r = ae(t), s = n === "fixed", c = be(e, !0, s, t);
1331
- let i = {
1332
- scrollLeft: 0,
1333
- scrollTop: 0
1334
- };
1335
- const a = pe(0);
1336
- if (o || !o && !s)
1337
- if ((Ie(t) !== "body" || Ve(r)) && (i = it(t)), o) {
1338
- const d = be(t, !0, s, t);
1339
- a.x = d.x + t.clientLeft, a.y = d.y + t.clientTop;
1340
- } else r && (a.x = Rn(r));
1341
- const l = c.left + i.scrollLeft - a.x, m = c.top + i.scrollTop - a.y;
1342
- return {
1343
- x: l,
1344
- y: m,
1345
- width: c.width,
1346
- height: c.height
1347
- };
1348
- }
1349
- function mt(e) {
1350
- return J(e).position === "static";
1351
- }
1352
- function tn(e, t) {
1353
- return !oe(e) || J(e).position === "fixed" ? null : t ? t(e) : e.offsetParent;
1354
- }
1355
- function Tn(e, t) {
1356
- const n = G(e);
1357
- if (rt(e))
1358
- return n;
1359
- if (!oe(e)) {
1360
- let r = he(e);
1361
- for (; r && !Oe(r); ) {
1362
- if (ne(r) && !mt(r))
1363
- return r;
1364
- r = he(r);
1365
- }
1366
- return n;
1367
- }
1368
- let o = tn(e, t);
1369
- for (; o && Or(o) && mt(o); )
1370
- o = tn(o, t);
1371
- return o && Oe(o) && mt(o) && !Lt(o) ? n : o || Nr(e) || n;
1372
- }
1373
- const Ur = async function(e) {
1374
- const t = this.getOffsetParent || Tn, n = this.getDimensions, o = await n(e.floating);
1375
- return {
1376
- reference: Vr(e.reference, await t(e.floating), e.strategy),
1377
- floating: {
1378
- x: 0,
1379
- y: 0,
1380
- width: o.width,
1381
- height: o.height
1382
- }
1383
- };
1384
- };
1385
- function zr(e) {
1386
- return J(e).direction === "rtl";
1387
- }
1388
- const Kr = {
1389
- convertOffsetParentRelativeRectToViewportRelativeRect: Lr,
1390
- getDocumentElement: ae,
1391
- getClippingRect: $r,
1392
- getOffsetParent: Tn,
1393
- getElementRects: Ur,
1394
- getClientRects: Dr,
1395
- getDimensions: Hr,
1396
- getScale: Te,
1397
- isElement: ne,
1398
- isRTL: zr
1399
- };
1400
- function Yr(e, t) {
1401
- let n = null, o;
1402
- const r = ae(e);
1403
- function s() {
1404
- var i;
1405
- clearTimeout(o), (i = n) == null || i.disconnect(), n = null;
1406
- }
1407
- function c(i, a) {
1408
- i === void 0 && (i = !1), a === void 0 && (a = 1), s();
1409
- const {
1410
- left: l,
1411
- top: m,
1412
- width: d,
1413
- height: v
1414
- } = e.getBoundingClientRect();
1415
- if (i || t(), !d || !v)
1416
- return;
1417
- const h = Ke(m), p = Ke(r.clientWidth - (l + d)), f = Ke(r.clientHeight - (m + v)), w = Ke(l), y = {
1418
- rootMargin: -h + "px " + -p + "px " + -f + "px " + -w + "px",
1419
- threshold: X(0, te(1, a)) || 1
1420
- };
1421
- let x = !0;
1422
- function S(b) {
1423
- const P = b[0].intersectionRatio;
1424
- if (P !== a) {
1425
- if (!x)
1426
- return c();
1427
- P ? c(!1, P) : o = setTimeout(() => {
1428
- c(!1, 1e-7);
1429
- }, 1e3);
1430
- }
1431
- x = !1;
1432
- }
1433
- try {
1434
- n = new IntersectionObserver(S, {
1435
- ...y,
1436
- // Handle <iframe>s
1437
- root: r.ownerDocument
1438
- });
1439
- } catch {
1440
- n = new IntersectionObserver(S, y);
1441
- }
1442
- n.observe(e);
1443
- }
1444
- return c(!0), s;
1445
- }
1446
- function jr(e, t, n, o) {
1447
- o === void 0 && (o = {});
1448
- const {
1449
- ancestorScroll: r = !0,
1450
- ancestorResize: s = !0,
1451
- elementResize: c = typeof ResizeObserver == "function",
1452
- layoutShift: i = typeof IntersectionObserver == "function",
1453
- animationFrame: a = !1
1454
- } = o, l = kt(e), m = r || s ? [...l ? He(l) : [], ...He(t)] : [];
1455
- m.forEach((g) => {
1456
- r && g.addEventListener("scroll", n, {
1457
- passive: !0
1458
- }), s && g.addEventListener("resize", n);
1459
- });
1460
- const d = l && i ? Yr(l, n) : null;
1461
- let v = -1, h = null;
1462
- c && (h = new ResizeObserver((g) => {
1463
- let [y] = g;
1464
- y && y.target === l && h && (h.unobserve(t), cancelAnimationFrame(v), v = requestAnimationFrame(() => {
1465
- var x;
1466
- (x = h) == null || x.observe(t);
1467
- })), n();
1468
- }), l && !a && h.observe(l), h.observe(t));
1469
- let p, f = a ? be(e) : null;
1470
- a && w();
1471
- function w() {
1472
- const g = be(e);
1473
- f && (g.x !== f.x || g.y !== f.y || g.width !== f.width || g.height !== f.height) && n(), f = g, p = requestAnimationFrame(w);
1474
- }
1475
- return n(), () => {
1476
- var g;
1477
- m.forEach((y) => {
1478
- r && y.removeEventListener("scroll", n), s && y.removeEventListener("resize", n);
1479
- }), d == null || d(), (g = h) == null || g.disconnect(), h = null, a && cancelAnimationFrame(p);
1480
- };
1481
- }
1482
- const Xr = Rr, Gr = Ar, qr = Cr, Zr = _r, Qr = Er, nn = br, Jr = Tr, ei = (e, t, n) => {
1483
- const o = /* @__PURE__ */ new Map(), r = {
1484
- platform: Kr,
1485
- ...n
1486
- }, s = {
1487
- ...r.platform,
1488
- _c: o
1489
- };
1490
- return Sr(e, t, {
1491
- ...r,
1492
- platform: s
1493
- });
1494
- };
1495
- var qe = typeof document < "u" ? To : _o;
1496
- function nt(e, t) {
1497
- if (e === t)
1498
- return !0;
1499
- if (typeof e != typeof t)
1500
- return !1;
1501
- if (typeof e == "function" && e.toString() === t.toString())
1502
- return !0;
1503
- let n, o, r;
1504
- if (e && t && typeof e == "object") {
1505
- if (Array.isArray(e)) {
1506
- if (n = e.length, n !== t.length) return !1;
1507
- for (o = n; o-- !== 0; )
1508
- if (!nt(e[o], t[o]))
1509
- return !1;
1510
- return !0;
1511
- }
1512
- if (r = Object.keys(e), n = r.length, n !== Object.keys(t).length)
1513
- return !1;
1514
- for (o = n; o-- !== 0; )
1515
- if (!{}.hasOwnProperty.call(t, r[o]))
1516
- return !1;
1517
- for (o = n; o-- !== 0; ) {
1518
- const s = r[o];
1519
- if (!(s === "_owner" && e.$$typeof) && !nt(e[s], t[s]))
1520
- return !1;
1521
- }
1522
- return !0;
1523
- }
1524
- return e !== e && t !== t;
1525
- }
1526
- function _n(e) {
1527
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1528
- }
1529
- function on(e, t) {
1530
- const n = _n(e);
1531
- return Math.round(t * n) / n;
1532
- }
1533
- function rn(e) {
1534
- const t = u.useRef(e);
1535
- return qe(() => {
1536
- t.current = e;
1537
- }), t;
1538
- }
1539
- function ti(e) {
1540
- e === void 0 && (e = {});
1541
- const {
1542
- placement: t = "bottom",
1543
- strategy: n = "absolute",
1544
- middleware: o = [],
1545
- platform: r,
1546
- elements: {
1547
- reference: s,
1548
- floating: c
1549
- } = {},
1550
- transform: i = !0,
1551
- whileElementsMounted: a,
1552
- open: l
1553
- } = e, [m, d] = u.useState({
1554
- x: 0,
1555
- y: 0,
1556
- strategy: n,
1557
- placement: t,
1558
- middlewareData: {},
1559
- isPositioned: !1
1560
- }), [v, h] = u.useState(o);
1561
- nt(v, o) || h(o);
1562
- const [p, f] = u.useState(null), [w, g] = u.useState(null), y = u.useCallback((A) => {
1563
- A !== P.current && (P.current = A, f(A));
1564
- }, []), x = u.useCallback((A) => {
1565
- A !== E.current && (E.current = A, g(A));
1566
- }, []), S = s || p, b = c || w, P = u.useRef(null), E = u.useRef(null), T = u.useRef(m), N = a != null, I = rn(a), H = rn(r), B = u.useCallback(() => {
1567
- if (!P.current || !E.current)
1568
- return;
1569
- const A = {
1570
- placement: t,
1571
- strategy: n,
1572
- middleware: v
1573
- };
1574
- H.current && (A.platform = H.current), ei(P.current, E.current, A).then((D) => {
1575
- const k = {
1576
- ...D,
1577
- isPositioned: !0
1578
- };
1579
- V.current && !nt(T.current, k) && (T.current = k, _t.flushSync(() => {
1580
- d(k);
1581
- }));
1582
- });
1583
- }, [v, t, n, H]);
1584
- qe(() => {
1585
- l === !1 && T.current.isPositioned && (T.current.isPositioned = !1, d((A) => ({
1586
- ...A,
1587
- isPositioned: !1
1588
- })));
1589
- }, [l]);
1590
- const V = u.useRef(!1);
1591
- qe(() => (V.current = !0, () => {
1592
- V.current = !1;
1593
- }), []), qe(() => {
1594
- if (S && (P.current = S), b && (E.current = b), S && b) {
1595
- if (I.current)
1596
- return I.current(S, b, B);
1597
- B();
1598
- }
1599
- }, [S, b, B, I, N]);
1600
- const O = u.useMemo(() => ({
1601
- reference: P,
1602
- floating: E,
1603
- setReference: y,
1604
- setFloating: x
1605
- }), [y, x]), _ = u.useMemo(() => ({
1606
- reference: S,
1607
- floating: b
1608
- }), [S, b]), W = u.useMemo(() => {
1609
- const A = {
1610
- position: n,
1611
- left: 0,
1612
- top: 0
1613
- };
1614
- if (!_.floating)
1615
- return A;
1616
- const D = on(_.floating, m.x), k = on(_.floating, m.y);
1617
- return i ? {
1618
- ...A,
1619
- transform: "translate(" + D + "px, " + k + "px)",
1620
- ..._n(_.floating) >= 1.5 && {
1621
- willChange: "transform"
1622
- }
1623
- } : {
1624
- position: n,
1625
- left: D,
1626
- top: k
1627
- };
1628
- }, [n, i, _.floating, m.x, m.y]);
1629
- return u.useMemo(() => ({
1630
- ...m,
1631
- update: B,
1632
- refs: O,
1633
- elements: _,
1634
- floatingStyles: W
1635
- }), [m, B, O, _, W]);
1636
- }
1637
- const ni = (e) => {
1638
- function t(n) {
1639
- return {}.hasOwnProperty.call(n, "current");
1640
- }
1641
- return {
1642
- name: "arrow",
1643
- options: e,
1644
- fn(n) {
1645
- const {
1646
- element: o,
1647
- padding: r
1648
- } = typeof e == "function" ? e(n) : e;
1649
- return o && t(o) ? o.current != null ? nn({
1650
- element: o.current,
1651
- padding: r
1652
- }).fn(n) : {} : o ? nn({
1653
- element: o,
1654
- padding: r
1655
- }).fn(n) : {};
1656
- }
1657
- };
1658
- }, oi = (e, t) => ({
1659
- ...Xr(e),
1660
- options: [e, t]
1661
- }), ri = (e, t) => ({
1662
- ...Gr(e),
1663
- options: [e, t]
1664
- }), ii = (e, t) => ({
1665
- ...Jr(e),
1666
- options: [e, t]
1667
- }), si = (e, t) => ({
1668
- ...qr(e),
1669
- options: [e, t]
1670
- }), ci = (e, t) => ({
1671
- ...Zr(e),
1672
- options: [e, t]
1673
- }), ai = (e, t) => ({
1674
- ...Qr(e),
1675
- options: [e, t]
1676
- }), li = (e, t) => ({
1677
- ...ni(e),
1678
- options: [e, t]
1679
- });
1680
- var ui = "Arrow", On = u.forwardRef((e, t) => {
1681
- const { children: n, width: o = 10, height: r = 5, ...s } = e;
1682
- return /* @__PURE__ */ C(
1683
- U.svg,
1684
- {
1685
- ...s,
1686
- ref: t,
1687
- width: o,
1688
- height: r,
1689
- viewBox: "0 0 30 10",
1690
- preserveAspectRatio: "none",
1691
- children: e.asChild ? n : /* @__PURE__ */ C("polygon", { points: "0,0 30,0 15,10" })
1692
- }
1693
- );
1694
- });
1695
- On.displayName = ui;
1696
- var fi = On;
1697
- function di(e, t) {
1698
- typeof e == "function" ? e(t) : e != null && (e.current = t);
1699
- }
1700
- function pi(...e) {
1701
- return (t) => e.forEach((n) => di(n, t));
1702
- }
1703
- function Nn(...e) {
1704
- return u.useCallback(pi(...e), e);
1705
- }
1706
- function mi(e, t = []) {
1707
- let n = [];
1708
- function o(s, c) {
1709
- const i = u.createContext(c), a = n.length;
1710
- n = [...n, c];
1711
- function l(d) {
1712
- const { scope: v, children: h, ...p } = d, f = (v == null ? void 0 : v[e][a]) || i, w = u.useMemo(() => p, Object.values(p));
1713
- return /* @__PURE__ */ C(f.Provider, { value: w, children: h });
1714
- }
1715
- function m(d, v) {
1716
- const h = (v == null ? void 0 : v[e][a]) || i, p = u.useContext(h);
1717
- if (p) return p;
1718
- if (c !== void 0) return c;
1719
- throw new Error(`\`${d}\` must be used within \`${s}\``);
1720
- }
1721
- return l.displayName = s + "Provider", [l, m];
1722
- }
1723
- const r = () => {
1724
- const s = n.map((c) => u.createContext(c));
1725
- return function(i) {
1726
- const a = (i == null ? void 0 : i[e]) || s;
1727
- return u.useMemo(
1728
- () => ({ [`__scope${e}`]: { ...i, [e]: a } }),
1729
- [i, a]
1730
- );
1731
- };
1732
- };
1733
- return r.scopeName = e, [o, hi(r, ...t)];
1734
- }
1735
- function hi(...e) {
1736
- const t = e[0];
1737
- if (e.length === 1) return t;
1738
- const n = () => {
1739
- const o = e.map((r) => ({
1740
- useScope: r(),
1741
- scopeName: r.scopeName
1742
- }));
1743
- return function(s) {
1744
- const c = o.reduce((i, { useScope: a, scopeName: l }) => {
1745
- const d = a(s)[`__scope${l}`];
1746
- return { ...i, ...d };
1747
- }, {});
1748
- return u.useMemo(() => ({ [`__scope${t.scopeName}`]: c }), [c]);
1749
- };
1750
- };
1751
- return n.scopeName = t.scopeName, n;
1752
- }
1753
- var Bt = "Popper", [In, Mn] = mi(Bt), [vi, Ln] = In(Bt), Dn = (e) => {
1754
- const { __scopePopper: t, children: n } = e, [o, r] = u.useState(null);
1755
- return /* @__PURE__ */ C(vi, { scope: t, anchor: o, onAnchorChange: r, children: n });
1756
- };
1757
- Dn.displayName = Bt;
1758
- var kn = "PopperAnchor", Bn = u.forwardRef(
1759
- (e, t) => {
1760
- const { __scopePopper: n, virtualRef: o, ...r } = e, s = Ln(kn, n), c = u.useRef(null), i = Nn(t, c);
1761
- return u.useEffect(() => {
1762
- s.onAnchorChange((o == null ? void 0 : o.current) || c.current);
1763
- }), o ? null : /* @__PURE__ */ C(U.div, { ...r, ref: i });
1764
- }
1765
- );
1766
- Bn.displayName = kn;
1767
- var Ft = "PopperContent", [gi, wi] = In(Ft), Fn = u.forwardRef(
1768
- (e, t) => {
1769
- var R, $, z, F, M, L;
1770
- const {
1771
- __scopePopper: n,
1772
- side: o = "bottom",
1773
- sideOffset: r = 0,
1774
- align: s = "center",
1775
- alignOffset: c = 0,
1776
- arrowPadding: i = 0,
1777
- avoidCollisions: a = !0,
1778
- collisionBoundary: l = [],
1779
- collisionPadding: m = 0,
1780
- sticky: d = "partial",
1781
- hideWhenDetached: v = !1,
1782
- updatePositionStrategy: h = "optimized",
1783
- onPlaced: p,
1784
- ...f
1785
- } = e, w = Ln(Ft, n), [g, y] = u.useState(null), x = Nn(t, (j) => y(j)), [S, b] = u.useState(null), P = Mo(S), E = (P == null ? void 0 : P.width) ?? 0, T = (P == null ? void 0 : P.height) ?? 0, N = o + (s !== "center" ? "-" + s : ""), I = typeof m == "number" ? m : { top: 0, right: 0, bottom: 0, left: 0, ...m }, H = Array.isArray(l) ? l : [l], B = H.length > 0, V = {
1786
- padding: I,
1787
- boundary: H.filter(xi),
1788
- // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
1789
- altBoundary: B
1790
- }, { refs: O, floatingStyles: _, placement: W, isPositioned: A, middlewareData: D } = ti({
1791
- // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
1792
- strategy: "fixed",
1793
- placement: N,
1794
- whileElementsMounted: (...j) => jr(...j, {
1795
- animationFrame: h === "always"
1796
- }),
1797
- elements: {
1798
- reference: w.anchor
1799
- },
1800
- middleware: [
1801
- oi({ mainAxis: r + T, alignmentAxis: c }),
1802
- a && ri({
1803
- mainAxis: !0,
1804
- crossAxis: !1,
1805
- limiter: d === "partial" ? ii() : void 0,
1806
- ...V
1807
- }),
1808
- a && si({ ...V }),
1809
- ci({
1810
- ...V,
1811
- apply: ({ elements: j, rects: ee, availableWidth: ke, availableHeight: Be }) => {
1812
- const { width: Fe, height: Ao } = ee.reference, ze = j.floating.style;
1813
- ze.setProperty("--radix-popper-available-width", `${ke}px`), ze.setProperty("--radix-popper-available-height", `${Be}px`), ze.setProperty("--radix-popper-anchor-width", `${Fe}px`), ze.setProperty("--radix-popper-anchor-height", `${Ao}px`);
1814
- }
1815
- }),
1816
- S && li({ element: S, padding: i }),
1817
- Si({ arrowWidth: E, arrowHeight: T }),
1818
- v && ai({ strategy: "referenceHidden", ...V })
1819
- ]
1820
- }), [k, we] = Hn(W), re = Se(p);
1821
- q(() => {
1822
- A && (re == null || re());
1823
- }, [A, re]);
1824
- const Le = (R = D.arrow) == null ? void 0 : R.x, De = ($ = D.arrow) == null ? void 0 : $.y, le = ((z = D.arrow) == null ? void 0 : z.centerOffset) !== 0, [Ee, ye] = u.useState();
1825
- return q(() => {
1826
- g && ye(window.getComputedStyle(g).zIndex);
1827
- }, [g]), /* @__PURE__ */ C(
1828
- "div",
1829
- {
1830
- ref: O.setFloating,
1831
- "data-radix-popper-content-wrapper": "",
1832
- style: {
1833
- ..._,
1834
- transform: A ? _.transform : "translate(0, -200%)",
1835
- // keep off the page when measuring
1836
- minWidth: "max-content",
1837
- zIndex: Ee,
1838
- "--radix-popper-transform-origin": [
1839
- (F = D.transformOrigin) == null ? void 0 : F.x,
1840
- (M = D.transformOrigin) == null ? void 0 : M.y
1841
- ].join(" "),
1842
- // hide the content if using the hide middleware and should be hidden
1843
- // set visibility to hidden and disable pointer events so the UI behaves
1844
- // as if the PopperContent isn't there at all
1845
- ...((L = D.hide) == null ? void 0 : L.referenceHidden) && {
1846
- visibility: "hidden",
1847
- pointerEvents: "none"
1848
- }
1849
- },
1850
- dir: e.dir,
1851
- children: /* @__PURE__ */ C(
1852
- gi,
1853
- {
1854
- scope: n,
1855
- placedSide: k,
1856
- onArrowChange: b,
1857
- arrowX: Le,
1858
- arrowY: De,
1859
- shouldHideArrow: le,
1860
- children: /* @__PURE__ */ C(
1861
- U.div,
1862
- {
1863
- "data-side": k,
1864
- "data-align": we,
1865
- ...f,
1866
- ref: x,
1867
- style: {
1868
- ...f.style,
1869
- // if the PopperContent hasn't been placed yet (not all measurements done)
1870
- // we prevent animations so that users's animation don't kick in too early referring wrong sides
1871
- animation: A ? void 0 : "none"
1872
- }
1873
- }
1874
- )
1875
- }
1876
- )
1877
- }
1878
- );
1879
- }
1880
- );
1881
- Fn.displayName = Ft;
1882
- var Wn = "PopperArrow", yi = {
1883
- top: "bottom",
1884
- right: "left",
1885
- bottom: "top",
1886
- left: "right"
1887
- }, $n = u.forwardRef(function(t, n) {
1888
- const { __scopePopper: o, ...r } = t, s = wi(Wn, o), c = yi[s.placedSide];
1889
- return (
1890
- // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
1891
- // doesn't report size as we'd expect on SVG elements.
1892
- // it reports their bounding box which is effectively the largest path inside the SVG.
1893
- /* @__PURE__ */ C(
1894
- "span",
1895
- {
1896
- ref: s.onArrowChange,
1897
- style: {
1898
- position: "absolute",
1899
- left: s.arrowX,
1900
- top: s.arrowY,
1901
- [c]: 0,
1902
- transformOrigin: {
1903
- top: "",
1904
- right: "0 0",
1905
- bottom: "center 0",
1906
- left: "100% 0"
1907
- }[s.placedSide],
1908
- transform: {
1909
- top: "translateY(100%)",
1910
- right: "translateY(50%) rotate(90deg) translateX(-50%)",
1911
- bottom: "rotate(180deg)",
1912
- left: "translateY(50%) rotate(-90deg) translateX(50%)"
1913
- }[s.placedSide],
1914
- visibility: s.shouldHideArrow ? "hidden" : void 0
1915
- },
1916
- children: /* @__PURE__ */ C(
1917
- fi,
1918
- {
1919
- ...r,
1920
- ref: n,
1921
- style: {
1922
- ...r.style,
1923
- // ensures the element can be measured correctly (mostly for if SVG)
1924
- display: "block"
1925
- }
1926
- }
1927
- )
1928
- }
1929
- )
1930
- );
1931
- });
1932
- $n.displayName = Wn;
1933
- function xi(e) {
1934
- return e !== null;
1935
- }
1936
- var Si = (e) => ({
1937
- name: "transformOrigin",
1938
- options: e,
1939
- fn(t) {
1940
- var w, g, y;
1941
- const { placement: n, rects: o, middlewareData: r } = t, c = ((w = r.arrow) == null ? void 0 : w.centerOffset) !== 0, i = c ? 0 : e.arrowWidth, a = c ? 0 : e.arrowHeight, [l, m] = Hn(n), d = { start: "0%", center: "50%", end: "100%" }[m], v = (((g = r.arrow) == null ? void 0 : g.x) ?? 0) + i / 2, h = (((y = r.arrow) == null ? void 0 : y.y) ?? 0) + a / 2;
1942
- let p = "", f = "";
1943
- return l === "bottom" ? (p = c ? d : `${v}px`, f = `${-a}px`) : l === "top" ? (p = c ? d : `${v}px`, f = `${o.floating.height + a}px`) : l === "right" ? (p = `${-a}px`, f = c ? d : `${h}px`) : l === "left" && (p = `${o.floating.width + a}px`, f = c ? d : `${h}px`), { data: { x: p, y: f } };
1944
- }
1945
- });
1946
- function Hn(e) {
1947
- const [t, n = "center"] = e.split("-");
1948
- return [t, n];
1949
- }
1950
- var bi = Dn, Ci = Bn, Ei = Fn, Pi = $n, Ri = "Portal", Vn = u.forwardRef((e, t) => {
1951
- var i;
1952
- const { container: n, ...o } = e, [r, s] = u.useState(!1);
1953
- q(() => s(!0), []);
1954
- const c = n || r && ((i = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : i.body);
1955
- return c ? Oo.createPortal(/* @__PURE__ */ C(U.div, { ...o, ref: t }), c) : null;
1956
- });
1957
- Vn.displayName = Ri;
1958
- var Ai = "VisuallyHidden", Un = u.forwardRef(
1959
- (e, t) => /* @__PURE__ */ C(
1960
- U.span,
1961
- {
1962
- ...e,
1963
- ref: t,
1964
- style: {
1965
- // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
1966
- position: "absolute",
1967
- border: 0,
1968
- width: 1,
1969
- height: 1,
1970
- padding: 0,
1971
- margin: -1,
1972
- overflow: "hidden",
1973
- clip: "rect(0, 0, 0, 0)",
1974
- whiteSpace: "nowrap",
1975
- wordWrap: "normal",
1976
- ...e.style
1977
- }
1978
- }
1979
- )
1980
- );
1981
- Un.displayName = Ai;
1982
- var Ti = function(e) {
1983
- if (typeof document > "u")
1984
- return null;
1985
- var t = Array.isArray(e) ? e[0] : e;
1986
- return t.ownerDocument.body;
1987
- }, Pe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), je = {}, ht = 0, zn = function(e) {
1988
- return e && (e.host || zn(e.parentNode));
1989
- }, _i = function(e, t) {
1990
- return t.map(function(n) {
1991
- if (e.contains(n))
1992
- return n;
1993
- var o = zn(n);
1994
- return o && e.contains(o) ? o : (console.error("aria-hidden", n, "in not contained inside", e, ". Doing nothing"), null);
1995
- }).filter(function(n) {
1996
- return !!n;
1997
- });
1998
- }, Oi = function(e, t, n, o) {
1999
- var r = _i(t, Array.isArray(e) ? e : [e]);
2000
- je[n] || (je[n] = /* @__PURE__ */ new WeakMap());
2001
- var s = je[n], c = [], i = /* @__PURE__ */ new Set(), a = new Set(r), l = function(d) {
2002
- !d || i.has(d) || (i.add(d), l(d.parentNode));
2003
- };
2004
- r.forEach(l);
2005
- var m = function(d) {
2006
- !d || a.has(d) || Array.prototype.forEach.call(d.children, function(v) {
2007
- if (i.has(v))
2008
- m(v);
2009
- else
2010
- try {
2011
- var h = v.getAttribute(o), p = h !== null && h !== "false", f = (Pe.get(v) || 0) + 1, w = (s.get(v) || 0) + 1;
2012
- Pe.set(v, f), s.set(v, w), c.push(v), f === 1 && p && Ye.set(v, !0), w === 1 && v.setAttribute(n, "true"), p || v.setAttribute(o, "true");
2013
- } catch (g) {
2014
- console.error("aria-hidden: cannot operate on ", v, g);
2015
- }
2016
- });
2017
- };
2018
- return m(t), i.clear(), ht++, function() {
2019
- c.forEach(function(d) {
2020
- var v = Pe.get(d) - 1, h = s.get(d) - 1;
2021
- Pe.set(d, v), s.set(d, h), v || (Ye.has(d) || d.removeAttribute(o), Ye.delete(d)), h || d.removeAttribute(n);
2022
- }), ht--, ht || (Pe = /* @__PURE__ */ new WeakMap(), Pe = /* @__PURE__ */ new WeakMap(), Ye = /* @__PURE__ */ new WeakMap(), je = {});
2023
- };
2024
- }, Ni = function(e, t, n) {
2025
- n === void 0 && (n = "data-aria-hidden");
2026
- var o = Array.from(Array.isArray(e) ? e : [e]), r = Ti(e);
2027
- return r ? (o.push.apply(o, Array.from(r.querySelectorAll("[aria-live]"))), Oi(o, r, n, "aria-hidden")) : function() {
2028
- return null;
2029
- };
2030
- }, Ze = "right-scroll-bar-position", Qe = "width-before-scroll-bar", Ii = "with-scroll-bars-hidden", Mi = "--removed-body-scroll-bar-size", Kn = ko(), vt = function() {
2031
- }, st = u.forwardRef(function(e, t) {
2032
- var n = u.useRef(null), o = u.useState({
2033
- onScrollCapture: vt,
2034
- onWheelCapture: vt,
2035
- onTouchMoveCapture: vt
2036
- }), r = o[0], s = o[1], c = e.forwardProps, i = e.children, a = e.className, l = e.removeScrollBar, m = e.enabled, d = e.shards, v = e.sideCar, h = e.noIsolation, p = e.inert, f = e.allowPinchZoom, w = e.as, g = w === void 0 ? "div" : w, y = e.gapMode, x = dn(e, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]), S = v, b = Bo([n, t]), P = xe(xe({}, x), r);
2037
- return u.createElement(
2038
- u.Fragment,
2039
- null,
2040
- m && u.createElement(S, { sideCar: Kn, removeScrollBar: l, shards: d, noIsolation: h, inert: p, setCallbacks: s, allowPinchZoom: !!f, lockRef: n, gapMode: y }),
2041
- c ? u.cloneElement(u.Children.only(i), xe(xe({}, P), { ref: b })) : u.createElement(g, xe({}, P, { className: a, ref: b }), i)
2042
- );
2043
- });
2044
- st.defaultProps = {
2045
- enabled: !0,
2046
- removeScrollBar: !0,
2047
- inert: !1
2048
- };
2049
- st.classNames = {
2050
- fullWidth: Qe,
2051
- zeroRight: Ze
2052
- };
2053
- var Li = function() {
2054
- if (typeof __webpack_nonce__ < "u")
2055
- return __webpack_nonce__;
2056
- };
2057
- function Di() {
2058
- if (!document)
2059
- return null;
2060
- var e = document.createElement("style");
2061
- e.type = "text/css";
2062
- var t = Li();
2063
- return t && e.setAttribute("nonce", t), e;
2064
- }
2065
- function ki(e, t) {
2066
- e.styleSheet ? e.styleSheet.cssText = t : e.appendChild(document.createTextNode(t));
2067
- }
2068
- function Bi(e) {
2069
- var t = document.head || document.getElementsByTagName("head")[0];
2070
- t.appendChild(e);
2071
- }
2072
- var Fi = function() {
2073
- var e = 0, t = null;
2074
- return {
2075
- add: function(n) {
2076
- e == 0 && (t = Di()) && (ki(t, n), Bi(t)), e++;
2077
- },
2078
- remove: function() {
2079
- e--, !e && t && (t.parentNode && t.parentNode.removeChild(t), t = null);
2080
- }
2081
- };
2082
- }, Wi = function() {
2083
- var e = Fi();
2084
- return function(t, n) {
2085
- u.useEffect(function() {
2086
- return e.add(t), function() {
2087
- e.remove();
2088
- };
2089
- }, [t && n]);
2090
- };
2091
- }, Yn = function() {
2092
- var e = Wi(), t = function(n) {
2093
- var o = n.styles, r = n.dynamic;
2094
- return e(o, r), null;
2095
- };
2096
- return t;
2097
- }, $i = {
2098
- left: 0,
2099
- top: 0,
2100
- right: 0,
2101
- gap: 0
2102
- }, gt = function(e) {
2103
- return parseInt(e || "", 10) || 0;
2104
- }, Hi = function(e) {
2105
- var t = window.getComputedStyle(document.body), n = t[e === "padding" ? "paddingLeft" : "marginLeft"], o = t[e === "padding" ? "paddingTop" : "marginTop"], r = t[e === "padding" ? "paddingRight" : "marginRight"];
2106
- return [gt(n), gt(o), gt(r)];
2107
- }, Vi = function(e) {
2108
- if (e === void 0 && (e = "margin"), typeof window > "u")
2109
- return $i;
2110
- var t = Hi(e), n = document.documentElement.clientWidth, o = window.innerWidth;
2111
- return {
2112
- left: t[0],
2113
- top: t[1],
2114
- right: t[2],
2115
- gap: Math.max(0, o - n + t[2] - t[0])
2116
- };
2117
- }, Ui = Yn(), _e = "data-scroll-locked", zi = function(e, t, n, o) {
2118
- var r = e.left, s = e.top, c = e.right, i = e.gap;
2119
- return n === void 0 && (n = "margin"), `
2120
- .`.concat(Ii, ` {
2121
- overflow: hidden `).concat(o, `;
2122
- padding-right: `).concat(i, "px ").concat(o, `;
2123
- }
2124
- body[`).concat(_e, `] {
2125
- overflow: hidden `).concat(o, `;
2126
- overscroll-behavior: contain;
2127
- `).concat([
2128
- t && "position: relative ".concat(o, ";"),
2129
- n === "margin" && `
2130
- padding-left: `.concat(r, `px;
2131
- padding-top: `).concat(s, `px;
2132
- padding-right: `).concat(c, `px;
2133
- margin-left:0;
2134
- margin-top:0;
2135
- margin-right: `).concat(i, "px ").concat(o, `;
2136
- `),
2137
- n === "padding" && "padding-right: ".concat(i, "px ").concat(o, ";")
2138
- ].filter(Boolean).join(""), `
2139
- }
2140
-
2141
- .`).concat(Ze, ` {
2142
- right: `).concat(i, "px ").concat(o, `;
2143
- }
2144
-
2145
- .`).concat(Qe, ` {
2146
- margin-right: `).concat(i, "px ").concat(o, `;
2147
- }
2148
-
2149
- .`).concat(Ze, " .").concat(Ze, ` {
2150
- right: 0 `).concat(o, `;
2151
- }
2152
-
2153
- .`).concat(Qe, " .").concat(Qe, ` {
2154
- margin-right: 0 `).concat(o, `;
2155
- }
2156
-
2157
- body[`).concat(_e, `] {
2158
- `).concat(Mi, ": ").concat(i, `px;
2159
- }
2160
- `);
2161
- }, sn = function() {
2162
- var e = parseInt(document.body.getAttribute(_e) || "0", 10);
2163
- return isFinite(e) ? e : 0;
2164
- }, Ki = function() {
2165
- u.useEffect(function() {
2166
- return document.body.setAttribute(_e, (sn() + 1).toString()), function() {
2167
- var e = sn() - 1;
2168
- e <= 0 ? document.body.removeAttribute(_e) : document.body.setAttribute(_e, e.toString());
2169
- };
2170
- }, []);
2171
- }, Yi = function(e) {
2172
- var t = e.noRelative, n = e.noImportant, o = e.gapMode, r = o === void 0 ? "margin" : o;
2173
- Ki();
2174
- var s = u.useMemo(function() {
2175
- return Vi(r);
2176
- }, [r]);
2177
- return u.createElement(Ui, { styles: zi(s, !t, r, n ? "" : "!important") });
2178
- }, bt = !1;
2179
- if (typeof window < "u")
2180
- try {
2181
- var Xe = Object.defineProperty({}, "passive", {
2182
- get: function() {
2183
- return bt = !0, !0;
2184
- }
2185
- });
2186
- window.addEventListener("test", Xe, Xe), window.removeEventListener("test", Xe, Xe);
2187
- } catch {
2188
- bt = !1;
2189
- }
2190
- var Re = bt ? { passive: !1 } : !1, ji = function(e) {
2191
- return e.tagName === "TEXTAREA";
2192
- }, jn = function(e, t) {
2193
- var n = window.getComputedStyle(e);
2194
- return (
2195
- // not-not-scrollable
2196
- n[t] !== "hidden" && // contains scroll inside self
2197
- !(n.overflowY === n.overflowX && !ji(e) && n[t] === "visible")
2198
- );
2199
- }, Xi = function(e) {
2200
- return jn(e, "overflowY");
2201
- }, Gi = function(e) {
2202
- return jn(e, "overflowX");
2203
- }, cn = function(e, t) {
2204
- var n = t.ownerDocument, o = t;
2205
- do {
2206
- typeof ShadowRoot < "u" && o instanceof ShadowRoot && (o = o.host);
2207
- var r = Xn(e, o);
2208
- if (r) {
2209
- var s = Gn(e, o), c = s[1], i = s[2];
2210
- if (c > i)
2211
- return !0;
2212
- }
2213
- o = o.parentNode;
2214
- } while (o && o !== n.body);
2215
- return !1;
2216
- }, qi = function(e) {
2217
- var t = e.scrollTop, n = e.scrollHeight, o = e.clientHeight;
2218
- return [
2219
- t,
2220
- n,
2221
- o
2222
- ];
2223
- }, Zi = function(e) {
2224
- var t = e.scrollLeft, n = e.scrollWidth, o = e.clientWidth;
2225
- return [
2226
- t,
2227
- n,
2228
- o
2229
- ];
2230
- }, Xn = function(e, t) {
2231
- return e === "v" ? Xi(t) : Gi(t);
2232
- }, Gn = function(e, t) {
2233
- return e === "v" ? qi(t) : Zi(t);
2234
- }, Qi = function(e, t) {
2235
- return e === "h" && t === "rtl" ? -1 : 1;
2236
- }, Ji = function(e, t, n, o, r) {
2237
- var s = Qi(e, window.getComputedStyle(t).direction), c = s * o, i = n.target, a = t.contains(i), l = !1, m = c > 0, d = 0, v = 0;
2238
- do {
2239
- var h = Gn(e, i), p = h[0], f = h[1], w = h[2], g = f - w - s * p;
2240
- (p || g) && Xn(e, i) && (d += g, v += p), i instanceof ShadowRoot ? i = i.host : i = i.parentNode;
2241
- } while (
2242
- // portaled content
2243
- !a && i !== document.body || // self content
2244
- a && (t.contains(i) || t === i)
2245
- );
2246
- return (m && (Math.abs(d) < 1 || !r) || !m && (Math.abs(v) < 1 || !r)) && (l = !0), l;
2247
- }, Ge = function(e) {
2248
- return "changedTouches" in e ? [e.changedTouches[0].clientX, e.changedTouches[0].clientY] : [0, 0];
2249
- }, an = function(e) {
2250
- return [e.deltaX, e.deltaY];
2251
- }, ln = function(e) {
2252
- return e && "current" in e ? e.current : e;
2253
- }, es = function(e, t) {
2254
- return e[0] === t[0] && e[1] === t[1];
2255
- }, ts = function(e) {
2256
- return `
2257
- .block-interactivity-`.concat(e, ` {pointer-events: none;}
2258
- .allow-interactivity-`).concat(e, ` {pointer-events: all;}
2259
- `);
2260
- }, ns = 0, Ae = [];
2261
- function os(e) {
2262
- var t = u.useRef([]), n = u.useRef([0, 0]), o = u.useRef(), r = u.useState(ns++)[0], s = u.useState(Yn)[0], c = u.useRef(e);
2263
- u.useEffect(function() {
2264
- c.current = e;
2265
- }, [e]), u.useEffect(function() {
2266
- if (e.inert) {
2267
- document.body.classList.add("block-interactivity-".concat(r));
2268
- var f = Do([e.lockRef.current], (e.shards || []).map(ln), !0).filter(Boolean);
2269
- return f.forEach(function(w) {
2270
- return w.classList.add("allow-interactivity-".concat(r));
2271
- }), function() {
2272
- document.body.classList.remove("block-interactivity-".concat(r)), f.forEach(function(w) {
2273
- return w.classList.remove("allow-interactivity-".concat(r));
2274
- });
2275
- };
2276
- }
2277
- }, [e.inert, e.lockRef.current, e.shards]);
2278
- var i = u.useCallback(function(f, w) {
2279
- if ("touches" in f && f.touches.length === 2)
2280
- return !c.current.allowPinchZoom;
2281
- var g = Ge(f), y = n.current, x = "deltaX" in f ? f.deltaX : y[0] - g[0], S = "deltaY" in f ? f.deltaY : y[1] - g[1], b, P = f.target, E = Math.abs(x) > Math.abs(S) ? "h" : "v";
2282
- if ("touches" in f && E === "h" && P.type === "range")
2283
- return !1;
2284
- var T = cn(E, P);
2285
- if (!T)
2286
- return !0;
2287
- if (T ? b = E : (b = E === "v" ? "h" : "v", T = cn(E, P)), !T)
2288
- return !1;
2289
- if (!o.current && "changedTouches" in f && (x || S) && (o.current = b), !b)
2290
- return !0;
2291
- var N = o.current || b;
2292
- return Ji(N, w, f, N === "h" ? x : S, !0);
2293
- }, []), a = u.useCallback(function(f) {
2294
- var w = f;
2295
- if (!(!Ae.length || Ae[Ae.length - 1] !== s)) {
2296
- var g = "deltaY" in w ? an(w) : Ge(w), y = t.current.filter(function(b) {
2297
- return b.name === w.type && (b.target === w.target || w.target === b.shadowParent) && es(b.delta, g);
2298
- })[0];
2299
- if (y && y.should) {
2300
- w.cancelable && w.preventDefault();
2301
- return;
2302
- }
2303
- if (!y) {
2304
- var x = (c.current.shards || []).map(ln).filter(Boolean).filter(function(b) {
2305
- return b.contains(w.target);
2306
- }), S = x.length > 0 ? i(w, x[0]) : !c.current.noIsolation;
2307
- S && w.cancelable && w.preventDefault();
2308
- }
2309
- }
2310
- }, []), l = u.useCallback(function(f, w, g, y) {
2311
- var x = { name: f, delta: w, target: g, should: y, shadowParent: rs(g) };
2312
- t.current.push(x), setTimeout(function() {
2313
- t.current = t.current.filter(function(S) {
2314
- return S !== x;
2315
- });
2316
- }, 1);
2317
- }, []), m = u.useCallback(function(f) {
2318
- n.current = Ge(f), o.current = void 0;
2319
- }, []), d = u.useCallback(function(f) {
2320
- l(f.type, an(f), f.target, i(f, e.lockRef.current));
2321
- }, []), v = u.useCallback(function(f) {
2322
- l(f.type, Ge(f), f.target, i(f, e.lockRef.current));
2323
- }, []);
2324
- u.useEffect(function() {
2325
- return Ae.push(s), e.setCallbacks({
2326
- onScrollCapture: d,
2327
- onWheelCapture: d,
2328
- onTouchMoveCapture: v
2329
- }), document.addEventListener("wheel", a, Re), document.addEventListener("touchmove", a, Re), document.addEventListener("touchstart", m, Re), function() {
2330
- Ae = Ae.filter(function(f) {
2331
- return f !== s;
2332
- }), document.removeEventListener("wheel", a, Re), document.removeEventListener("touchmove", a, Re), document.removeEventListener("touchstart", m, Re);
2333
- };
2334
- }, []);
2335
- var h = e.removeScrollBar, p = e.inert;
2336
- return u.createElement(
2337
- u.Fragment,
2338
- null,
2339
- p ? u.createElement(s, { styles: ts(r) }) : null,
2340
- h ? u.createElement(Yi, { gapMode: e.gapMode }) : null
2341
- );
2342
- }
2343
- function rs(e) {
2344
- for (var t = null; e !== null; )
2345
- e instanceof ShadowRoot && (t = e.host, e = e.host), e = e.parentNode;
2346
- return t;
2347
- }
2348
- const is = Wo(Kn, os);
2349
- var qn = u.forwardRef(function(e, t) {
2350
- return u.createElement(st, xe({}, e, { ref: t, sideCar: is }));
2351
- });
2352
- qn.classNames = st.classNames;
2353
- var ss = [" ", "Enter", "ArrowUp", "ArrowDown"], cs = [" ", "Enter"], Ue = "Select", [ct, at, as] = Uo(Ue), [Me, ac] = mn(Ue, [
2354
- as,
2355
- Mn
2356
- ]), lt = Mn(), [ls, ve] = Me(Ue), [us, fs] = Me(Ue), Zn = (e) => {
2357
- const {
2358
- __scopeSelect: t,
2359
- children: n,
2360
- open: o,
2361
- defaultOpen: r,
2362
- onOpenChange: s,
2363
- value: c,
2364
- defaultValue: i,
2365
- onValueChange: a,
2366
- dir: l,
2367
- name: m,
2368
- autoComplete: d,
2369
- disabled: v,
2370
- required: h
2371
- } = e, p = lt(t), [f, w] = u.useState(null), [g, y] = u.useState(null), [x, S] = u.useState(!1), b = No(l), [P = !1, E] = Ht({
2372
- prop: o,
2373
- defaultProp: r,
2374
- onChange: s
2375
- }), [T, N] = Ht({
2376
- prop: c,
2377
- defaultProp: i,
2378
- onChange: a
2379
- }), I = u.useRef(null), H = f ? !!f.closest("form") : !0, [B, V] = u.useState(/* @__PURE__ */ new Set()), O = Array.from(B).map((_) => _.props.value).join(";");
2380
- return /* @__PURE__ */ C(bi, { ...p, children: /* @__PURE__ */ fe(
2381
- ls,
2382
- {
2383
- required: h,
2384
- scope: t,
2385
- trigger: f,
2386
- onTriggerChange: w,
2387
- valueNode: g,
2388
- onValueNodeChange: y,
2389
- valueNodeHasChildren: x,
2390
- onValueNodeHasChildrenChange: S,
2391
- contentId: Ot(),
2392
- value: T,
2393
- onValueChange: N,
2394
- open: P,
2395
- onOpenChange: E,
2396
- dir: b,
2397
- triggerPointerDownPosRef: I,
2398
- disabled: v,
2399
- children: [
2400
- /* @__PURE__ */ C(ct.Provider, { scope: t, children: /* @__PURE__ */ C(
2401
- us,
2402
- {
2403
- scope: e.__scopeSelect,
2404
- onNativeOptionAdd: u.useCallback((_) => {
2405
- V((W) => new Set(W).add(_));
2406
- }, []),
2407
- onNativeOptionRemove: u.useCallback((_) => {
2408
- V((W) => {
2409
- const A = new Set(W);
2410
- return A.delete(_), A;
2411
- });
2412
- }, []),
2413
- children: n
2414
- }
2415
- ) }),
2416
- H ? /* @__PURE__ */ fe(
2417
- So,
2418
- {
2419
- "aria-hidden": !0,
2420
- required: h,
2421
- tabIndex: -1,
2422
- name: m,
2423
- autoComplete: d,
2424
- value: T,
2425
- onChange: (_) => N(_.target.value),
2426
- disabled: v,
2427
- children: [
2428
- T === void 0 ? /* @__PURE__ */ C("option", { value: "" }) : null,
2429
- Array.from(B)
2430
- ]
2431
- },
2432
- O
2433
- ) : null
2434
- ]
2435
- }
2436
- ) });
2437
- };
2438
- Zn.displayName = Ue;
2439
- var Qn = "SelectTrigger", Jn = u.forwardRef(
2440
- (e, t) => {
2441
- const { __scopeSelect: n, disabled: o = !1, ...r } = e, s = lt(n), c = ve(Qn, n), i = c.disabled || o, a = Z(t, c.onTriggerChange), l = at(n), [m, d, v] = bo((p) => {
2442
- const f = l().filter((y) => !y.disabled), w = f.find((y) => y.value === c.value), g = Co(f, p, w);
2443
- g !== void 0 && c.onValueChange(g.value);
2444
- }), h = () => {
2445
- i || (c.onOpenChange(!0), v());
2446
- };
2447
- return /* @__PURE__ */ C(Ci, { asChild: !0, ...s, children: /* @__PURE__ */ C(
2448
- U.button,
2449
- {
2450
- type: "button",
2451
- role: "combobox",
2452
- "aria-controls": c.contentId,
2453
- "aria-expanded": c.open,
2454
- "aria-required": c.required,
2455
- "aria-autocomplete": "none",
2456
- dir: c.dir,
2457
- "data-state": c.open ? "open" : "closed",
2458
- disabled: i,
2459
- "data-disabled": i ? "" : void 0,
2460
- "data-placeholder": xo(c.value) ? "" : void 0,
2461
- ...r,
2462
- ref: a,
2463
- onClick: Y(r.onClick, (p) => {
2464
- p.currentTarget.focus();
2465
- }),
2466
- onPointerDown: Y(r.onPointerDown, (p) => {
2467
- const f = p.target;
2468
- f.hasPointerCapture(p.pointerId) && f.releasePointerCapture(p.pointerId), p.button === 0 && p.ctrlKey === !1 && (h(), c.triggerPointerDownPosRef.current = {
2469
- x: Math.round(p.pageX),
2470
- y: Math.round(p.pageY)
2471
- }, p.preventDefault());
2472
- }),
2473
- onKeyDown: Y(r.onKeyDown, (p) => {
2474
- const f = m.current !== "";
2475
- !(p.ctrlKey || p.altKey || p.metaKey) && p.key.length === 1 && d(p.key), !(f && p.key === " ") && ss.includes(p.key) && (h(), p.preventDefault());
2476
- })
2477
- }
2478
- ) });
2479
- }
2480
- );
2481
- Jn.displayName = Qn;
2482
- var eo = "SelectValue", to = u.forwardRef(
2483
- (e, t) => {
2484
- const { __scopeSelect: n, className: o, style: r, children: s, placeholder: c = "", ...i } = e, a = ve(eo, n), { onValueNodeHasChildrenChange: l } = a, m = s !== void 0, d = Z(t, a.onValueNodeChange);
2485
- return q(() => {
2486
- l(m);
2487
- }, [l, m]), /* @__PURE__ */ C(
2488
- U.span,
2489
- {
2490
- ...i,
2491
- ref: d,
2492
- style: { pointerEvents: "none" },
2493
- children: xo(a.value) ? /* @__PURE__ */ C(Tt, { children: c }) : s
2494
- }
2495
- );
2496
- }
2497
- );
2498
- to.displayName = eo;
2499
- var ds = "SelectIcon", no = u.forwardRef(
2500
- (e, t) => {
2501
- const { __scopeSelect: n, children: o, ...r } = e;
2502
- return /* @__PURE__ */ C(U.span, { "aria-hidden": !0, ...r, ref: t, children: o || "▼" });
2503
- }
2504
- );
2505
- no.displayName = ds;
2506
- var ps = "SelectPortal", oo = (e) => /* @__PURE__ */ C(Vn, { asChild: !0, ...e });
2507
- oo.displayName = ps;
2508
- var Ce = "SelectContent", ro = u.forwardRef(
2509
- (e, t) => {
2510
- const n = ve(Ce, e.__scopeSelect), [o, r] = u.useState();
2511
- if (q(() => {
2512
- r(new DocumentFragment());
2513
- }, []), !n.open) {
2514
- const s = o;
2515
- return s ? _t.createPortal(
2516
- /* @__PURE__ */ C(io, { scope: e.__scopeSelect, children: /* @__PURE__ */ C(ct.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ C("div", { children: e.children }) }) }),
2517
- s
2518
- ) : null;
2519
- }
2520
- return /* @__PURE__ */ C(so, { ...e, ref: t });
2521
- }
2522
- );
2523
- ro.displayName = Ce;
2524
- var ie = 10, [io, ge] = Me(Ce), ms = "SelectContentImpl", so = u.forwardRef(
2525
- (e, t) => {
2526
- const {
2527
- __scopeSelect: n,
2528
- position: o = "item-aligned",
2529
- onCloseAutoFocus: r,
2530
- onEscapeKeyDown: s,
2531
- onPointerDownOutside: c,
2532
- //
2533
- // PopperContent props
2534
- side: i,
2535
- sideOffset: a,
2536
- align: l,
2537
- alignOffset: m,
2538
- arrowPadding: d,
2539
- collisionBoundary: v,
2540
- collisionPadding: h,
2541
- sticky: p,
2542
- hideWhenDetached: f,
2543
- avoidCollisions: w,
2544
- //
2545
- ...g
2546
- } = e, y = ve(Ce, n), [x, S] = u.useState(null), [b, P] = u.useState(null), E = Z(t, (R) => S(R)), [T, N] = u.useState(null), [I, H] = u.useState(
2547
- null
2548
- ), B = at(n), [V, O] = u.useState(!1), _ = u.useRef(!1);
2549
- u.useEffect(() => {
2550
- if (x) return Ni(x);
2551
- }, [x]), er();
2552
- const W = u.useCallback(
2553
- (R) => {
2554
- const [$, ...z] = B().map((L) => L.ref.current), [F] = z.slice(-1), M = document.activeElement;
2555
- for (const L of R)
2556
- if (L === M || (L == null || L.scrollIntoView({ block: "nearest" }), L === $ && b && (b.scrollTop = 0), L === F && b && (b.scrollTop = b.scrollHeight), L == null || L.focus(), document.activeElement !== M)) return;
2557
- },
2558
- [B, b]
2559
- ), A = u.useCallback(
2560
- () => W([T, x]),
2561
- [W, T, x]
2562
- );
2563
- u.useEffect(() => {
2564
- V && A();
2565
- }, [V, A]);
2566
- const { onOpenChange: D, triggerPointerDownPosRef: k } = y;
2567
- u.useEffect(() => {
2568
- if (x) {
2569
- let R = { x: 0, y: 0 };
2570
- const $ = (F) => {
2571
- var M, L;
2572
- R = {
2573
- x: Math.abs(Math.round(F.pageX) - (((M = k.current) == null ? void 0 : M.x) ?? 0)),
2574
- y: Math.abs(Math.round(F.pageY) - (((L = k.current) == null ? void 0 : L.y) ?? 0))
2575
- };
2576
- }, z = (F) => {
2577
- R.x <= 10 && R.y <= 10 ? F.preventDefault() : x.contains(F.target) || D(!1), document.removeEventListener("pointermove", $), k.current = null;
2578
- };
2579
- return k.current !== null && (document.addEventListener("pointermove", $), document.addEventListener("pointerup", z, { capture: !0, once: !0 })), () => {
2580
- document.removeEventListener("pointermove", $), document.removeEventListener("pointerup", z, { capture: !0 });
2581
- };
2582
- }
2583
- }, [x, D, k]), u.useEffect(() => {
2584
- const R = () => D(!1);
2585
- return window.addEventListener("blur", R), window.addEventListener("resize", R), () => {
2586
- window.removeEventListener("blur", R), window.removeEventListener("resize", R);
2587
- };
2588
- }, [D]);
2589
- const [we, re] = bo((R) => {
2590
- const $ = B().filter((M) => !M.disabled), z = $.find((M) => M.ref.current === document.activeElement), F = Co($, R, z);
2591
- F && setTimeout(() => F.ref.current.focus());
2592
- }), Le = u.useCallback(
2593
- (R, $, z) => {
2594
- const F = !_.current && !z;
2595
- (y.value !== void 0 && y.value === $ || F) && (N(R), F && (_.current = !0));
2596
- },
2597
- [y.value]
2598
- ), De = u.useCallback(() => x == null ? void 0 : x.focus(), [x]), le = u.useCallback(
2599
- (R, $, z) => {
2600
- const F = !_.current && !z;
2601
- (y.value !== void 0 && y.value === $ || F) && H(R);
2602
- },
2603
- [y.value]
2604
- ), Ee = o === "popper" ? Ct : co, ye = Ee === Ct ? {
2605
- side: i,
2606
- sideOffset: a,
2607
- align: l,
2608
- alignOffset: m,
2609
- arrowPadding: d,
2610
- collisionBoundary: v,
2611
- collisionPadding: h,
2612
- sticky: p,
2613
- hideWhenDetached: f,
2614
- avoidCollisions: w
2615
- } : {};
2616
- return /* @__PURE__ */ C(
2617
- io,
2618
- {
2619
- scope: n,
2620
- content: x,
2621
- viewport: b,
2622
- onViewportChange: P,
2623
- itemRefCallback: Le,
2624
- selectedItem: T,
2625
- onItemLeave: De,
2626
- itemTextRefCallback: le,
2627
- focusSelectedItem: A,
2628
- selectedItemText: I,
2629
- position: o,
2630
- isPositioned: V,
2631
- searchRef: we,
2632
- children: /* @__PURE__ */ C(qn, { as: wt, allowPinchZoom: !0, children: /* @__PURE__ */ C(
2633
- yn,
2634
- {
2635
- asChild: !0,
2636
- trapped: y.open,
2637
- onMountAutoFocus: (R) => {
2638
- R.preventDefault();
2639
- },
2640
- onUnmountAutoFocus: Y(r, (R) => {
2641
- var $;
2642
- ($ = y.trigger) == null || $.focus({ preventScroll: !0 }), R.preventDefault();
2643
- }),
2644
- children: /* @__PURE__ */ C(
2645
- gn,
2646
- {
2647
- asChild: !0,
2648
- disableOutsidePointerEvents: !0,
2649
- onEscapeKeyDown: s,
2650
- onPointerDownOutside: c,
2651
- onFocusOutside: (R) => R.preventDefault(),
2652
- onDismiss: () => y.onOpenChange(!1),
2653
- children: /* @__PURE__ */ C(
2654
- Ee,
2655
- {
2656
- role: "listbox",
2657
- id: y.contentId,
2658
- "data-state": y.open ? "open" : "closed",
2659
- dir: y.dir,
2660
- onContextMenu: (R) => R.preventDefault(),
2661
- ...g,
2662
- ...ye,
2663
- onPlaced: () => O(!0),
2664
- ref: E,
2665
- style: {
2666
- // flex layout so we can place the scroll buttons properly
2667
- display: "flex",
2668
- flexDirection: "column",
2669
- // reset the outline by default as the content MAY get focused
2670
- outline: "none",
2671
- ...g.style
2672
- },
2673
- onKeyDown: Y(g.onKeyDown, (R) => {
2674
- const $ = R.ctrlKey || R.altKey || R.metaKey;
2675
- if (R.key === "Tab" && R.preventDefault(), !$ && R.key.length === 1 && re(R.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(R.key)) {
2676
- let F = B().filter((M) => !M.disabled).map((M) => M.ref.current);
2677
- if (["ArrowUp", "End"].includes(R.key) && (F = F.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(R.key)) {
2678
- const M = R.target, L = F.indexOf(M);
2679
- F = F.slice(L + 1);
2680
- }
2681
- setTimeout(() => W(F)), R.preventDefault();
2682
- }
2683
- })
2684
- }
2685
- )
2686
- }
2687
- )
2688
- }
2689
- ) })
2690
- }
2691
- );
2692
- }
2693
- );
2694
- so.displayName = ms;
2695
- var hs = "SelectItemAlignedPosition", co = u.forwardRef((e, t) => {
2696
- const { __scopeSelect: n, onPlaced: o, ...r } = e, s = ve(Ce, n), c = ge(Ce, n), [i, a] = u.useState(null), [l, m] = u.useState(null), d = Z(t, (E) => m(E)), v = at(n), h = u.useRef(!1), p = u.useRef(!0), { viewport: f, selectedItem: w, selectedItemText: g, focusSelectedItem: y } = c, x = u.useCallback(() => {
2697
- if (s.trigger && s.valueNode && i && l && f && w && g) {
2698
- const E = s.trigger.getBoundingClientRect(), T = l.getBoundingClientRect(), N = s.valueNode.getBoundingClientRect(), I = g.getBoundingClientRect();
2699
- if (s.dir !== "rtl") {
2700
- const M = I.left - T.left, L = N.left - M, j = E.left - L, ee = E.width + j, ke = Math.max(ee, T.width), Be = window.innerWidth - ie, Fe = $t(L, [ie, Be - ke]);
2701
- i.style.minWidth = ee + "px", i.style.left = Fe + "px";
2702
- } else {
2703
- const M = T.right - I.right, L = window.innerWidth - N.right - M, j = window.innerWidth - E.right - L, ee = E.width + j, ke = Math.max(ee, T.width), Be = window.innerWidth - ie, Fe = $t(L, [ie, Be - ke]);
2704
- i.style.minWidth = ee + "px", i.style.right = Fe + "px";
2705
- }
2706
- const H = v(), B = window.innerHeight - ie * 2, V = f.scrollHeight, O = window.getComputedStyle(l), _ = parseInt(O.borderTopWidth, 10), W = parseInt(O.paddingTop, 10), A = parseInt(O.borderBottomWidth, 10), D = parseInt(O.paddingBottom, 10), k = _ + W + V + D + A, we = Math.min(w.offsetHeight * 5, k), re = window.getComputedStyle(f), Le = parseInt(re.paddingTop, 10), De = parseInt(re.paddingBottom, 10), le = E.top + E.height / 2 - ie, Ee = B - le, ye = w.offsetHeight / 2, R = w.offsetTop + ye, $ = _ + W + R, z = k - $;
2707
- if ($ <= le) {
2708
- const M = w === H[H.length - 1].ref.current;
2709
- i.style.bottom = "0px";
2710
- const L = l.clientHeight - f.offsetTop - f.offsetHeight, j = Math.max(
2711
- Ee,
2712
- ye + // viewport might have padding bottom, include it to avoid a scrollable viewport
2713
- (M ? De : 0) + L + A
2714
- ), ee = $ + j;
2715
- i.style.height = ee + "px";
2716
- } else {
2717
- const M = w === H[0].ref.current;
2718
- i.style.top = "0px";
2719
- const j = Math.max(
2720
- le,
2721
- _ + f.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
2722
- (M ? Le : 0) + ye
2723
- ) + z;
2724
- i.style.height = j + "px", f.scrollTop = $ - le + f.offsetTop;
2725
- }
2726
- i.style.margin = `${ie}px 0`, i.style.minHeight = we + "px", i.style.maxHeight = B + "px", o == null || o(), requestAnimationFrame(() => h.current = !0);
2727
- }
2728
- }, [
2729
- v,
2730
- s.trigger,
2731
- s.valueNode,
2732
- i,
2733
- l,
2734
- f,
2735
- w,
2736
- g,
2737
- s.dir,
2738
- o
2739
- ]);
2740
- q(() => x(), [x]);
2741
- const [S, b] = u.useState();
2742
- q(() => {
2743
- l && b(window.getComputedStyle(l).zIndex);
2744
- }, [l]);
2745
- const P = u.useCallback(
2746
- (E) => {
2747
- E && p.current === !0 && (x(), y == null || y(), p.current = !1);
2748
- },
2749
- [x, y]
2750
- );
2751
- return /* @__PURE__ */ C(
2752
- gs,
2753
- {
2754
- scope: n,
2755
- contentWrapper: i,
2756
- shouldExpandOnScrollRef: h,
2757
- onScrollButtonChange: P,
2758
- children: /* @__PURE__ */ C(
2759
- "div",
2760
- {
2761
- ref: a,
2762
- style: {
2763
- display: "flex",
2764
- flexDirection: "column",
2765
- position: "fixed",
2766
- zIndex: S
2767
- },
2768
- children: /* @__PURE__ */ C(
2769
- U.div,
2770
- {
2771
- ...r,
2772
- ref: d,
2773
- style: {
2774
- // When we get the height of the content, it includes borders. If we were to set
2775
- // the height without having `boxSizing: 'border-box'` it would be too big.
2776
- boxSizing: "border-box",
2777
- // We need to ensure the content doesn't get taller than the wrapper
2778
- maxHeight: "100%",
2779
- ...r.style
2780
- }
2781
- }
2782
- )
2783
- }
2784
- )
2785
- }
2786
- );
2787
- });
2788
- co.displayName = hs;
2789
- var vs = "SelectPopperPosition", Ct = u.forwardRef((e, t) => {
2790
- const {
2791
- __scopeSelect: n,
2792
- align: o = "start",
2793
- collisionPadding: r = ie,
2794
- ...s
2795
- } = e, c = lt(n);
2796
- return /* @__PURE__ */ C(
2797
- Ei,
2798
- {
2799
- ...c,
2800
- ...s,
2801
- ref: t,
2802
- align: o,
2803
- collisionPadding: r,
2804
- style: {
2805
- // Ensure border-box for floating-ui calculations
2806
- boxSizing: "border-box",
2807
- ...s.style,
2808
- "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
2809
- "--radix-select-content-available-width": "var(--radix-popper-available-width)",
2810
- "--radix-select-content-available-height": "var(--radix-popper-available-height)",
2811
- "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
2812
- "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
2813
- }
2814
- }
2815
- );
2816
- });
2817
- Ct.displayName = vs;
2818
- var [gs, Wt] = Me(Ce, {}), Et = "SelectViewport", ao = u.forwardRef(
2819
- (e, t) => {
2820
- const { __scopeSelect: n, nonce: o, ...r } = e, s = ge(Et, n), c = Wt(Et, n), i = Z(t, s.onViewportChange), a = u.useRef(0);
2821
- return /* @__PURE__ */ fe(Tt, { children: [
2822
- /* @__PURE__ */ C(
2823
- "style",
2824
- {
2825
- dangerouslySetInnerHTML: {
2826
- __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
2827
- },
2828
- nonce: o
2829
- }
2830
- ),
2831
- /* @__PURE__ */ C(ct.Slot, { scope: n, children: /* @__PURE__ */ C(
2832
- U.div,
2833
- {
2834
- "data-radix-select-viewport": "",
2835
- role: "presentation",
2836
- ...r,
2837
- ref: i,
2838
- style: {
2839
- // we use position: 'relative' here on the `viewport` so that when we call
2840
- // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
2841
- // (independent of the scrollUpButton).
2842
- position: "relative",
2843
- flex: 1,
2844
- overflow: "auto",
2845
- ...r.style
2846
- },
2847
- onScroll: Y(r.onScroll, (l) => {
2848
- const m = l.currentTarget, { contentWrapper: d, shouldExpandOnScrollRef: v } = c;
2849
- if (v != null && v.current && d) {
2850
- const h = Math.abs(a.current - m.scrollTop);
2851
- if (h > 0) {
2852
- const p = window.innerHeight - ie * 2, f = parseFloat(d.style.minHeight), w = parseFloat(d.style.height), g = Math.max(f, w);
2853
- if (g < p) {
2854
- const y = g + h, x = Math.min(p, y), S = y - x;
2855
- d.style.height = x + "px", d.style.bottom === "0px" && (m.scrollTop = S > 0 ? S : 0, d.style.justifyContent = "flex-end");
2856
- }
2857
- }
2858
- }
2859
- a.current = m.scrollTop;
2860
- })
2861
- }
2862
- ) })
2863
- ] });
2864
- }
2865
- );
2866
- ao.displayName = Et;
2867
- var lo = "SelectGroup", [ws, ys] = Me(lo), xs = u.forwardRef(
2868
- (e, t) => {
2869
- const { __scopeSelect: n, ...o } = e, r = Ot();
2870
- return /* @__PURE__ */ C(ws, { scope: n, id: r, children: /* @__PURE__ */ C(U.div, { role: "group", "aria-labelledby": r, ...o, ref: t }) });
2871
- }
2872
- );
2873
- xs.displayName = lo;
2874
- var uo = "SelectLabel", Ss = u.forwardRef(
2875
- (e, t) => {
2876
- const { __scopeSelect: n, ...o } = e, r = ys(uo, n);
2877
- return /* @__PURE__ */ C(U.div, { id: r.id, ...o, ref: t });
2878
- }
2879
- );
2880
- Ss.displayName = uo;
2881
- var ot = "SelectItem", [bs, fo] = Me(ot), po = u.forwardRef(
2882
- (e, t) => {
2883
- const {
2884
- __scopeSelect: n,
2885
- value: o,
2886
- disabled: r = !1,
2887
- textValue: s,
2888
- ...c
2889
- } = e, i = ve(ot, n), a = ge(ot, n), l = i.value === o, [m, d] = u.useState(s ?? ""), [v, h] = u.useState(!1), p = Z(
2890
- t,
2891
- (g) => {
2892
- var y;
2893
- return (y = a.itemRefCallback) == null ? void 0 : y.call(a, g, o, r);
2894
- }
2895
- ), f = Ot(), w = () => {
2896
- r || (i.onValueChange(o), i.onOpenChange(!1));
2897
- };
2898
- if (o === "")
2899
- throw new Error(
2900
- "A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder."
2901
- );
2902
- return /* @__PURE__ */ C(
2903
- bs,
2904
- {
2905
- scope: n,
2906
- value: o,
2907
- disabled: r,
2908
- textId: f,
2909
- isSelected: l,
2910
- onItemTextChange: u.useCallback((g) => {
2911
- d((y) => y || ((g == null ? void 0 : g.textContent) ?? "").trim());
2912
- }, []),
2913
- children: /* @__PURE__ */ C(
2914
- ct.ItemSlot,
2915
- {
2916
- scope: n,
2917
- value: o,
2918
- disabled: r,
2919
- textValue: m,
2920
- children: /* @__PURE__ */ C(
2921
- U.div,
2922
- {
2923
- role: "option",
2924
- "aria-labelledby": f,
2925
- "data-highlighted": v ? "" : void 0,
2926
- "aria-selected": l && v,
2927
- "data-state": l ? "checked" : "unchecked",
2928
- "aria-disabled": r || void 0,
2929
- "data-disabled": r ? "" : void 0,
2930
- tabIndex: r ? void 0 : -1,
2931
- ...c,
2932
- ref: p,
2933
- onFocus: Y(c.onFocus, () => h(!0)),
2934
- onBlur: Y(c.onBlur, () => h(!1)),
2935
- onPointerUp: Y(c.onPointerUp, w),
2936
- onPointerMove: Y(c.onPointerMove, (g) => {
2937
- var y;
2938
- r ? (y = a.onItemLeave) == null || y.call(a) : g.currentTarget.focus({ preventScroll: !0 });
2939
- }),
2940
- onPointerLeave: Y(c.onPointerLeave, (g) => {
2941
- var y;
2942
- g.currentTarget === document.activeElement && ((y = a.onItemLeave) == null || y.call(a));
2943
- }),
2944
- onKeyDown: Y(c.onKeyDown, (g) => {
2945
- var x;
2946
- ((x = a.searchRef) == null ? void 0 : x.current) !== "" && g.key === " " || (cs.includes(g.key) && w(), g.key === " " && g.preventDefault());
2947
- })
2948
- }
2949
- )
2950
- }
2951
- )
2952
- }
2953
- );
2954
- }
2955
- );
2956
- po.displayName = ot;
2957
- var We = "SelectItemText", mo = u.forwardRef(
2958
- (e, t) => {
2959
- const { __scopeSelect: n, className: o, style: r, ...s } = e, c = ve(We, n), i = ge(We, n), a = fo(We, n), l = fs(We, n), [m, d] = u.useState(null), v = Z(
2960
- t,
2961
- (g) => d(g),
2962
- a.onItemTextChange,
2963
- (g) => {
2964
- var y;
2965
- return (y = i.itemTextRefCallback) == null ? void 0 : y.call(i, g, a.value, a.disabled);
2966
- }
2967
- ), h = m == null ? void 0 : m.textContent, p = u.useMemo(
2968
- () => /* @__PURE__ */ C("option", { value: a.value, disabled: a.disabled, children: h }, a.value),
2969
- [a.disabled, a.value, h]
2970
- ), { onNativeOptionAdd: f, onNativeOptionRemove: w } = l;
2971
- return q(() => (f(p), () => w(p)), [f, w, p]), /* @__PURE__ */ fe(Tt, { children: [
2972
- /* @__PURE__ */ C(U.span, { id: a.textId, ...s, ref: v }),
2973
- a.isSelected && c.valueNode && !c.valueNodeHasChildren ? _t.createPortal(s.children, c.valueNode) : null
2974
- ] });
2975
- }
2976
- );
2977
- mo.displayName = We;
2978
- var ho = "SelectItemIndicator", vo = u.forwardRef(
2979
- (e, t) => {
2980
- const { __scopeSelect: n, ...o } = e;
2981
- return fo(ho, n).isSelected ? /* @__PURE__ */ C(U.span, { "aria-hidden": !0, ...o, ref: t }) : null;
2982
- }
2983
- );
2984
- vo.displayName = ho;
2985
- var Pt = "SelectScrollUpButton", go = u.forwardRef((e, t) => {
2986
- const n = ge(Pt, e.__scopeSelect), o = Wt(Pt, e.__scopeSelect), [r, s] = u.useState(!1), c = Z(t, o.onScrollButtonChange);
2987
- return q(() => {
2988
- if (n.viewport && n.isPositioned) {
2989
- let i = function() {
2990
- const l = a.scrollTop > 0;
2991
- s(l);
2992
- };
2993
- const a = n.viewport;
2994
- return i(), a.addEventListener("scroll", i), () => a.removeEventListener("scroll", i);
2995
- }
2996
- }, [n.viewport, n.isPositioned]), r ? /* @__PURE__ */ C(
2997
- yo,
2998
- {
2999
- ...e,
3000
- ref: c,
3001
- onAutoScroll: () => {
3002
- const { viewport: i, selectedItem: a } = n;
3003
- i && a && (i.scrollTop = i.scrollTop - a.offsetHeight);
3004
- }
3005
- }
3006
- ) : null;
3007
- });
3008
- go.displayName = Pt;
3009
- var Rt = "SelectScrollDownButton", wo = u.forwardRef((e, t) => {
3010
- const n = ge(Rt, e.__scopeSelect), o = Wt(Rt, e.__scopeSelect), [r, s] = u.useState(!1), c = Z(t, o.onScrollButtonChange);
3011
- return q(() => {
3012
- if (n.viewport && n.isPositioned) {
3013
- let i = function() {
3014
- const l = a.scrollHeight - a.clientHeight, m = Math.ceil(a.scrollTop) < l;
3015
- s(m);
3016
- };
3017
- const a = n.viewport;
3018
- return i(), a.addEventListener("scroll", i), () => a.removeEventListener("scroll", i);
3019
- }
3020
- }, [n.viewport, n.isPositioned]), r ? /* @__PURE__ */ C(
3021
- yo,
3022
- {
3023
- ...e,
3024
- ref: c,
3025
- onAutoScroll: () => {
3026
- const { viewport: i, selectedItem: a } = n;
3027
- i && a && (i.scrollTop = i.scrollTop + a.offsetHeight);
3028
- }
3029
- }
3030
- ) : null;
3031
- });
3032
- wo.displayName = Rt;
3033
- var yo = u.forwardRef((e, t) => {
3034
- const { __scopeSelect: n, onAutoScroll: o, ...r } = e, s = ge("SelectScrollButton", n), c = u.useRef(null), i = at(n), a = u.useCallback(() => {
3035
- c.current !== null && (window.clearInterval(c.current), c.current = null);
3036
- }, []);
3037
- return u.useEffect(() => () => a(), [a]), q(() => {
3038
- var m;
3039
- const l = i().find((d) => d.ref.current === document.activeElement);
3040
- (m = l == null ? void 0 : l.ref.current) == null || m.scrollIntoView({ block: "nearest" });
3041
- }, [i]), /* @__PURE__ */ C(
3042
- U.div,
3043
- {
3044
- "aria-hidden": !0,
3045
- ...r,
3046
- ref: t,
3047
- style: { flexShrink: 0, ...r.style },
3048
- onPointerDown: Y(r.onPointerDown, () => {
3049
- c.current === null && (c.current = window.setInterval(o, 50));
3050
- }),
3051
- onPointerMove: Y(r.onPointerMove, () => {
3052
- var l;
3053
- (l = s.onItemLeave) == null || l.call(s), c.current === null && (c.current = window.setInterval(o, 50));
3054
- }),
3055
- onPointerLeave: Y(r.onPointerLeave, () => {
3056
- a();
3057
- })
3058
- }
3059
- );
3060
- }), Cs = "SelectSeparator", Es = u.forwardRef(
3061
- (e, t) => {
3062
- const { __scopeSelect: n, ...o } = e;
3063
- return /* @__PURE__ */ C(U.div, { "aria-hidden": !0, ...o, ref: t });
3064
- }
3065
- );
3066
- Es.displayName = Cs;
3067
- var At = "SelectArrow", Ps = u.forwardRef(
3068
- (e, t) => {
3069
- const { __scopeSelect: n, ...o } = e, r = lt(n), s = ve(At, n), c = ge(At, n);
3070
- return s.open && c.position === "popper" ? /* @__PURE__ */ C(Pi, { ...r, ...o, ref: t }) : null;
3071
- }
3072
- );
3073
- Ps.displayName = At;
3074
- function xo(e) {
3075
- return e === "" || e === void 0;
3076
- }
3077
- var So = u.forwardRef(
3078
- (e, t) => {
3079
- const { value: n, ...o } = e, r = u.useRef(null), s = Z(t, r), c = Lo(n);
3080
- return u.useEffect(() => {
3081
- const i = r.current, a = window.HTMLSelectElement.prototype, m = Object.getOwnPropertyDescriptor(
3082
- a,
3083
- "value"
3084
- ).set;
3085
- if (c !== n && m) {
3086
- const d = new Event("change", { bubbles: !0 });
3087
- m.call(i, n), i.dispatchEvent(d);
3088
- }
3089
- }, [c, n]), /* @__PURE__ */ C(Un, { asChild: !0, children: /* @__PURE__ */ C("select", { ...o, ref: s, defaultValue: n }) });
3090
- }
3091
- );
3092
- So.displayName = "BubbleSelect";
3093
- function bo(e) {
3094
- const t = Se(e), n = u.useRef(""), o = u.useRef(0), r = u.useCallback(
3095
- (c) => {
3096
- const i = n.current + c;
3097
- t(i), function a(l) {
3098
- n.current = l, window.clearTimeout(o.current), l !== "" && (o.current = window.setTimeout(() => a(""), 1e3));
3099
- }(i);
3100
- },
3101
- [t]
3102
- ), s = u.useCallback(() => {
3103
- n.current = "", window.clearTimeout(o.current);
3104
- }, []);
3105
- return u.useEffect(() => () => window.clearTimeout(o.current), []), [n, r, s];
3106
- }
3107
- function Co(e, t, n) {
3108
- const r = t.length > 1 && Array.from(t).every((l) => l === t[0]) ? t[0] : t, s = n ? e.indexOf(n) : -1;
3109
- let c = Rs(e, Math.max(s, 0));
3110
- r.length === 1 && (c = c.filter((l) => l !== n));
3111
- const a = c.find(
3112
- (l) => l.textValue.toLowerCase().startsWith(r.toLowerCase())
3113
- );
3114
- return a !== n ? a : void 0;
3115
- }
3116
- function Rs(e, t) {
3117
- return e.map((n, o) => e[(t + o) % e.length]);
3118
- }
3119
- var As = Zn, Ts = Jn, _s = to, Os = no, Ns = oo, Is = ro, Ms = ao, Ls = po, Ds = mo, ks = vo, Bs = go, Fs = wo, Eo = {
3120
- color: void 0,
3121
- size: void 0,
3122
- className: void 0,
3123
- style: void 0,
3124
- attr: void 0
3125
- }, un = K.createContext && K.createContext(Eo), de = function() {
3126
- return de = Object.assign || function(e) {
3127
- for (var t, n = 1, o = arguments.length; n < o; n++) {
3128
- t = arguments[n];
3129
- for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
3130
- }
3131
- return e;
3132
- }, de.apply(this, arguments);
3133
- }, Ws = function(e, t) {
3134
- var n = {};
3135
- for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && t.indexOf(o) < 0 && (n[o] = e[o]);
3136
- if (e != null && typeof Object.getOwnPropertySymbols == "function") for (var r = 0, o = Object.getOwnPropertySymbols(e); r < o.length; r++)
3137
- t.indexOf(o[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, o[r]) && (n[o[r]] = e[o[r]]);
3138
- return n;
3139
- };
3140
- function Po(e) {
3141
- return e && e.map(function(t, n) {
3142
- return K.createElement(t.tag, de({
3143
- key: n
3144
- }, t.attr), Po(t.child));
3145
- });
3146
- }
3147
- function Ro(e) {
3148
- return function(t) {
3149
- return K.createElement($s, de({
3150
- attr: de({}, e.attr)
3151
- }, t), Po(e.child));
3152
- };
3153
- }
3154
- function $s(e) {
3155
- var t = function(n) {
3156
- var o = e.attr, r = e.size, s = e.title, c = Ws(e, ["attr", "size", "title"]), i = r || n.size || "1em", a;
3157
- return n.className && (a = n.className), e.className && (a = (a ? a + " " : "") + e.className), K.createElement("svg", de({
3158
- stroke: "currentColor",
3159
- fill: "currentColor",
3160
- strokeWidth: "0"
3161
- }, n.attr, o, c, {
3162
- className: a,
3163
- style: de(de({
3164
- color: e.color || n.color
3165
- }, n.style), e.style),
3166
- height: i,
3167
- width: i,
3168
- xmlns: "http://www.w3.org/2000/svg"
3169
- }), s && K.createElement("title", null, s), e.children);
3170
- };
3171
- return un !== void 0 ? K.createElement(un.Consumer, null, function(n) {
3172
- return t(n);
3173
- }) : t(Eo);
3174
- }
3175
- function fn(e) {
3176
- return Ro({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z" } }] })(e);
3177
- }
3178
- function Hs(e) {
3179
- return Ro({ tag: "svg", attr: { fill: "currentColor", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { fillRule: "evenodd", d: "M7.646 4.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1-.708.708L8 5.707l-5.646 5.647a.5.5 0 0 1-.708-.708l6-6z" } }] })(e);
3180
- }
3181
- const Vs = "cfxui__Select__content__067da", Us = "cfxui__Select__option__2de5d", zs = "cfxui__Select__trigger__232e4", Ks = "cfxui__Select__small__87505", Ys = "cfxui__Select__large__22ee9", js = "cfxui__Select__fullWidth__739d7", Xs = "cfxui__Select__icon__36b6c", Gs = "cfxui__Select__app__e0114", qs = "cfxui__Select__arrow__8e7eb", Q = {
3182
- content: Vs,
3183
- option: Us,
3184
- trigger: zs,
3185
- small: Ks,
3186
- large: Ys,
3187
- fullWidth: js,
3188
- icon: Xs,
3189
- app: Gs,
3190
- arrow: qs
3191
- }, Zs = {
3192
- small: "xxsmall",
3193
- normal: "xsmall",
3194
- large: "normal"
3195
- }, lc = K.forwardRef(function(t) {
3196
- const {
3197
- value: n,
3198
- options: o,
3199
- onChange: r,
3200
- size: s = "normal",
3201
- placeholder: c,
3202
- disabled: i = !1,
3203
- fullWidth: a = !1,
3204
- className: l
3205
- } = t, [m, d] = K.useState(!1), v = Vt(
3206
- l,
3207
- Q.trigger,
3208
- Q[s],
3209
- {
3210
- [Q.disabled]: i,
3211
- [Q.fullWidth]: a
3212
- }
3213
- );
3214
- return /* @__PURE__ */ fe(As, { value: n, onValueChange: r, onOpenChange: d, open: m, children: [
3215
- /* @__PURE__ */ fe(Ts, { disabled: i, className: v, children: [
3216
- /* @__PURE__ */ C(_s, { placeholder: c }),
3217
- /* @__PURE__ */ C(Os, { className: Q.icon, children: /* @__PURE__ */ C(fn, {}) })
3218
- ] }),
3219
- /* @__PURE__ */ C(Ns, { children: /* @__PURE__ */ fe(Is, { className: Q.content, children: [
3220
- /* @__PURE__ */ C(Bs, { className: Q.arrow, children: /* @__PURE__ */ C(Hs, {}) }),
3221
- /* @__PURE__ */ C(Ms, { children: o.map((h) => /* @__PURE__ */ fe(Ls, { value: h.value, className: Vt(Q.option, Q[s]), children: [
3222
- /* @__PURE__ */ C(Ds, { children: h.label }),
3223
- /* @__PURE__ */ C(ks, { className: Q.indicator, children: /* @__PURE__ */ C(Fo, { name: "Tick", size: Zs[s] }) })
3224
- ] }, h.value)) }),
3225
- /* @__PURE__ */ C(Fs, { className: Q.arrow, children: /* @__PURE__ */ C(fn, {}) })
3226
- ] }) })
3227
- ] });
3228
- });
3229
- export {
3230
- Zs as I,
3231
- lc as S,
3232
- ti as a,
3233
- jr as b,
3234
- ci as c,
3235
- li as d,
3236
- Ot as e,
3237
- si as f,
3238
- Li as g,
3239
- ai as h,
3240
- Ni as i,
3241
- ii as l,
3242
- oi as o,
3243
- ri as s,
3244
- Yo as u
3245
- };