@cfx-dev/ui-components 3.0.4 → 3.0.5

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