@still-forest/canopy 0.29.0 → 0.30.0

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.
@@ -0,0 +1,2815 @@
1
+ import { j as i } from "./jsx-runtime-B0GD0xBr.js";
2
+ import { c as re, u as V, f as kt, B as ct, i as fr, j as Ne, h as pr } from "./calendar-D21xByT8.js";
3
+ import * as s from "react";
4
+ import { useState as lt, useEffect as mr, useMemo as vr } from "react";
5
+ import { F as ae, G as hr } from "./Layout-DAdzkAxW.js";
6
+ import { T as Ae } from "./Heading-Bpvbpnw2.js";
7
+ import { c as $ } from "./index-CRiPKpXj.js";
8
+ import { c as we, d as jt, P as k, a as ye, e as F, t as Pt, g as _t, b as Z, u as dt, v as Me, l as Tt, m as gr, A as xr, f as ne, h as Dt, V as br, i as At, j as yr, R as Mt, F as Ot, D as wr, C as Cr, n as Sr, q as Ft, r as Lt, s as Bt, p as $t, w as Er, x as Ir, k as Rr } from "./popover-BhBG-w7n.js";
9
+ import * as Vt from "react-dom";
10
+ /**
11
+ * @license lucide-react v0.543.0 - ISC
12
+ *
13
+ * This source code is licensed under the ISC license.
14
+ * See the LICENSE file in the root directory of this source tree.
15
+ */
16
+ const Nr = [
17
+ ["path", { d: "M8 2v4", key: "1cmpym" }],
18
+ ["path", { d: "M16 2v4", key: "4m81vk" }],
19
+ ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
20
+ ["path", { d: "M3 10h18", key: "8toen8" }]
21
+ ], kr = re("calendar", Nr);
22
+ /**
23
+ * @license lucide-react v0.543.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */
28
+ const jr = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], ut = re("check", jr);
29
+ /**
30
+ * @license lucide-react v0.543.0 - ISC
31
+ *
32
+ * This source code is licensed under the ISC license.
33
+ * See the LICENSE file in the root directory of this source tree.
34
+ */
35
+ const Pr = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]], _r = re("chevron-up", Pr);
36
+ /**
37
+ * @license lucide-react v0.543.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */
42
+ const Tr = [
43
+ ["path", { d: "m7 15 5 5 5-5", key: "1hf1tw" }],
44
+ ["path", { d: "m7 9 5-5 5 5", key: "sgt6xg" }]
45
+ ], Dr = re("chevrons-up-down", Tr);
46
+ /**
47
+ * @license lucide-react v0.543.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */
52
+ const Ar = [["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]], Mr = re("circle", Ar);
53
+ /**
54
+ * @license lucide-react v0.543.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ */
59
+ const Or = [
60
+ ["path", { d: "M12 2v4", key: "3427ic" }],
61
+ ["path", { d: "m16.2 7.8 2.9-2.9", key: "r700ao" }],
62
+ ["path", { d: "M18 12h4", key: "wj9ykh" }],
63
+ ["path", { d: "m16.2 16.2 2.9 2.9", key: "1bxg5t" }],
64
+ ["path", { d: "M12 18v4", key: "jadmvz" }],
65
+ ["path", { d: "m4.9 19.1 2.9-2.9", key: "bwix9q" }],
66
+ ["path", { d: "M2 12h4", key: "j09sii" }],
67
+ ["path", { d: "m4.9 4.9 2.9 2.9", key: "giyufr" }]
68
+ ], Fr = re("loader", Or);
69
+ /**
70
+ * @license lucide-react v0.543.0 - ISC
71
+ *
72
+ * This source code is licensed under the ISC license.
73
+ * See the LICENSE file in the root directory of this source tree.
74
+ */
75
+ const Lr = [
76
+ [
77
+ "path",
78
+ {
79
+ d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
80
+ key: "1c8476"
81
+ }
82
+ ],
83
+ ["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
84
+ ["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
85
+ ], Br = re("save", Lr);
86
+ /**
87
+ * @license lucide-react v0.543.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */
92
+ const $r = [
93
+ ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
94
+ ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
95
+ ], Vr = re("search", $r);
96
+ /**
97
+ * @license lucide-react v0.543.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */
102
+ const Ur = [
103
+ [
104
+ "path",
105
+ {
106
+ d: "M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",
107
+ key: "1ffxy3"
108
+ }
109
+ ],
110
+ ["path", { d: "m21.854 2.147-10.94 10.939", key: "12cjpa" }]
111
+ ], Ke = re("send", Ur);
112
+ /**
113
+ * @license lucide-react v0.543.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */
118
+ const Gr = [
119
+ ["path", { d: "M10 11v6", key: "nco0om" }],
120
+ ["path", { d: "M14 11v6", key: "outv1u" }],
121
+ ["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
122
+ ["path", { d: "M3 6h18", key: "d0wm0j" }],
123
+ ["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
124
+ ], Wr = re("trash-2", Gr);
125
+ function ft(e) {
126
+ const t = s.useRef({ value: e, previous: e });
127
+ return s.useMemo(() => (t.current.value !== e && (t.current.previous = t.current.value, t.current.value = e), t.current.previous), [e]);
128
+ }
129
+ var Oe = "Checkbox", [Hr, ja] = we(Oe), [zr, pt] = Hr(Oe);
130
+ function Kr(e) {
131
+ const {
132
+ __scopeCheckbox: t,
133
+ checked: n,
134
+ children: o,
135
+ defaultChecked: r,
136
+ disabled: a,
137
+ form: c,
138
+ name: d,
139
+ onCheckedChange: u,
140
+ required: l,
141
+ value: f = "on",
142
+ // @ts-expect-error
143
+ internal_do_not_use_render: m
144
+ } = e, [g, x] = ye({
145
+ prop: n,
146
+ defaultProp: r ?? !1,
147
+ onChange: u,
148
+ caller: Oe
149
+ }), [w, v] = s.useState(null), [h, S] = s.useState(null), y = s.useRef(!1), I = w ? !!c || !!w.closest("form") : (
150
+ // We set this to true by default so that events bubble to forms without JS (SSR)
151
+ !0
152
+ ), A = {
153
+ checked: g,
154
+ disabled: a,
155
+ setChecked: x,
156
+ control: w,
157
+ setControl: v,
158
+ name: d,
159
+ form: c,
160
+ value: f,
161
+ hasConsumerStoppedPropagationRef: y,
162
+ required: l,
163
+ defaultChecked: oe(r) ? !1 : r,
164
+ isFormControl: I,
165
+ bubbleInput: h,
166
+ setBubbleInput: S
167
+ };
168
+ return /* @__PURE__ */ i.jsx(
169
+ zr,
170
+ {
171
+ scope: t,
172
+ ...A,
173
+ children: qr(m) ? m(A) : o
174
+ }
175
+ );
176
+ }
177
+ var Ut = "CheckboxTrigger", Gt = s.forwardRef(
178
+ ({ __scopeCheckbox: e, onKeyDown: t, onClick: n, ...o }, r) => {
179
+ const {
180
+ control: a,
181
+ value: c,
182
+ disabled: d,
183
+ checked: u,
184
+ required: l,
185
+ setControl: f,
186
+ setChecked: m,
187
+ hasConsumerStoppedPropagationRef: g,
188
+ isFormControl: x,
189
+ bubbleInput: w
190
+ } = pt(Ut, e), v = V(r, f), h = s.useRef(u);
191
+ return s.useEffect(() => {
192
+ const S = a?.form;
193
+ if (S) {
194
+ const y = () => m(h.current);
195
+ return S.addEventListener("reset", y), () => S.removeEventListener("reset", y);
196
+ }
197
+ }, [a, m]), /* @__PURE__ */ i.jsx(
198
+ k.button,
199
+ {
200
+ type: "button",
201
+ role: "checkbox",
202
+ "aria-checked": oe(u) ? "mixed" : u,
203
+ "aria-required": l,
204
+ "data-state": Yt(u),
205
+ "data-disabled": d ? "" : void 0,
206
+ disabled: d,
207
+ value: c,
208
+ ...o,
209
+ ref: v,
210
+ onKeyDown: F(t, (S) => {
211
+ S.key === "Enter" && S.preventDefault();
212
+ }),
213
+ onClick: F(n, (S) => {
214
+ m((y) => oe(y) ? !0 : !y), w && x && (g.current = S.isPropagationStopped(), g.current || S.stopPropagation());
215
+ })
216
+ }
217
+ );
218
+ }
219
+ );
220
+ Gt.displayName = Ut;
221
+ var Wt = s.forwardRef(
222
+ (e, t) => {
223
+ const {
224
+ __scopeCheckbox: n,
225
+ name: o,
226
+ checked: r,
227
+ defaultChecked: a,
228
+ required: c,
229
+ disabled: d,
230
+ value: u,
231
+ onCheckedChange: l,
232
+ form: f,
233
+ ...m
234
+ } = e;
235
+ return /* @__PURE__ */ i.jsx(
236
+ Kr,
237
+ {
238
+ __scopeCheckbox: n,
239
+ checked: r,
240
+ defaultChecked: a,
241
+ disabled: d,
242
+ required: c,
243
+ onCheckedChange: l,
244
+ name: o,
245
+ form: f,
246
+ value: u,
247
+ internal_do_not_use_render: ({ isFormControl: g }) => /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
248
+ /* @__PURE__ */ i.jsx(
249
+ Gt,
250
+ {
251
+ ...m,
252
+ ref: t,
253
+ __scopeCheckbox: n
254
+ }
255
+ ),
256
+ g && /* @__PURE__ */ i.jsx(
257
+ qt,
258
+ {
259
+ __scopeCheckbox: n
260
+ }
261
+ )
262
+ ] })
263
+ }
264
+ );
265
+ }
266
+ );
267
+ Wt.displayName = Oe;
268
+ var Ht = "CheckboxIndicator", zt = s.forwardRef(
269
+ (e, t) => {
270
+ const { __scopeCheckbox: n, forceMount: o, ...r } = e, a = pt(Ht, n);
271
+ return /* @__PURE__ */ i.jsx(
272
+ jt,
273
+ {
274
+ present: o || oe(a.checked) || a.checked === !0,
275
+ children: /* @__PURE__ */ i.jsx(
276
+ k.span,
277
+ {
278
+ "data-state": Yt(a.checked),
279
+ "data-disabled": a.disabled ? "" : void 0,
280
+ ...r,
281
+ ref: t,
282
+ style: { pointerEvents: "none", ...e.style }
283
+ }
284
+ )
285
+ }
286
+ );
287
+ }
288
+ );
289
+ zt.displayName = Ht;
290
+ var Kt = "CheckboxBubbleInput", qt = s.forwardRef(
291
+ ({ __scopeCheckbox: e, ...t }, n) => {
292
+ const {
293
+ control: o,
294
+ hasConsumerStoppedPropagationRef: r,
295
+ checked: a,
296
+ defaultChecked: c,
297
+ required: d,
298
+ disabled: u,
299
+ name: l,
300
+ value: f,
301
+ form: m,
302
+ bubbleInput: g,
303
+ setBubbleInput: x
304
+ } = pt(Kt, e), w = V(n, x), v = ft(a), h = Pt(o);
305
+ s.useEffect(() => {
306
+ const y = g;
307
+ if (!y) return;
308
+ const I = window.HTMLInputElement.prototype, M = Object.getOwnPropertyDescriptor(
309
+ I,
310
+ "checked"
311
+ ).set, j = !r.current;
312
+ if (v !== a && M) {
313
+ const E = new Event("click", { bubbles: j });
314
+ y.indeterminate = oe(a), M.call(y, oe(a) ? !1 : a), y.dispatchEvent(E);
315
+ }
316
+ }, [g, v, a, r]);
317
+ const S = s.useRef(oe(a) ? !1 : a);
318
+ return /* @__PURE__ */ i.jsx(
319
+ k.input,
320
+ {
321
+ type: "checkbox",
322
+ "aria-hidden": !0,
323
+ defaultChecked: c ?? S.current,
324
+ required: d,
325
+ disabled: u,
326
+ name: l,
327
+ value: f,
328
+ form: m,
329
+ ...t,
330
+ tabIndex: -1,
331
+ ref: w,
332
+ style: {
333
+ ...t.style,
334
+ ...h,
335
+ position: "absolute",
336
+ pointerEvents: "none",
337
+ opacity: 0,
338
+ margin: 0,
339
+ // We transform because the input is absolutely positioned but we have
340
+ // rendered it **after** the button. This pulls it back to sit on top
341
+ // of the button.
342
+ transform: "translateX(-100%)"
343
+ }
344
+ }
345
+ );
346
+ }
347
+ );
348
+ qt.displayName = Kt;
349
+ function qr(e) {
350
+ return typeof e == "function";
351
+ }
352
+ function oe(e) {
353
+ return e === "indeterminate";
354
+ }
355
+ function Yt(e) {
356
+ return oe(e) ? "indeterminate" : e ? "checked" : "unchecked";
357
+ }
358
+ var qe = "rovingFocusGroup.onEntryFocus", Yr = { bubbles: !1, cancelable: !0 }, ke = "RovingFocusGroup", [Qe, Xt, Xr] = _t(ke), [Zr, Zt] = we(
359
+ ke,
360
+ [Xr]
361
+ ), [Jr, Qr] = Zr(ke), Jt = s.forwardRef(
362
+ (e, t) => /* @__PURE__ */ i.jsx(Qe.Provider, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ i.jsx(Qe.Slot, { scope: e.__scopeRovingFocusGroup, children: /* @__PURE__ */ i.jsx(eo, { ...e, ref: t }) }) })
363
+ );
364
+ Jt.displayName = ke;
365
+ var eo = s.forwardRef((e, t) => {
366
+ const {
367
+ __scopeRovingFocusGroup: n,
368
+ orientation: o,
369
+ loop: r = !1,
370
+ dir: a,
371
+ currentTabStopId: c,
372
+ defaultCurrentTabStopId: d,
373
+ onCurrentTabStopIdChange: u,
374
+ onEntryFocus: l,
375
+ preventScrollOnEntryFocus: f = !1,
376
+ ...m
377
+ } = e, g = s.useRef(null), x = V(t, g), w = dt(a), [v, h] = ye({
378
+ prop: c,
379
+ defaultProp: d ?? null,
380
+ onChange: u,
381
+ caller: ke
382
+ }), [S, y] = s.useState(!1), I = Me(l), A = Xt(n), M = s.useRef(!1), [j, E] = s.useState(0);
383
+ return s.useEffect(() => {
384
+ const P = g.current;
385
+ if (P)
386
+ return P.addEventListener(qe, I), () => P.removeEventListener(qe, I);
387
+ }, [I]), /* @__PURE__ */ i.jsx(
388
+ Jr,
389
+ {
390
+ scope: n,
391
+ orientation: o,
392
+ dir: w,
393
+ loop: r,
394
+ currentTabStopId: v,
395
+ onItemFocus: s.useCallback(
396
+ (P) => h(P),
397
+ [h]
398
+ ),
399
+ onItemShiftTab: s.useCallback(() => y(!0), []),
400
+ onFocusableItemAdd: s.useCallback(
401
+ () => E((P) => P + 1),
402
+ []
403
+ ),
404
+ onFocusableItemRemove: s.useCallback(
405
+ () => E((P) => P - 1),
406
+ []
407
+ ),
408
+ children: /* @__PURE__ */ i.jsx(
409
+ k.div,
410
+ {
411
+ tabIndex: S || j === 0 ? -1 : 0,
412
+ "data-orientation": o,
413
+ ...m,
414
+ ref: x,
415
+ style: { outline: "none", ...e.style },
416
+ onMouseDown: F(e.onMouseDown, () => {
417
+ M.current = !0;
418
+ }),
419
+ onFocus: F(e.onFocus, (P) => {
420
+ const K = !M.current;
421
+ if (P.target === P.currentTarget && K && !S) {
422
+ const U = new CustomEvent(qe, Yr);
423
+ if (P.currentTarget.dispatchEvent(U), !U.defaultPrevented) {
424
+ const W = A().filter((L) => L.focusable), q = W.find((L) => L.active), X = W.find((L) => L.id === v), z = [q, X, ...W].filter(
425
+ Boolean
426
+ ).map((L) => L.ref.current);
427
+ tn(z, f);
428
+ }
429
+ }
430
+ M.current = !1;
431
+ }),
432
+ onBlur: F(e.onBlur, () => y(!1))
433
+ }
434
+ )
435
+ }
436
+ );
437
+ }), Qt = "RovingFocusGroupItem", en = s.forwardRef(
438
+ (e, t) => {
439
+ const {
440
+ __scopeRovingFocusGroup: n,
441
+ focusable: o = !0,
442
+ active: r = !1,
443
+ tabStopId: a,
444
+ children: c,
445
+ ...d
446
+ } = e, u = Z(), l = a || u, f = Qr(Qt, n), m = f.currentTabStopId === l, g = Xt(n), { onFocusableItemAdd: x, onFocusableItemRemove: w, currentTabStopId: v } = f;
447
+ return s.useEffect(() => {
448
+ if (o)
449
+ return x(), () => w();
450
+ }, [o, x, w]), /* @__PURE__ */ i.jsx(
451
+ Qe.ItemSlot,
452
+ {
453
+ scope: n,
454
+ id: l,
455
+ focusable: o,
456
+ active: r,
457
+ children: /* @__PURE__ */ i.jsx(
458
+ k.span,
459
+ {
460
+ tabIndex: m ? 0 : -1,
461
+ "data-orientation": f.orientation,
462
+ ...d,
463
+ ref: t,
464
+ onMouseDown: F(e.onMouseDown, (h) => {
465
+ o ? f.onItemFocus(l) : h.preventDefault();
466
+ }),
467
+ onFocus: F(e.onFocus, () => f.onItemFocus(l)),
468
+ onKeyDown: F(e.onKeyDown, (h) => {
469
+ if (h.key === "Tab" && h.shiftKey) {
470
+ f.onItemShiftTab();
471
+ return;
472
+ }
473
+ if (h.target !== h.currentTarget) return;
474
+ const S = ro(h, f.orientation, f.dir);
475
+ if (S !== void 0) {
476
+ if (h.metaKey || h.ctrlKey || h.altKey || h.shiftKey) return;
477
+ h.preventDefault();
478
+ let I = g().filter((A) => A.focusable).map((A) => A.ref.current);
479
+ if (S === "last") I.reverse();
480
+ else if (S === "prev" || S === "next") {
481
+ S === "prev" && I.reverse();
482
+ const A = I.indexOf(h.currentTarget);
483
+ I = f.loop ? oo(I, A + 1) : I.slice(A + 1);
484
+ }
485
+ setTimeout(() => tn(I));
486
+ }
487
+ }),
488
+ children: typeof c == "function" ? c({ isCurrentTabStop: m, hasTabStop: v != null }) : c
489
+ }
490
+ )
491
+ }
492
+ );
493
+ }
494
+ );
495
+ en.displayName = Qt;
496
+ var to = {
497
+ ArrowLeft: "prev",
498
+ ArrowUp: "prev",
499
+ ArrowRight: "next",
500
+ ArrowDown: "next",
501
+ PageUp: "first",
502
+ Home: "first",
503
+ PageDown: "last",
504
+ End: "last"
505
+ };
506
+ function no(e, t) {
507
+ return t !== "rtl" ? e : e === "ArrowLeft" ? "ArrowRight" : e === "ArrowRight" ? "ArrowLeft" : e;
508
+ }
509
+ function ro(e, t, n) {
510
+ const o = no(e.key, n);
511
+ if (!(t === "vertical" && ["ArrowLeft", "ArrowRight"].includes(o)) && !(t === "horizontal" && ["ArrowUp", "ArrowDown"].includes(o)))
512
+ return to[o];
513
+ }
514
+ function tn(e, t = !1) {
515
+ const n = document.activeElement;
516
+ for (const o of e)
517
+ if (o === n || (o.focus({ preventScroll: t }), document.activeElement !== n)) return;
518
+ }
519
+ function oo(e, t) {
520
+ return e.map((n, o) => e[(t + o) % e.length]);
521
+ }
522
+ var so = Jt, ao = en, io = "Label", nn = s.forwardRef((e, t) => /* @__PURE__ */ i.jsx(
523
+ k.label,
524
+ {
525
+ ...e,
526
+ ref: t,
527
+ onMouseDown: (n) => {
528
+ n.target.closest("button, input, select, textarea") || (e.onMouseDown?.(n), !n.defaultPrevented && n.detail > 1 && n.preventDefault());
529
+ }
530
+ }
531
+ ));
532
+ nn.displayName = io;
533
+ var co = nn;
534
+ function yt(e, [t, n]) {
535
+ return Math.min(n, Math.max(t, e));
536
+ }
537
+ var mt = "Radio", [lo, rn] = we(mt), [uo, fo] = lo(mt), on = s.forwardRef(
538
+ (e, t) => {
539
+ const {
540
+ __scopeRadio: n,
541
+ name: o,
542
+ checked: r = !1,
543
+ required: a,
544
+ disabled: c,
545
+ value: d = "on",
546
+ onCheck: u,
547
+ form: l,
548
+ ...f
549
+ } = e, [m, g] = s.useState(null), x = V(t, (h) => g(h)), w = s.useRef(!1), v = m ? l || !!m.closest("form") : !0;
550
+ return /* @__PURE__ */ i.jsxs(uo, { scope: n, checked: r, disabled: c, children: [
551
+ /* @__PURE__ */ i.jsx(
552
+ k.button,
553
+ {
554
+ type: "button",
555
+ role: "radio",
556
+ "aria-checked": r,
557
+ "data-state": ln(r),
558
+ "data-disabled": c ? "" : void 0,
559
+ disabled: c,
560
+ value: d,
561
+ ...f,
562
+ ref: x,
563
+ onClick: F(e.onClick, (h) => {
564
+ r || u?.(), v && (w.current = h.isPropagationStopped(), w.current || h.stopPropagation());
565
+ })
566
+ }
567
+ ),
568
+ v && /* @__PURE__ */ i.jsx(
569
+ cn,
570
+ {
571
+ control: m,
572
+ bubbles: !w.current,
573
+ name: o,
574
+ value: d,
575
+ checked: r,
576
+ required: a,
577
+ disabled: c,
578
+ form: l,
579
+ style: { transform: "translateX(-100%)" }
580
+ }
581
+ )
582
+ ] });
583
+ }
584
+ );
585
+ on.displayName = mt;
586
+ var sn = "RadioIndicator", an = s.forwardRef(
587
+ (e, t) => {
588
+ const { __scopeRadio: n, forceMount: o, ...r } = e, a = fo(sn, n);
589
+ return /* @__PURE__ */ i.jsx(jt, { present: o || a.checked, children: /* @__PURE__ */ i.jsx(
590
+ k.span,
591
+ {
592
+ "data-state": ln(a.checked),
593
+ "data-disabled": a.disabled ? "" : void 0,
594
+ ...r,
595
+ ref: t
596
+ }
597
+ ) });
598
+ }
599
+ );
600
+ an.displayName = sn;
601
+ var po = "RadioBubbleInput", cn = s.forwardRef(
602
+ ({
603
+ __scopeRadio: e,
604
+ control: t,
605
+ checked: n,
606
+ bubbles: o = !0,
607
+ ...r
608
+ }, a) => {
609
+ const c = s.useRef(null), d = V(c, a), u = ft(n), l = Pt(t);
610
+ return s.useEffect(() => {
611
+ const f = c.current;
612
+ if (!f) return;
613
+ const m = window.HTMLInputElement.prototype, x = Object.getOwnPropertyDescriptor(
614
+ m,
615
+ "checked"
616
+ ).set;
617
+ if (u !== n && x) {
618
+ const w = new Event("click", { bubbles: o });
619
+ x.call(f, n), f.dispatchEvent(w);
620
+ }
621
+ }, [u, n, o]), /* @__PURE__ */ i.jsx(
622
+ k.input,
623
+ {
624
+ type: "radio",
625
+ "aria-hidden": !0,
626
+ defaultChecked: n,
627
+ ...r,
628
+ tabIndex: -1,
629
+ ref: d,
630
+ style: {
631
+ ...r.style,
632
+ ...l,
633
+ position: "absolute",
634
+ pointerEvents: "none",
635
+ opacity: 0,
636
+ margin: 0
637
+ }
638
+ }
639
+ );
640
+ }
641
+ );
642
+ cn.displayName = po;
643
+ function ln(e) {
644
+ return e ? "checked" : "unchecked";
645
+ }
646
+ var mo = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Fe = "RadioGroup", [vo, Pa] = we(Fe, [
647
+ Zt,
648
+ rn
649
+ ]), dn = Zt(), un = rn(), [ho, go] = vo(Fe), fn = s.forwardRef(
650
+ (e, t) => {
651
+ const {
652
+ __scopeRadioGroup: n,
653
+ name: o,
654
+ defaultValue: r,
655
+ value: a,
656
+ required: c = !1,
657
+ disabled: d = !1,
658
+ orientation: u,
659
+ dir: l,
660
+ loop: f = !0,
661
+ onValueChange: m,
662
+ ...g
663
+ } = e, x = dn(n), w = dt(l), [v, h] = ye({
664
+ prop: a,
665
+ defaultProp: r ?? null,
666
+ onChange: m,
667
+ caller: Fe
668
+ });
669
+ return /* @__PURE__ */ i.jsx(
670
+ ho,
671
+ {
672
+ scope: n,
673
+ name: o,
674
+ required: c,
675
+ disabled: d,
676
+ value: v,
677
+ onValueChange: h,
678
+ children: /* @__PURE__ */ i.jsx(
679
+ so,
680
+ {
681
+ asChild: !0,
682
+ ...x,
683
+ orientation: u,
684
+ dir: w,
685
+ loop: f,
686
+ children: /* @__PURE__ */ i.jsx(
687
+ k.div,
688
+ {
689
+ role: "radiogroup",
690
+ "aria-required": c,
691
+ "aria-orientation": u,
692
+ "data-disabled": d ? "" : void 0,
693
+ dir: w,
694
+ ...g,
695
+ ref: t
696
+ }
697
+ )
698
+ }
699
+ )
700
+ }
701
+ );
702
+ }
703
+ );
704
+ fn.displayName = Fe;
705
+ var pn = "RadioGroupItem", mn = s.forwardRef(
706
+ (e, t) => {
707
+ const { __scopeRadioGroup: n, disabled: o, ...r } = e, a = go(pn, n), c = a.disabled || o, d = dn(n), u = un(n), l = s.useRef(null), f = V(t, l), m = a.value === r.value, g = s.useRef(!1);
708
+ return s.useEffect(() => {
709
+ const x = (v) => {
710
+ mo.includes(v.key) && (g.current = !0);
711
+ }, w = () => g.current = !1;
712
+ return document.addEventListener("keydown", x), document.addEventListener("keyup", w), () => {
713
+ document.removeEventListener("keydown", x), document.removeEventListener("keyup", w);
714
+ };
715
+ }, []), /* @__PURE__ */ i.jsx(
716
+ ao,
717
+ {
718
+ asChild: !0,
719
+ ...d,
720
+ focusable: !c,
721
+ active: m,
722
+ children: /* @__PURE__ */ i.jsx(
723
+ on,
724
+ {
725
+ disabled: c,
726
+ required: a.required,
727
+ checked: m,
728
+ ...u,
729
+ ...r,
730
+ name: a.name,
731
+ ref: f,
732
+ onCheck: () => a.onValueChange(r.value),
733
+ onKeyDown: F((x) => {
734
+ x.key === "Enter" && x.preventDefault();
735
+ }),
736
+ onFocus: F(r.onFocus, () => {
737
+ g.current && l.current?.click();
738
+ })
739
+ }
740
+ )
741
+ }
742
+ );
743
+ }
744
+ );
745
+ mn.displayName = pn;
746
+ var xo = "RadioGroupIndicator", vn = s.forwardRef(
747
+ (e, t) => {
748
+ const { __scopeRadioGroup: n, ...o } = e, r = un(n);
749
+ return /* @__PURE__ */ i.jsx(an, { ...r, ...o, ref: t });
750
+ }
751
+ );
752
+ vn.displayName = xo;
753
+ var bo = fn, yo = mn, wo = vn, Co = [" ", "Enter", "ArrowUp", "ArrowDown"], So = [" ", "Enter"], pe = "Select", [Le, Be, Eo] = _t(pe), [Ce, _a] = we(pe, [
754
+ Eo,
755
+ Tt
756
+ ]), $e = Tt(), [Io, ce] = Ce(pe), [Ro, No] = Ce(pe), hn = (e) => {
757
+ const {
758
+ __scopeSelect: t,
759
+ children: n,
760
+ open: o,
761
+ defaultOpen: r,
762
+ onOpenChange: a,
763
+ value: c,
764
+ defaultValue: d,
765
+ onValueChange: u,
766
+ dir: l,
767
+ name: f,
768
+ autoComplete: m,
769
+ disabled: g,
770
+ required: x,
771
+ form: w
772
+ } = e, v = $e(t), [h, S] = s.useState(null), [y, I] = s.useState(null), [A, M] = s.useState(!1), j = dt(l), [E, P] = ye({
773
+ prop: o,
774
+ defaultProp: r ?? !1,
775
+ onChange: a,
776
+ caller: pe
777
+ }), [K, U] = ye({
778
+ prop: c,
779
+ defaultProp: d,
780
+ onChange: u,
781
+ caller: pe
782
+ }), W = s.useRef(null), q = h ? w || !!h.closest("form") : !0, [X, H] = s.useState(/* @__PURE__ */ new Set()), z = Array.from(X).map((L) => L.props.value).join(";");
783
+ return /* @__PURE__ */ i.jsx(gr, { ...v, children: /* @__PURE__ */ i.jsxs(
784
+ Io,
785
+ {
786
+ required: x,
787
+ scope: t,
788
+ trigger: h,
789
+ onTriggerChange: S,
790
+ valueNode: y,
791
+ onValueNodeChange: I,
792
+ valueNodeHasChildren: A,
793
+ onValueNodeHasChildrenChange: M,
794
+ contentId: Z(),
795
+ value: K,
796
+ onValueChange: U,
797
+ open: E,
798
+ onOpenChange: P,
799
+ dir: j,
800
+ triggerPointerDownPosRef: W,
801
+ disabled: g,
802
+ children: [
803
+ /* @__PURE__ */ i.jsx(Le.Provider, { scope: t, children: /* @__PURE__ */ i.jsx(
804
+ Ro,
805
+ {
806
+ scope: e.__scopeSelect,
807
+ onNativeOptionAdd: s.useCallback((L) => {
808
+ H((Y) => new Set(Y).add(L));
809
+ }, []),
810
+ onNativeOptionRemove: s.useCallback((L) => {
811
+ H((Y) => {
812
+ const J = new Set(Y);
813
+ return J.delete(L), J;
814
+ });
815
+ }, []),
816
+ children: n
817
+ }
818
+ ) }),
819
+ q ? /* @__PURE__ */ i.jsxs(
820
+ Ln,
821
+ {
822
+ "aria-hidden": !0,
823
+ required: x,
824
+ tabIndex: -1,
825
+ name: f,
826
+ autoComplete: m,
827
+ value: K,
828
+ onChange: (L) => U(L.target.value),
829
+ disabled: g,
830
+ form: w,
831
+ children: [
832
+ K === void 0 ? /* @__PURE__ */ i.jsx("option", { value: "" }) : null,
833
+ Array.from(X)
834
+ ]
835
+ },
836
+ z
837
+ ) : null
838
+ ]
839
+ }
840
+ ) });
841
+ };
842
+ hn.displayName = pe;
843
+ var gn = "SelectTrigger", xn = s.forwardRef(
844
+ (e, t) => {
845
+ const { __scopeSelect: n, disabled: o = !1, ...r } = e, a = $e(n), c = ce(gn, n), d = c.disabled || o, u = V(t, c.onTriggerChange), l = Be(n), f = s.useRef("touch"), [m, g, x] = $n((v) => {
846
+ const h = l().filter((I) => !I.disabled), S = h.find((I) => I.value === c.value), y = Vn(h, v, S);
847
+ y !== void 0 && c.onValueChange(y.value);
848
+ }), w = (v) => {
849
+ d || (c.onOpenChange(!0), x()), v && (c.triggerPointerDownPosRef.current = {
850
+ x: Math.round(v.pageX),
851
+ y: Math.round(v.pageY)
852
+ });
853
+ };
854
+ return /* @__PURE__ */ i.jsx(xr, { asChild: !0, ...a, children: /* @__PURE__ */ i.jsx(
855
+ k.button,
856
+ {
857
+ type: "button",
858
+ role: "combobox",
859
+ "aria-controls": c.contentId,
860
+ "aria-expanded": c.open,
861
+ "aria-required": c.required,
862
+ "aria-autocomplete": "none",
863
+ dir: c.dir,
864
+ "data-state": c.open ? "open" : "closed",
865
+ disabled: d,
866
+ "data-disabled": d ? "" : void 0,
867
+ "data-placeholder": Bn(c.value) ? "" : void 0,
868
+ ...r,
869
+ ref: u,
870
+ onClick: F(r.onClick, (v) => {
871
+ v.currentTarget.focus(), f.current !== "mouse" && w(v);
872
+ }),
873
+ onPointerDown: F(r.onPointerDown, (v) => {
874
+ f.current = v.pointerType;
875
+ const h = v.target;
876
+ h.hasPointerCapture(v.pointerId) && h.releasePointerCapture(v.pointerId), v.button === 0 && v.ctrlKey === !1 && v.pointerType === "mouse" && (w(v), v.preventDefault());
877
+ }),
878
+ onKeyDown: F(r.onKeyDown, (v) => {
879
+ const h = m.current !== "";
880
+ !(v.ctrlKey || v.altKey || v.metaKey) && v.key.length === 1 && g(v.key), !(h && v.key === " ") && Co.includes(v.key) && (w(), v.preventDefault());
881
+ })
882
+ }
883
+ ) });
884
+ }
885
+ );
886
+ xn.displayName = gn;
887
+ var bn = "SelectValue", yn = s.forwardRef(
888
+ (e, t) => {
889
+ const { __scopeSelect: n, className: o, style: r, children: a, placeholder: c = "", ...d } = e, u = ce(bn, n), { onValueNodeHasChildrenChange: l } = u, f = a !== void 0, m = V(t, u.onValueNodeChange);
890
+ return ne(() => {
891
+ l(f);
892
+ }, [l, f]), /* @__PURE__ */ i.jsx(
893
+ k.span,
894
+ {
895
+ ...d,
896
+ ref: m,
897
+ style: { pointerEvents: "none" },
898
+ children: Bn(u.value) ? /* @__PURE__ */ i.jsx(i.Fragment, { children: c }) : a
899
+ }
900
+ );
901
+ }
902
+ );
903
+ yn.displayName = bn;
904
+ var ko = "SelectIcon", wn = s.forwardRef(
905
+ (e, t) => {
906
+ const { __scopeSelect: n, children: o, ...r } = e;
907
+ return /* @__PURE__ */ i.jsx(k.span, { "aria-hidden": !0, ...r, ref: t, children: o || "▼" });
908
+ }
909
+ );
910
+ wn.displayName = ko;
911
+ var jo = "SelectPortal", Cn = (e) => /* @__PURE__ */ i.jsx(Dt, { asChild: !0, ...e });
912
+ Cn.displayName = jo;
913
+ var me = "SelectContent", Sn = s.forwardRef(
914
+ (e, t) => {
915
+ const n = ce(me, e.__scopeSelect), [o, r] = s.useState();
916
+ if (ne(() => {
917
+ r(new DocumentFragment());
918
+ }, []), !n.open) {
919
+ const a = o;
920
+ return a ? Vt.createPortal(
921
+ /* @__PURE__ */ i.jsx(En, { scope: e.__scopeSelect, children: /* @__PURE__ */ i.jsx(Le.Slot, { scope: e.__scopeSelect, children: /* @__PURE__ */ i.jsx("div", { children: e.children }) }) }),
922
+ a
923
+ ) : null;
924
+ }
925
+ return /* @__PURE__ */ i.jsx(In, { ...e, ref: t });
926
+ }
927
+ );
928
+ Sn.displayName = me;
929
+ var ee = 10, [En, le] = Ce(me), Po = "SelectContentImpl", _o = kt("SelectContent.RemoveScroll"), In = s.forwardRef(
930
+ (e, t) => {
931
+ const {
932
+ __scopeSelect: n,
933
+ position: o = "item-aligned",
934
+ onCloseAutoFocus: r,
935
+ onEscapeKeyDown: a,
936
+ onPointerDownOutside: c,
937
+ //
938
+ // PopperContent props
939
+ side: d,
940
+ sideOffset: u,
941
+ align: l,
942
+ alignOffset: f,
943
+ arrowPadding: m,
944
+ collisionBoundary: g,
945
+ collisionPadding: x,
946
+ sticky: w,
947
+ hideWhenDetached: v,
948
+ avoidCollisions: h,
949
+ //
950
+ ...S
951
+ } = e, y = ce(me, n), [I, A] = s.useState(null), [M, j] = s.useState(null), E = V(t, (b) => A(b)), [P, K] = s.useState(null), [U, W] = s.useState(
952
+ null
953
+ ), q = Be(n), [X, H] = s.useState(!1), z = s.useRef(!1);
954
+ s.useEffect(() => {
955
+ if (I) return At(I);
956
+ }, [I]), yr();
957
+ const L = s.useCallback(
958
+ (b) => {
959
+ const [T, ...D] = q().map((G) => G.ref.current), [O] = D.slice(-1), B = document.activeElement;
960
+ for (const G of b)
961
+ if (G === B || (G?.scrollIntoView({ block: "nearest" }), G === T && M && (M.scrollTop = 0), G === O && M && (M.scrollTop = M.scrollHeight), G?.focus(), document.activeElement !== B)) return;
962
+ },
963
+ [q, M]
964
+ ), Y = s.useCallback(
965
+ () => L([P, I]),
966
+ [L, P, I]
967
+ );
968
+ s.useEffect(() => {
969
+ X && Y();
970
+ }, [X, Y]);
971
+ const { onOpenChange: J, triggerPointerDownPosRef: Q } = y;
972
+ s.useEffect(() => {
973
+ if (I) {
974
+ let b = { x: 0, y: 0 };
975
+ const T = (O) => {
976
+ b = {
977
+ x: Math.abs(Math.round(O.pageX) - (Q.current?.x ?? 0)),
978
+ y: Math.abs(Math.round(O.pageY) - (Q.current?.y ?? 0))
979
+ };
980
+ }, D = (O) => {
981
+ b.x <= 10 && b.y <= 10 ? O.preventDefault() : I.contains(O.target) || J(!1), document.removeEventListener("pointermove", T), Q.current = null;
982
+ };
983
+ return Q.current !== null && (document.addEventListener("pointermove", T), document.addEventListener("pointerup", D, { capture: !0, once: !0 })), () => {
984
+ document.removeEventListener("pointermove", T), document.removeEventListener("pointerup", D, { capture: !0 });
985
+ };
986
+ }
987
+ }, [I, J, Q]), s.useEffect(() => {
988
+ const b = () => J(!1);
989
+ return window.addEventListener("blur", b), window.addEventListener("resize", b), () => {
990
+ window.removeEventListener("blur", b), window.removeEventListener("resize", b);
991
+ };
992
+ }, [J]);
993
+ const [ge, de] = $n((b) => {
994
+ const T = q().filter((B) => !B.disabled), D = T.find((B) => B.ref.current === document.activeElement), O = Vn(T, b, D);
995
+ O && setTimeout(() => O.ref.current.focus());
996
+ }), p = s.useCallback(
997
+ (b, T, D) => {
998
+ const O = !z.current && !D;
999
+ (y.value !== void 0 && y.value === T || O) && (K(b), O && (z.current = !0));
1000
+ },
1001
+ [y.value]
1002
+ ), R = s.useCallback(() => I?.focus(), [I]), N = s.useCallback(
1003
+ (b, T, D) => {
1004
+ const O = !z.current && !D;
1005
+ (y.value !== void 0 && y.value === T || O) && W(b);
1006
+ },
1007
+ [y.value]
1008
+ ), C = o === "popper" ? et : Rn, _ = C === et ? {
1009
+ side: d,
1010
+ sideOffset: u,
1011
+ align: l,
1012
+ alignOffset: f,
1013
+ arrowPadding: m,
1014
+ collisionBoundary: g,
1015
+ collisionPadding: x,
1016
+ sticky: w,
1017
+ hideWhenDetached: v,
1018
+ avoidCollisions: h
1019
+ } : {};
1020
+ return /* @__PURE__ */ i.jsx(
1021
+ En,
1022
+ {
1023
+ scope: n,
1024
+ content: I,
1025
+ viewport: M,
1026
+ onViewportChange: j,
1027
+ itemRefCallback: p,
1028
+ selectedItem: P,
1029
+ onItemLeave: R,
1030
+ itemTextRefCallback: N,
1031
+ focusSelectedItem: Y,
1032
+ selectedItemText: U,
1033
+ position: o,
1034
+ isPositioned: X,
1035
+ searchRef: ge,
1036
+ children: /* @__PURE__ */ i.jsx(Mt, { as: _o, allowPinchZoom: !0, children: /* @__PURE__ */ i.jsx(
1037
+ Ot,
1038
+ {
1039
+ asChild: !0,
1040
+ trapped: y.open,
1041
+ onMountAutoFocus: (b) => {
1042
+ b.preventDefault();
1043
+ },
1044
+ onUnmountAutoFocus: F(r, (b) => {
1045
+ y.trigger?.focus({ preventScroll: !0 }), b.preventDefault();
1046
+ }),
1047
+ children: /* @__PURE__ */ i.jsx(
1048
+ wr,
1049
+ {
1050
+ asChild: !0,
1051
+ disableOutsidePointerEvents: !0,
1052
+ onEscapeKeyDown: a,
1053
+ onPointerDownOutside: c,
1054
+ onFocusOutside: (b) => b.preventDefault(),
1055
+ onDismiss: () => y.onOpenChange(!1),
1056
+ children: /* @__PURE__ */ i.jsx(
1057
+ C,
1058
+ {
1059
+ role: "listbox",
1060
+ id: y.contentId,
1061
+ "data-state": y.open ? "open" : "closed",
1062
+ dir: y.dir,
1063
+ onContextMenu: (b) => b.preventDefault(),
1064
+ ...S,
1065
+ ..._,
1066
+ onPlaced: () => H(!0),
1067
+ ref: E,
1068
+ style: {
1069
+ // flex layout so we can place the scroll buttons properly
1070
+ display: "flex",
1071
+ flexDirection: "column",
1072
+ // reset the outline by default as the content MAY get focused
1073
+ outline: "none",
1074
+ ...S.style
1075
+ },
1076
+ onKeyDown: F(S.onKeyDown, (b) => {
1077
+ const T = b.ctrlKey || b.altKey || b.metaKey;
1078
+ if (b.key === "Tab" && b.preventDefault(), !T && b.key.length === 1 && de(b.key), ["ArrowUp", "ArrowDown", "Home", "End"].includes(b.key)) {
1079
+ let O = q().filter((B) => !B.disabled).map((B) => B.ref.current);
1080
+ if (["ArrowUp", "End"].includes(b.key) && (O = O.slice().reverse()), ["ArrowUp", "ArrowDown"].includes(b.key)) {
1081
+ const B = b.target, G = O.indexOf(B);
1082
+ O = O.slice(G + 1);
1083
+ }
1084
+ setTimeout(() => L(O)), b.preventDefault();
1085
+ }
1086
+ })
1087
+ }
1088
+ )
1089
+ }
1090
+ )
1091
+ }
1092
+ ) })
1093
+ }
1094
+ );
1095
+ }
1096
+ );
1097
+ In.displayName = Po;
1098
+ var To = "SelectItemAlignedPosition", Rn = s.forwardRef((e, t) => {
1099
+ const { __scopeSelect: n, onPlaced: o, ...r } = e, a = ce(me, n), c = le(me, n), [d, u] = s.useState(null), [l, f] = s.useState(null), m = V(t, (E) => f(E)), g = Be(n), x = s.useRef(!1), w = s.useRef(!0), { viewport: v, selectedItem: h, selectedItemText: S, focusSelectedItem: y } = c, I = s.useCallback(() => {
1100
+ if (a.trigger && a.valueNode && d && l && v && h && S) {
1101
+ const E = a.trigger.getBoundingClientRect(), P = l.getBoundingClientRect(), K = a.valueNode.getBoundingClientRect(), U = S.getBoundingClientRect();
1102
+ if (a.dir !== "rtl") {
1103
+ const B = U.left - P.left, G = K.left - B, ue = E.left - G, fe = E.width + ue, We = Math.max(fe, P.width), He = window.innerWidth - ee, ze = yt(G, [
1104
+ ee,
1105
+ // Prevents the content from going off the starting edge of the
1106
+ // viewport. It may still go off the ending edge, but this can be
1107
+ // controlled by the user since they may want to manage overflow in a
1108
+ // specific way.
1109
+ // https://github.com/radix-ui/primitives/issues/2049
1110
+ Math.max(ee, He - We)
1111
+ ]);
1112
+ d.style.minWidth = fe + "px", d.style.left = ze + "px";
1113
+ } else {
1114
+ const B = P.right - U.right, G = window.innerWidth - K.right - B, ue = window.innerWidth - E.right - G, fe = E.width + ue, We = Math.max(fe, P.width), He = window.innerWidth - ee, ze = yt(G, [
1115
+ ee,
1116
+ Math.max(ee, He - We)
1117
+ ]);
1118
+ d.style.minWidth = fe + "px", d.style.right = ze + "px";
1119
+ }
1120
+ const W = g(), q = window.innerHeight - ee * 2, X = v.scrollHeight, H = window.getComputedStyle(l), z = parseInt(H.borderTopWidth, 10), L = parseInt(H.paddingTop, 10), Y = parseInt(H.borderBottomWidth, 10), J = parseInt(H.paddingBottom, 10), Q = z + L + X + J + Y, ge = Math.min(h.offsetHeight * 5, Q), de = window.getComputedStyle(v), p = parseInt(de.paddingTop, 10), R = parseInt(de.paddingBottom, 10), N = E.top + E.height / 2 - ee, C = q - N, _ = h.offsetHeight / 2, b = h.offsetTop + _, T = z + L + b, D = Q - T;
1121
+ if (T <= N) {
1122
+ const B = W.length > 0 && h === W[W.length - 1].ref.current;
1123
+ d.style.bottom = "0px";
1124
+ const G = l.clientHeight - v.offsetTop - v.offsetHeight, ue = Math.max(
1125
+ C,
1126
+ _ + // viewport might have padding bottom, include it to avoid a scrollable viewport
1127
+ (B ? R : 0) + G + Y
1128
+ ), fe = T + ue;
1129
+ d.style.height = fe + "px";
1130
+ } else {
1131
+ const B = W.length > 0 && h === W[0].ref.current;
1132
+ d.style.top = "0px";
1133
+ const ue = Math.max(
1134
+ N,
1135
+ z + v.offsetTop + // viewport might have padding top, include it to avoid a scrollable viewport
1136
+ (B ? p : 0) + _
1137
+ ) + D;
1138
+ d.style.height = ue + "px", v.scrollTop = T - N + v.offsetTop;
1139
+ }
1140
+ d.style.margin = `${ee}px 0`, d.style.minHeight = ge + "px", d.style.maxHeight = q + "px", o?.(), requestAnimationFrame(() => x.current = !0);
1141
+ }
1142
+ }, [
1143
+ g,
1144
+ a.trigger,
1145
+ a.valueNode,
1146
+ d,
1147
+ l,
1148
+ v,
1149
+ h,
1150
+ S,
1151
+ a.dir,
1152
+ o
1153
+ ]);
1154
+ ne(() => I(), [I]);
1155
+ const [A, M] = s.useState();
1156
+ ne(() => {
1157
+ l && M(window.getComputedStyle(l).zIndex);
1158
+ }, [l]);
1159
+ const j = s.useCallback(
1160
+ (E) => {
1161
+ E && w.current === !0 && (I(), y?.(), w.current = !1);
1162
+ },
1163
+ [I, y]
1164
+ );
1165
+ return /* @__PURE__ */ i.jsx(
1166
+ Ao,
1167
+ {
1168
+ scope: n,
1169
+ contentWrapper: d,
1170
+ shouldExpandOnScrollRef: x,
1171
+ onScrollButtonChange: j,
1172
+ children: /* @__PURE__ */ i.jsx(
1173
+ "div",
1174
+ {
1175
+ ref: u,
1176
+ style: {
1177
+ display: "flex",
1178
+ flexDirection: "column",
1179
+ position: "fixed",
1180
+ zIndex: A
1181
+ },
1182
+ children: /* @__PURE__ */ i.jsx(
1183
+ k.div,
1184
+ {
1185
+ ...r,
1186
+ ref: m,
1187
+ style: {
1188
+ // When we get the height of the content, it includes borders. If we were to set
1189
+ // the height without having `boxSizing: 'border-box'` it would be too big.
1190
+ boxSizing: "border-box",
1191
+ // We need to ensure the content doesn't get taller than the wrapper
1192
+ maxHeight: "100%",
1193
+ ...r.style
1194
+ }
1195
+ }
1196
+ )
1197
+ }
1198
+ )
1199
+ }
1200
+ );
1201
+ });
1202
+ Rn.displayName = To;
1203
+ var Do = "SelectPopperPosition", et = s.forwardRef((e, t) => {
1204
+ const {
1205
+ __scopeSelect: n,
1206
+ align: o = "start",
1207
+ collisionPadding: r = ee,
1208
+ ...a
1209
+ } = e, c = $e(n);
1210
+ return /* @__PURE__ */ i.jsx(
1211
+ Cr,
1212
+ {
1213
+ ...c,
1214
+ ...a,
1215
+ ref: t,
1216
+ align: o,
1217
+ collisionPadding: r,
1218
+ style: {
1219
+ // Ensure border-box for floating-ui calculations
1220
+ boxSizing: "border-box",
1221
+ ...a.style,
1222
+ "--radix-select-content-transform-origin": "var(--radix-popper-transform-origin)",
1223
+ "--radix-select-content-available-width": "var(--radix-popper-available-width)",
1224
+ "--radix-select-content-available-height": "var(--radix-popper-available-height)",
1225
+ "--radix-select-trigger-width": "var(--radix-popper-anchor-width)",
1226
+ "--radix-select-trigger-height": "var(--radix-popper-anchor-height)"
1227
+ }
1228
+ }
1229
+ );
1230
+ });
1231
+ et.displayName = Do;
1232
+ var [Ao, vt] = Ce(me, {}), tt = "SelectViewport", Nn = s.forwardRef(
1233
+ (e, t) => {
1234
+ const { __scopeSelect: n, nonce: o, ...r } = e, a = le(tt, n), c = vt(tt, n), d = V(t, a.onViewportChange), u = s.useRef(0);
1235
+ return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1236
+ /* @__PURE__ */ i.jsx(
1237
+ "style",
1238
+ {
1239
+ dangerouslySetInnerHTML: {
1240
+ __html: "[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"
1241
+ },
1242
+ nonce: o
1243
+ }
1244
+ ),
1245
+ /* @__PURE__ */ i.jsx(Le.Slot, { scope: n, children: /* @__PURE__ */ i.jsx(
1246
+ k.div,
1247
+ {
1248
+ "data-radix-select-viewport": "",
1249
+ role: "presentation",
1250
+ ...r,
1251
+ ref: d,
1252
+ style: {
1253
+ // we use position: 'relative' here on the `viewport` so that when we call
1254
+ // `selectedItem.offsetTop` in calculations, the offset is relative to the viewport
1255
+ // (independent of the scrollUpButton).
1256
+ position: "relative",
1257
+ flex: 1,
1258
+ // Viewport should only be scrollable in the vertical direction.
1259
+ // This won't work in vertical writing modes, so we'll need to
1260
+ // revisit this if/when that is supported
1261
+ // https://developer.chrome.com/blog/vertical-form-controls
1262
+ overflow: "hidden auto",
1263
+ ...r.style
1264
+ },
1265
+ onScroll: F(r.onScroll, (l) => {
1266
+ const f = l.currentTarget, { contentWrapper: m, shouldExpandOnScrollRef: g } = c;
1267
+ if (g?.current && m) {
1268
+ const x = Math.abs(u.current - f.scrollTop);
1269
+ if (x > 0) {
1270
+ const w = window.innerHeight - ee * 2, v = parseFloat(m.style.minHeight), h = parseFloat(m.style.height), S = Math.max(v, h);
1271
+ if (S < w) {
1272
+ const y = S + x, I = Math.min(w, y), A = y - I;
1273
+ m.style.height = I + "px", m.style.bottom === "0px" && (f.scrollTop = A > 0 ? A : 0, m.style.justifyContent = "flex-end");
1274
+ }
1275
+ }
1276
+ }
1277
+ u.current = f.scrollTop;
1278
+ })
1279
+ }
1280
+ ) })
1281
+ ] });
1282
+ }
1283
+ );
1284
+ Nn.displayName = tt;
1285
+ var kn = "SelectGroup", [Mo, Oo] = Ce(kn), Fo = s.forwardRef(
1286
+ (e, t) => {
1287
+ const { __scopeSelect: n, ...o } = e, r = Z();
1288
+ return /* @__PURE__ */ i.jsx(Mo, { scope: n, id: r, children: /* @__PURE__ */ i.jsx(k.div, { role: "group", "aria-labelledby": r, ...o, ref: t }) });
1289
+ }
1290
+ );
1291
+ Fo.displayName = kn;
1292
+ var jn = "SelectLabel", Lo = s.forwardRef(
1293
+ (e, t) => {
1294
+ const { __scopeSelect: n, ...o } = e, r = Oo(jn, n);
1295
+ return /* @__PURE__ */ i.jsx(k.div, { id: r.id, ...o, ref: t });
1296
+ }
1297
+ );
1298
+ Lo.displayName = jn;
1299
+ var Te = "SelectItem", [Bo, Pn] = Ce(Te), _n = s.forwardRef(
1300
+ (e, t) => {
1301
+ const {
1302
+ __scopeSelect: n,
1303
+ value: o,
1304
+ disabled: r = !1,
1305
+ textValue: a,
1306
+ ...c
1307
+ } = e, d = ce(Te, n), u = le(Te, n), l = d.value === o, [f, m] = s.useState(a ?? ""), [g, x] = s.useState(!1), w = V(
1308
+ t,
1309
+ (y) => u.itemRefCallback?.(y, o, r)
1310
+ ), v = Z(), h = s.useRef("touch"), S = () => {
1311
+ r || (d.onValueChange(o), d.onOpenChange(!1));
1312
+ };
1313
+ if (o === "")
1314
+ throw new Error(
1315
+ "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."
1316
+ );
1317
+ return /* @__PURE__ */ i.jsx(
1318
+ Bo,
1319
+ {
1320
+ scope: n,
1321
+ value: o,
1322
+ disabled: r,
1323
+ textId: v,
1324
+ isSelected: l,
1325
+ onItemTextChange: s.useCallback((y) => {
1326
+ m((I) => I || (y?.textContent ?? "").trim());
1327
+ }, []),
1328
+ children: /* @__PURE__ */ i.jsx(
1329
+ Le.ItemSlot,
1330
+ {
1331
+ scope: n,
1332
+ value: o,
1333
+ disabled: r,
1334
+ textValue: f,
1335
+ children: /* @__PURE__ */ i.jsx(
1336
+ k.div,
1337
+ {
1338
+ role: "option",
1339
+ "aria-labelledby": v,
1340
+ "data-highlighted": g ? "" : void 0,
1341
+ "aria-selected": l && g,
1342
+ "data-state": l ? "checked" : "unchecked",
1343
+ "aria-disabled": r || void 0,
1344
+ "data-disabled": r ? "" : void 0,
1345
+ tabIndex: r ? void 0 : -1,
1346
+ ...c,
1347
+ ref: w,
1348
+ onFocus: F(c.onFocus, () => x(!0)),
1349
+ onBlur: F(c.onBlur, () => x(!1)),
1350
+ onClick: F(c.onClick, () => {
1351
+ h.current !== "mouse" && S();
1352
+ }),
1353
+ onPointerUp: F(c.onPointerUp, () => {
1354
+ h.current === "mouse" && S();
1355
+ }),
1356
+ onPointerDown: F(c.onPointerDown, (y) => {
1357
+ h.current = y.pointerType;
1358
+ }),
1359
+ onPointerMove: F(c.onPointerMove, (y) => {
1360
+ h.current = y.pointerType, r ? u.onItemLeave?.() : h.current === "mouse" && y.currentTarget.focus({ preventScroll: !0 });
1361
+ }),
1362
+ onPointerLeave: F(c.onPointerLeave, (y) => {
1363
+ y.currentTarget === document.activeElement && u.onItemLeave?.();
1364
+ }),
1365
+ onKeyDown: F(c.onKeyDown, (y) => {
1366
+ u.searchRef?.current !== "" && y.key === " " || (So.includes(y.key) && S(), y.key === " " && y.preventDefault());
1367
+ })
1368
+ }
1369
+ )
1370
+ }
1371
+ )
1372
+ }
1373
+ );
1374
+ }
1375
+ );
1376
+ _n.displayName = Te;
1377
+ var Re = "SelectItemText", Tn = s.forwardRef(
1378
+ (e, t) => {
1379
+ const { __scopeSelect: n, className: o, style: r, ...a } = e, c = ce(Re, n), d = le(Re, n), u = Pn(Re, n), l = No(Re, n), [f, m] = s.useState(null), g = V(
1380
+ t,
1381
+ (S) => m(S),
1382
+ u.onItemTextChange,
1383
+ (S) => d.itemTextRefCallback?.(S, u.value, u.disabled)
1384
+ ), x = f?.textContent, w = s.useMemo(
1385
+ () => /* @__PURE__ */ i.jsx("option", { value: u.value, disabled: u.disabled, children: x }, u.value),
1386
+ [u.disabled, u.value, x]
1387
+ ), { onNativeOptionAdd: v, onNativeOptionRemove: h } = l;
1388
+ return ne(() => (v(w), () => h(w)), [v, h, w]), /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
1389
+ /* @__PURE__ */ i.jsx(k.span, { id: u.textId, ...a, ref: g }),
1390
+ u.isSelected && c.valueNode && !c.valueNodeHasChildren ? Vt.createPortal(a.children, c.valueNode) : null
1391
+ ] });
1392
+ }
1393
+ );
1394
+ Tn.displayName = Re;
1395
+ var Dn = "SelectItemIndicator", An = s.forwardRef(
1396
+ (e, t) => {
1397
+ const { __scopeSelect: n, ...o } = e;
1398
+ return Pn(Dn, n).isSelected ? /* @__PURE__ */ i.jsx(k.span, { "aria-hidden": !0, ...o, ref: t }) : null;
1399
+ }
1400
+ );
1401
+ An.displayName = Dn;
1402
+ var nt = "SelectScrollUpButton", Mn = s.forwardRef((e, t) => {
1403
+ const n = le(nt, e.__scopeSelect), o = vt(nt, e.__scopeSelect), [r, a] = s.useState(!1), c = V(t, o.onScrollButtonChange);
1404
+ return ne(() => {
1405
+ if (n.viewport && n.isPositioned) {
1406
+ let d = function() {
1407
+ const l = u.scrollTop > 0;
1408
+ a(l);
1409
+ };
1410
+ const u = n.viewport;
1411
+ return d(), u.addEventListener("scroll", d), () => u.removeEventListener("scroll", d);
1412
+ }
1413
+ }, [n.viewport, n.isPositioned]), r ? /* @__PURE__ */ i.jsx(
1414
+ Fn,
1415
+ {
1416
+ ...e,
1417
+ ref: c,
1418
+ onAutoScroll: () => {
1419
+ const { viewport: d, selectedItem: u } = n;
1420
+ d && u && (d.scrollTop = d.scrollTop - u.offsetHeight);
1421
+ }
1422
+ }
1423
+ ) : null;
1424
+ });
1425
+ Mn.displayName = nt;
1426
+ var rt = "SelectScrollDownButton", On = s.forwardRef((e, t) => {
1427
+ const n = le(rt, e.__scopeSelect), o = vt(rt, e.__scopeSelect), [r, a] = s.useState(!1), c = V(t, o.onScrollButtonChange);
1428
+ return ne(() => {
1429
+ if (n.viewport && n.isPositioned) {
1430
+ let d = function() {
1431
+ const l = u.scrollHeight - u.clientHeight, f = Math.ceil(u.scrollTop) < l;
1432
+ a(f);
1433
+ };
1434
+ const u = n.viewport;
1435
+ return d(), u.addEventListener("scroll", d), () => u.removeEventListener("scroll", d);
1436
+ }
1437
+ }, [n.viewport, n.isPositioned]), r ? /* @__PURE__ */ i.jsx(
1438
+ Fn,
1439
+ {
1440
+ ...e,
1441
+ ref: c,
1442
+ onAutoScroll: () => {
1443
+ const { viewport: d, selectedItem: u } = n;
1444
+ d && u && (d.scrollTop = d.scrollTop + u.offsetHeight);
1445
+ }
1446
+ }
1447
+ ) : null;
1448
+ });
1449
+ On.displayName = rt;
1450
+ var Fn = s.forwardRef((e, t) => {
1451
+ const { __scopeSelect: n, onAutoScroll: o, ...r } = e, a = le("SelectScrollButton", n), c = s.useRef(null), d = Be(n), u = s.useCallback(() => {
1452
+ c.current !== null && (window.clearInterval(c.current), c.current = null);
1453
+ }, []);
1454
+ return s.useEffect(() => () => u(), [u]), ne(() => {
1455
+ d().find((f) => f.ref.current === document.activeElement)?.ref.current?.scrollIntoView({ block: "nearest" });
1456
+ }, [d]), /* @__PURE__ */ i.jsx(
1457
+ k.div,
1458
+ {
1459
+ "aria-hidden": !0,
1460
+ ...r,
1461
+ ref: t,
1462
+ style: { flexShrink: 0, ...r.style },
1463
+ onPointerDown: F(r.onPointerDown, () => {
1464
+ c.current === null && (c.current = window.setInterval(o, 50));
1465
+ }),
1466
+ onPointerMove: F(r.onPointerMove, () => {
1467
+ a.onItemLeave?.(), c.current === null && (c.current = window.setInterval(o, 50));
1468
+ }),
1469
+ onPointerLeave: F(r.onPointerLeave, () => {
1470
+ u();
1471
+ })
1472
+ }
1473
+ );
1474
+ }), $o = "SelectSeparator", Vo = s.forwardRef(
1475
+ (e, t) => {
1476
+ const { __scopeSelect: n, ...o } = e;
1477
+ return /* @__PURE__ */ i.jsx(k.div, { "aria-hidden": !0, ...o, ref: t });
1478
+ }
1479
+ );
1480
+ Vo.displayName = $o;
1481
+ var ot = "SelectArrow", Uo = s.forwardRef(
1482
+ (e, t) => {
1483
+ const { __scopeSelect: n, ...o } = e, r = $e(n), a = ce(ot, n), c = le(ot, n);
1484
+ return a.open && c.position === "popper" ? /* @__PURE__ */ i.jsx(Sr, { ...r, ...o, ref: t }) : null;
1485
+ }
1486
+ );
1487
+ Uo.displayName = ot;
1488
+ var Go = "SelectBubbleInput", Ln = s.forwardRef(
1489
+ ({ __scopeSelect: e, value: t, ...n }, o) => {
1490
+ const r = s.useRef(null), a = V(o, r), c = ft(t);
1491
+ return s.useEffect(() => {
1492
+ const d = r.current;
1493
+ if (!d) return;
1494
+ const u = window.HTMLSelectElement.prototype, f = Object.getOwnPropertyDescriptor(
1495
+ u,
1496
+ "value"
1497
+ ).set;
1498
+ if (c !== t && f) {
1499
+ const m = new Event("change", { bubbles: !0 });
1500
+ f.call(d, t), d.dispatchEvent(m);
1501
+ }
1502
+ }, [c, t]), /* @__PURE__ */ i.jsx(
1503
+ k.select,
1504
+ {
1505
+ ...n,
1506
+ style: { ...br, ...n.style },
1507
+ ref: a,
1508
+ defaultValue: t
1509
+ }
1510
+ );
1511
+ }
1512
+ );
1513
+ Ln.displayName = Go;
1514
+ function Bn(e) {
1515
+ return e === "" || e === void 0;
1516
+ }
1517
+ function $n(e) {
1518
+ const t = Me(e), n = s.useRef(""), o = s.useRef(0), r = s.useCallback(
1519
+ (c) => {
1520
+ const d = n.current + c;
1521
+ t(d), function u(l) {
1522
+ n.current = l, window.clearTimeout(o.current), l !== "" && (o.current = window.setTimeout(() => u(""), 1e3));
1523
+ }(d);
1524
+ },
1525
+ [t]
1526
+ ), a = s.useCallback(() => {
1527
+ n.current = "", window.clearTimeout(o.current);
1528
+ }, []);
1529
+ return s.useEffect(() => () => window.clearTimeout(o.current), []), [n, r, a];
1530
+ }
1531
+ function Vn(e, t, n) {
1532
+ const r = t.length > 1 && Array.from(t).every((l) => l === t[0]) ? t[0] : t, a = n ? e.indexOf(n) : -1;
1533
+ let c = Wo(e, Math.max(a, 0));
1534
+ r.length === 1 && (c = c.filter((l) => l !== n));
1535
+ const u = c.find(
1536
+ (l) => l.textValue.toLowerCase().startsWith(r.toLowerCase())
1537
+ );
1538
+ return u !== n ? u : void 0;
1539
+ }
1540
+ function Wo(e, t) {
1541
+ return e.map((n, o) => e[(t + o) % e.length]);
1542
+ }
1543
+ var Ho = hn, zo = xn, Ko = yn, qo = wn, Yo = Cn, Xo = Sn, Zo = Nn, Jo = _n, Qo = Tn, es = An, ts = Mn, ns = On;
1544
+ const Ta = ({ disabled: e = !1, handleDelete: t, ...n }) => /* @__PURE__ */ i.jsx(
1545
+ ct,
1546
+ {
1547
+ disabled: e,
1548
+ icon: /* @__PURE__ */ i.jsx(Wr, {}),
1549
+ onClick: t,
1550
+ variant: "outline",
1551
+ ...n,
1552
+ className: "border-destructive text-destructive hover:bg-destructive hover:text-white",
1553
+ children: "Delete"
1554
+ }
1555
+ ), wt = {
1556
+ default: { label: "Submit", submittingLabel: "Submitting", IconComponent: Ke },
1557
+ submit: { label: "Submit", submittingLabel: "Submitting", IconComponent: Ke },
1558
+ save: { label: "Save", submittingLabel: "Saving", IconComponent: Br },
1559
+ send: { label: "Send", submittingLabel: "Sending", IconComponent: Ke }
1560
+ }, Da = ({
1561
+ submitting: e = !1,
1562
+ disabled: t = !1,
1563
+ submittingIcon: n,
1564
+ action: o = "default",
1565
+ noIcon: r = !1,
1566
+ ...a
1567
+ }) => {
1568
+ const c = n || Fr;
1569
+ if (!wt[o])
1570
+ throw new Error(`Invalid action: ${o}`);
1571
+ const { label: d, submittingLabel: u, IconComponent: l } = wt[o], f = e ? /* @__PURE__ */ i.jsx(c, { className: "animate-spin" }) : /* @__PURE__ */ i.jsx(l, {});
1572
+ return /* @__PURE__ */ i.jsx(
1573
+ ct,
1574
+ {
1575
+ disabled: t || e,
1576
+ icon: r ? void 0 : f,
1577
+ type: "submit",
1578
+ variant: "primary",
1579
+ ...a,
1580
+ children: e ? u : d
1581
+ }
1582
+ );
1583
+ };
1584
+ function rs({ className: e, ...t }) {
1585
+ return /* @__PURE__ */ i.jsx(
1586
+ Wt,
1587
+ {
1588
+ className: $(
1589
+ "peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:data-[state=checked]:bg-primary dark:aria-invalid:ring-destructive/40",
1590
+ e
1591
+ ),
1592
+ "data-slot": "checkbox",
1593
+ ...t,
1594
+ children: /* @__PURE__ */ i.jsx(
1595
+ zt,
1596
+ {
1597
+ className: "flex items-center justify-center text-current transition-none",
1598
+ "data-slot": "checkbox-indicator",
1599
+ children: /* @__PURE__ */ i.jsx(ut, { className: "size-3.5" })
1600
+ }
1601
+ )
1602
+ }
1603
+ );
1604
+ }
1605
+ const Aa = ({ label: e, name: t, value: n, checked: o, onCheckedChange: r }) => {
1606
+ const [a, c] = lt(o);
1607
+ mr(() => {
1608
+ c(o);
1609
+ }, [o]);
1610
+ let d = t;
1611
+ const u = n || t;
1612
+ n && (d += `[${n}]`);
1613
+ const l = (f) => {
1614
+ c(f), r?.(f);
1615
+ };
1616
+ return /* @__PURE__ */ i.jsxs(ae, { align: "center", gap: "2", children: [
1617
+ /* @__PURE__ */ i.jsx(
1618
+ rs,
1619
+ {
1620
+ checked: a,
1621
+ id: d,
1622
+ name: t,
1623
+ onCheckedChange: l,
1624
+ value: u
1625
+ }
1626
+ ),
1627
+ /* @__PURE__ */ i.jsx(Se, { className: "cursor-pointer", htmlFor: d, children: e })
1628
+ ] });
1629
+ }, Ma = ({ name: e, label: t, placeholder: n, note: o, className: r, ...a }) => /* @__PURE__ */ i.jsx(
1630
+ Un,
1631
+ {
1632
+ className: $("max-w-[150px]", r),
1633
+ label: t,
1634
+ name: e,
1635
+ note: o,
1636
+ placeholder: n,
1637
+ type: "date",
1638
+ ...a
1639
+ }
1640
+ ), Oa = ({ onDateSelection: e, initialValue: t, className: n, size: o = "default", error: r }) => {
1641
+ const [a, c] = lt(t), d = (u) => {
1642
+ c(u), u && e(u);
1643
+ };
1644
+ return /* @__PURE__ */ i.jsxs(ae, { direction: "col", gap: "2", children: [
1645
+ /* @__PURE__ */ i.jsxs(Ft, { children: [
1646
+ /* @__PURE__ */ i.jsx(Lt, { asChild: !0, children: /* @__PURE__ */ i.jsxs(
1647
+ ct,
1648
+ {
1649
+ className: $("w-[280px] justify-start text-left font-normal", !a && "text-muted-foreground", n),
1650
+ size: o,
1651
+ variant: "outline",
1652
+ children: [
1653
+ /* @__PURE__ */ i.jsx(kr, { className: "mr-2 h-4 w-4" }),
1654
+ a ? a.toISOString().split("T")[0] : /* @__PURE__ */ i.jsx("span", { children: "Select a date" })
1655
+ ]
1656
+ }
1657
+ ) }),
1658
+ /* @__PURE__ */ i.jsx(Bt, { className: "w-auto p-0", children: /* @__PURE__ */ i.jsx(fr, { autoFocus: !0, mode: "single", onSelect: d, selected: a }) })
1659
+ ] }),
1660
+ r && /* @__PURE__ */ i.jsx(je, { message: r })
1661
+ ] });
1662
+ }, je = ({ message: e }) => /* @__PURE__ */ i.jsx(Ae, { size: "xs", variant: "destructive", children: e }), os = ({ label: e, labelFor: t, className: n = "", labelClassName: o = "", children: r }) => /* @__PURE__ */ i.jsxs(ae, { direction: "col", gap: "2", children: [
1663
+ e && /* @__PURE__ */ i.jsx(Se, { className: o, htmlFor: t, children: e }),
1664
+ /* @__PURE__ */ i.jsx(ae, { className: `rounded-md border border-input bg-card p-2 shadow-xs ${n}`, gapY: "1", children: r })
1665
+ ] });
1666
+ function ss({ className: e, ...t }) {
1667
+ return /* @__PURE__ */ i.jsx(
1668
+ co,
1669
+ {
1670
+ className: $(
1671
+ "flex select-none items-center gap-2 font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50",
1672
+ e
1673
+ ),
1674
+ "data-slot": "label",
1675
+ ...t
1676
+ }
1677
+ );
1678
+ }
1679
+ const Se = ({ htmlFor: e, value: t, children: n, className: o = "", ...r }) => /* @__PURE__ */ i.jsx(
1680
+ ss,
1681
+ {
1682
+ className: $("font-display font-normal text-base text-foreground", o),
1683
+ htmlFor: e,
1684
+ ...r,
1685
+ children: t || n
1686
+ }
1687
+ );
1688
+ function as({ className: e, type: t, ...n }) {
1689
+ return /* @__PURE__ */ i.jsx(
1690
+ "input",
1691
+ {
1692
+ className: $(
1693
+ "flex h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:font-medium file:text-foreground file:text-sm placeholder:text-muted-foreground disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:bg-input/30",
1694
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50",
1695
+ "aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40",
1696
+ e
1697
+ ),
1698
+ "data-slot": "input",
1699
+ type: t,
1700
+ ...n
1701
+ }
1702
+ );
1703
+ }
1704
+ const Un = ({
1705
+ name: e,
1706
+ type: t = "text",
1707
+ placeholder: n,
1708
+ label: o,
1709
+ labelOrientation: r = "top",
1710
+ note: a,
1711
+ className: c,
1712
+ error: d,
1713
+ ...u
1714
+ }) => /* @__PURE__ */ i.jsxs(ae, { className: "w-full", direction: r === "left" ? "row" : "col", gap: "2", children: [
1715
+ o && /* @__PURE__ */ i.jsx(Se, { className: r === "left" ? "text-nowrap" : "", htmlFor: e, children: o }),
1716
+ /* @__PURE__ */ i.jsx(
1717
+ as,
1718
+ {
1719
+ "aria-label": o || e,
1720
+ className: c,
1721
+ id: e,
1722
+ name: e,
1723
+ placeholder: n,
1724
+ type: t,
1725
+ ...u
1726
+ }
1727
+ ),
1728
+ a && /* @__PURE__ */ i.jsx(Ae, { size: "sm", variant: "muted", children: a }),
1729
+ d && /* @__PURE__ */ i.jsx(je, { message: d })
1730
+ ] }), Fa = ({
1731
+ name: e,
1732
+ label: t,
1733
+ placeholder: n,
1734
+ note: o,
1735
+ // Default to two decimal places for currency and general decimal values
1736
+ step: r = ".01",
1737
+ className: a,
1738
+ ...c
1739
+ }) => /* @__PURE__ */ i.jsx(
1740
+ Un,
1741
+ {
1742
+ className: a,
1743
+ label: t,
1744
+ name: e,
1745
+ note: o,
1746
+ placeholder: n,
1747
+ step: r,
1748
+ type: "number",
1749
+ ...c
1750
+ }
1751
+ );
1752
+ function is({ className: e, ...t }) {
1753
+ return /* @__PURE__ */ i.jsx(bo, { className: $("grid gap-3", e), "data-slot": "radio-group", ...t });
1754
+ }
1755
+ function cs({ className: e, ...t }) {
1756
+ return /* @__PURE__ */ i.jsx(
1757
+ yo,
1758
+ {
1759
+ className: $(
1760
+ "aspect-square size-4 shrink-0 rounded-full border border-input text-primary shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:ring-destructive/40",
1761
+ e
1762
+ ),
1763
+ "data-slot": "radio-group-item",
1764
+ ...t,
1765
+ children: /* @__PURE__ */ i.jsx(
1766
+ wo,
1767
+ {
1768
+ className: "relative flex items-center justify-center",
1769
+ "data-slot": "radio-group-indicator",
1770
+ children: /* @__PURE__ */ i.jsx(Mr, { className: "-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 size-2 fill-primary" })
1771
+ }
1772
+ )
1773
+ }
1774
+ );
1775
+ }
1776
+ const La = ({ label: e, name: t, options: n, value: o, onChange: r, error: a }) => /* @__PURE__ */ i.jsxs(os, { className: "flex flex-col gap-4 px-2 py-1", label: e, labelFor: t, children: [
1777
+ /* @__PURE__ */ i.jsx(is, { className: "w-full", name: t, onValueChange: r, value: o, children: /* @__PURE__ */ i.jsx(hr, { cols: "2", children: n.map((c, d) => /* @__PURE__ */ i.jsxs(ae, { align: "center", gap: "2", justify: "start", children: [
1778
+ /* @__PURE__ */ i.jsx(cs, { id: c.value, value: c.value }),
1779
+ /* @__PURE__ */ i.jsx(Se, { htmlFor: c.value, children: c.label })
1780
+ ] }, d)) }) }),
1781
+ a && /* @__PURE__ */ i.jsx(je, { message: a })
1782
+ ] });
1783
+ function ls({ ...e }) {
1784
+ return /* @__PURE__ */ i.jsx(Ho, { "data-slot": "select", ...e });
1785
+ }
1786
+ function ds({ ...e }) {
1787
+ return /* @__PURE__ */ i.jsx(Ko, { "data-slot": "select-value", ...e });
1788
+ }
1789
+ function us({
1790
+ className: e,
1791
+ size: t = "default",
1792
+ children: n,
1793
+ ...o
1794
+ }) {
1795
+ return /* @__PURE__ */ i.jsxs(
1796
+ zo,
1797
+ {
1798
+ className: $(
1799
+ "flex w-fit items-center justify-between gap-2 whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[size=default]:h-9 data-[size=sm]:h-8 data-[placeholder]:text-muted-foreground *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:hover:bg-input/50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
1800
+ e
1801
+ ),
1802
+ "data-size": t,
1803
+ "data-slot": "select-trigger",
1804
+ ...o,
1805
+ children: [
1806
+ n,
1807
+ /* @__PURE__ */ i.jsx(qo, { asChild: !0, children: /* @__PURE__ */ i.jsx($t, { className: "size-4 opacity-50" }) })
1808
+ ]
1809
+ }
1810
+ );
1811
+ }
1812
+ function fs({
1813
+ className: e,
1814
+ children: t,
1815
+ position: n = "popper",
1816
+ ...o
1817
+ }) {
1818
+ return /* @__PURE__ */ i.jsx(Yo, { children: /* @__PURE__ */ i.jsxs(
1819
+ Xo,
1820
+ {
1821
+ className: $(
1822
+ "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=closed]:animate-out data-[state=open]:animate-in",
1823
+ n === "popper" && "data-[side=left]:-translate-x-1 data-[side=top]:-translate-y-1 data-[side=right]:translate-x-1 data-[side=bottom]:translate-y-1",
1824
+ e
1825
+ ),
1826
+ "data-slot": "select-content",
1827
+ position: n,
1828
+ ...o,
1829
+ children: [
1830
+ /* @__PURE__ */ i.jsx(ms, {}),
1831
+ /* @__PURE__ */ i.jsx(
1832
+ Zo,
1833
+ {
1834
+ className: $(
1835
+ "p-1",
1836
+ n === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"
1837
+ ),
1838
+ children: t
1839
+ }
1840
+ ),
1841
+ /* @__PURE__ */ i.jsx(vs, {})
1842
+ ]
1843
+ }
1844
+ ) });
1845
+ }
1846
+ function ps({ className: e, children: t, ...n }) {
1847
+ return /* @__PURE__ */ i.jsxs(
1848
+ Jo,
1849
+ {
1850
+ className: $(
1851
+ "relative flex w-full cursor-default select-none items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",
1852
+ e
1853
+ ),
1854
+ "data-slot": "select-item",
1855
+ ...n,
1856
+ children: [
1857
+ /* @__PURE__ */ i.jsx("span", { className: "absolute right-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ i.jsx(es, { children: /* @__PURE__ */ i.jsx(ut, { className: "size-4" }) }) }),
1858
+ /* @__PURE__ */ i.jsx(Qo, { children: t })
1859
+ ]
1860
+ }
1861
+ );
1862
+ }
1863
+ function ms({ className: e, ...t }) {
1864
+ return /* @__PURE__ */ i.jsx(
1865
+ ts,
1866
+ {
1867
+ className: $("flex cursor-default items-center justify-center py-1", e),
1868
+ "data-slot": "select-scroll-up-button",
1869
+ ...t,
1870
+ children: /* @__PURE__ */ i.jsx(_r, { className: "size-4" })
1871
+ }
1872
+ );
1873
+ }
1874
+ function vs({
1875
+ className: e,
1876
+ ...t
1877
+ }) {
1878
+ return /* @__PURE__ */ i.jsx(
1879
+ ns,
1880
+ {
1881
+ className: $("flex cursor-default items-center justify-center py-1", e),
1882
+ "data-slot": "select-scroll-down-button",
1883
+ ...t,
1884
+ children: /* @__PURE__ */ i.jsx($t, { className: "size-4" })
1885
+ }
1886
+ );
1887
+ }
1888
+ const Ba = ({
1889
+ name: e,
1890
+ defaultValue: t,
1891
+ options: n,
1892
+ label: o,
1893
+ placeholder: r,
1894
+ note: a,
1895
+ className: c,
1896
+ value: d,
1897
+ onValueChange: u,
1898
+ error: l,
1899
+ ...f
1900
+ }) => /* @__PURE__ */ i.jsxs(ae, { className: "w-full", direction: "col", gap: "2", children: [
1901
+ o && /* @__PURE__ */ i.jsx(Se, { htmlFor: e, children: o }),
1902
+ /* @__PURE__ */ i.jsxs(
1903
+ ls,
1904
+ {
1905
+ defaultValue: t,
1906
+ name: e,
1907
+ onValueChange: u,
1908
+ value: d,
1909
+ ...f,
1910
+ children: [
1911
+ /* @__PURE__ */ i.jsx(us, { className: $("min-w-[180px]", c), "data-testid": `select-input-${e}`, children: /* @__PURE__ */ i.jsx(ds, { placeholder: r }) }),
1912
+ /* @__PURE__ */ i.jsx(fs, { children: n.map(({ value: m, label: g }) => /* @__PURE__ */ i.jsx(ps, { value: m, children: g }, `option-${m}`)) })
1913
+ ]
1914
+ }
1915
+ ),
1916
+ a && /* @__PURE__ */ i.jsx(Ae, { size: "sm", variant: "muted", children: a }),
1917
+ l && /* @__PURE__ */ i.jsx(je, { message: l })
1918
+ ] });
1919
+ var Ct = 1, hs = 0.9, gs = 0.8, xs = 0.17, Ye = 0.1, Xe = 0.999, bs = 0.9999, ys = 0.99, ws = /[\\\/_+.#"@\[\(\{&]/, Cs = /[\\\/_+.#"@\[\(\{&]/g, Ss = /[\s-]/, Gn = /[\s-]/g;
1920
+ function st(e, t, n, o, r, a, c) {
1921
+ if (a === t.length) return r === e.length ? Ct : ys;
1922
+ var d = `${r},${a}`;
1923
+ if (c[d] !== void 0) return c[d];
1924
+ for (var u = o.charAt(a), l = n.indexOf(u, r), f = 0, m, g, x, w; l >= 0; ) m = st(e, t, n, o, l + 1, a + 1, c), m > f && (l === r ? m *= Ct : ws.test(e.charAt(l - 1)) ? (m *= gs, x = e.slice(r, l - 1).match(Cs), x && r > 0 && (m *= Math.pow(Xe, x.length))) : Ss.test(e.charAt(l - 1)) ? (m *= hs, w = e.slice(r, l - 1).match(Gn), w && r > 0 && (m *= Math.pow(Xe, w.length))) : (m *= xs, r > 0 && (m *= Math.pow(Xe, l - r))), e.charAt(l) !== t.charAt(a) && (m *= bs)), (m < Ye && n.charAt(l - 1) === o.charAt(a + 1) || o.charAt(a + 1) === o.charAt(a) && n.charAt(l - 1) !== o.charAt(a)) && (g = st(e, t, n, o, l + 1, a + 2, c), g * Ye > m && (m = g * Ye)), m > f && (f = m), l = n.indexOf(u, l + 1);
1925
+ return c[d] = f, f;
1926
+ }
1927
+ function St(e) {
1928
+ return e.toLowerCase().replace(Gn, " ");
1929
+ }
1930
+ function Es(e, t, n) {
1931
+ return e = n && n.length > 0 ? `${e + " " + n.join(" ")}` : e, st(e, t, St(e), St(t), 0, 0, {});
1932
+ }
1933
+ function se(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
1934
+ return function(r) {
1935
+ if (e?.(r), n === !1 || !r.defaultPrevented)
1936
+ return t?.(r);
1937
+ };
1938
+ }
1939
+ var Is = "DismissableLayer", at = "dismissableLayer.update", Rs = "dismissableLayer.pointerDownOutside", Ns = "dismissableLayer.focusOutside", Et, Wn = s.createContext({
1940
+ layers: /* @__PURE__ */ new Set(),
1941
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
1942
+ branches: /* @__PURE__ */ new Set()
1943
+ }), Hn = s.forwardRef(
1944
+ (e, t) => {
1945
+ const {
1946
+ disableOutsidePointerEvents: n = !1,
1947
+ onEscapeKeyDown: o,
1948
+ onPointerDownOutside: r,
1949
+ onFocusOutside: a,
1950
+ onInteractOutside: c,
1951
+ onDismiss: d,
1952
+ ...u
1953
+ } = e, l = s.useContext(Wn), [f, m] = s.useState(null), g = f?.ownerDocument ?? globalThis?.document, [, x] = s.useState({}), w = V(t, (E) => m(E)), v = Array.from(l.layers), [h] = [...l.layersWithOutsidePointerEventsDisabled].slice(-1), S = v.indexOf(h), y = f ? v.indexOf(f) : -1, I = l.layersWithOutsidePointerEventsDisabled.size > 0, A = y >= S, M = Ps((E) => {
1954
+ const P = E.target, K = [...l.branches].some((U) => U.contains(P));
1955
+ !A || K || (r?.(E), c?.(E), E.defaultPrevented || d?.());
1956
+ }, g), j = _s((E) => {
1957
+ const P = E.target;
1958
+ [...l.branches].some((U) => U.contains(P)) || (a?.(E), c?.(E), E.defaultPrevented || d?.());
1959
+ }, g);
1960
+ return Er((E) => {
1961
+ y === l.layers.size - 1 && (o?.(E), !E.defaultPrevented && d && (E.preventDefault(), d()));
1962
+ }, g), s.useEffect(() => {
1963
+ if (f)
1964
+ return n && (l.layersWithOutsidePointerEventsDisabled.size === 0 && (Et = g.body.style.pointerEvents, g.body.style.pointerEvents = "none"), l.layersWithOutsidePointerEventsDisabled.add(f)), l.layers.add(f), It(), () => {
1965
+ n && l.layersWithOutsidePointerEventsDisabled.size === 1 && (g.body.style.pointerEvents = Et);
1966
+ };
1967
+ }, [f, g, n, l]), s.useEffect(() => () => {
1968
+ f && (l.layers.delete(f), l.layersWithOutsidePointerEventsDisabled.delete(f), It());
1969
+ }, [f, l]), s.useEffect(() => {
1970
+ const E = () => x({});
1971
+ return document.addEventListener(at, E), () => document.removeEventListener(at, E);
1972
+ }, []), /* @__PURE__ */ i.jsx(
1973
+ k.div,
1974
+ {
1975
+ ...u,
1976
+ ref: w,
1977
+ style: {
1978
+ pointerEvents: I ? A ? "auto" : "none" : void 0,
1979
+ ...e.style
1980
+ },
1981
+ onFocusCapture: se(e.onFocusCapture, j.onFocusCapture),
1982
+ onBlurCapture: se(e.onBlurCapture, j.onBlurCapture),
1983
+ onPointerDownCapture: se(
1984
+ e.onPointerDownCapture,
1985
+ M.onPointerDownCapture
1986
+ )
1987
+ }
1988
+ );
1989
+ }
1990
+ );
1991
+ Hn.displayName = Is;
1992
+ var ks = "DismissableLayerBranch", js = s.forwardRef((e, t) => {
1993
+ const n = s.useContext(Wn), o = s.useRef(null), r = V(t, o);
1994
+ return s.useEffect(() => {
1995
+ const a = o.current;
1996
+ if (a)
1997
+ return n.branches.add(a), () => {
1998
+ n.branches.delete(a);
1999
+ };
2000
+ }, [n.branches]), /* @__PURE__ */ i.jsx(k.div, { ...e, ref: r });
2001
+ });
2002
+ js.displayName = ks;
2003
+ function Ps(e, t = globalThis?.document) {
2004
+ const n = Me(e), o = s.useRef(!1), r = s.useRef(() => {
2005
+ });
2006
+ return s.useEffect(() => {
2007
+ const a = (d) => {
2008
+ if (d.target && !o.current) {
2009
+ let u = function() {
2010
+ zn(
2011
+ Rs,
2012
+ n,
2013
+ l,
2014
+ { discrete: !0 }
2015
+ );
2016
+ };
2017
+ const l = { originalEvent: d };
2018
+ d.pointerType === "touch" ? (t.removeEventListener("click", r.current), r.current = u, t.addEventListener("click", r.current, { once: !0 })) : u();
2019
+ } else
2020
+ t.removeEventListener("click", r.current);
2021
+ o.current = !1;
2022
+ }, c = window.setTimeout(() => {
2023
+ t.addEventListener("pointerdown", a);
2024
+ }, 0);
2025
+ return () => {
2026
+ window.clearTimeout(c), t.removeEventListener("pointerdown", a), t.removeEventListener("click", r.current);
2027
+ };
2028
+ }, [t, n]), {
2029
+ // ensures we check React component tree (not just DOM tree)
2030
+ onPointerDownCapture: () => o.current = !0
2031
+ };
2032
+ }
2033
+ function _s(e, t = globalThis?.document) {
2034
+ const n = Me(e), o = s.useRef(!1);
2035
+ return s.useEffect(() => {
2036
+ const r = (a) => {
2037
+ a.target && !o.current && zn(Ns, n, { originalEvent: a }, {
2038
+ discrete: !1
2039
+ });
2040
+ };
2041
+ return t.addEventListener("focusin", r), () => t.removeEventListener("focusin", r);
2042
+ }, [t, n]), {
2043
+ onFocusCapture: () => o.current = !0,
2044
+ onBlurCapture: () => o.current = !1
2045
+ };
2046
+ }
2047
+ function It() {
2048
+ const e = new CustomEvent(at);
2049
+ document.dispatchEvent(e);
2050
+ }
2051
+ function zn(e, t, n, { discrete: o }) {
2052
+ const r = n.originalEvent.target, a = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
2053
+ t && r.addEventListener(e, t, { once: !0 }), o ? Ir(r, a) : r.dispatchEvent(a);
2054
+ }
2055
+ function Ts(e, t) {
2056
+ return s.useReducer((n, o) => t[n][o] ?? n, e);
2057
+ }
2058
+ var Ve = (e) => {
2059
+ const { present: t, children: n } = e, o = Ds(t), r = typeof n == "function" ? n({ present: o.isPresent }) : s.Children.only(n), a = V(o.ref, As(r));
2060
+ return typeof n == "function" || o.isPresent ? s.cloneElement(r, { ref: a }) : null;
2061
+ };
2062
+ Ve.displayName = "Presence";
2063
+ function Ds(e) {
2064
+ const [t, n] = s.useState(), o = s.useRef(null), r = s.useRef(e), a = s.useRef("none"), c = e ? "mounted" : "unmounted", [d, u] = Ts(c, {
2065
+ mounted: {
2066
+ UNMOUNT: "unmounted",
2067
+ ANIMATION_OUT: "unmountSuspended"
2068
+ },
2069
+ unmountSuspended: {
2070
+ MOUNT: "mounted",
2071
+ ANIMATION_END: "unmounted"
2072
+ },
2073
+ unmounted: {
2074
+ MOUNT: "mounted"
2075
+ }
2076
+ });
2077
+ return s.useEffect(() => {
2078
+ const l = _e(o.current);
2079
+ a.current = d === "mounted" ? l : "none";
2080
+ }, [d]), ne(() => {
2081
+ const l = o.current, f = r.current;
2082
+ if (f !== e) {
2083
+ const g = a.current, x = _e(l);
2084
+ e ? u("MOUNT") : x === "none" || l?.display === "none" ? u("UNMOUNT") : u(f && g !== x ? "ANIMATION_OUT" : "UNMOUNT"), r.current = e;
2085
+ }
2086
+ }, [e, u]), ne(() => {
2087
+ if (t) {
2088
+ let l;
2089
+ const f = t.ownerDocument.defaultView ?? window, m = (x) => {
2090
+ const v = _e(o.current).includes(x.animationName);
2091
+ if (x.target === t && v && (u("ANIMATION_END"), !r.current)) {
2092
+ const h = t.style.animationFillMode;
2093
+ t.style.animationFillMode = "forwards", l = f.setTimeout(() => {
2094
+ t.style.animationFillMode === "forwards" && (t.style.animationFillMode = h);
2095
+ });
2096
+ }
2097
+ }, g = (x) => {
2098
+ x.target === t && (a.current = _e(o.current));
2099
+ };
2100
+ return t.addEventListener("animationstart", g), t.addEventListener("animationcancel", m), t.addEventListener("animationend", m), () => {
2101
+ f.clearTimeout(l), t.removeEventListener("animationstart", g), t.removeEventListener("animationcancel", m), t.removeEventListener("animationend", m);
2102
+ };
2103
+ } else
2104
+ u("ANIMATION_END");
2105
+ }, [t, u]), {
2106
+ isPresent: ["mounted", "unmountSuspended"].includes(d),
2107
+ ref: s.useCallback((l) => {
2108
+ o.current = l ? getComputedStyle(l) : null, n(l);
2109
+ }, [])
2110
+ };
2111
+ }
2112
+ function _e(e) {
2113
+ return e?.animationName || "none";
2114
+ }
2115
+ function As(e) {
2116
+ let t = Object.getOwnPropertyDescriptor(e.props, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning;
2117
+ return n ? e.ref : (t = Object.getOwnPropertyDescriptor(e, "ref")?.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
2118
+ }
2119
+ var Ze = 0;
2120
+ function Ms() {
2121
+ s.useEffect(() => {
2122
+ const e = document.querySelectorAll("[data-radix-focus-guard]");
2123
+ return document.body.insertAdjacentElement("afterbegin", e[0] ?? Rt()), document.body.insertAdjacentElement("beforeend", e[1] ?? Rt()), Ze++, () => {
2124
+ Ze === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((t) => t.remove()), Ze--;
2125
+ };
2126
+ }, []);
2127
+ }
2128
+ function Rt() {
2129
+ const e = document.createElement("span");
2130
+ return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
2131
+ }
2132
+ var Ue = "Dialog", [Kn, $a] = we(Ue), [Os, te] = Kn(Ue), qn = (e) => {
2133
+ const {
2134
+ __scopeDialog: t,
2135
+ children: n,
2136
+ open: o,
2137
+ defaultOpen: r,
2138
+ onOpenChange: a,
2139
+ modal: c = !0
2140
+ } = e, d = s.useRef(null), u = s.useRef(null), [l, f] = ye({
2141
+ prop: o,
2142
+ defaultProp: r ?? !1,
2143
+ onChange: a,
2144
+ caller: Ue
2145
+ });
2146
+ return /* @__PURE__ */ i.jsx(
2147
+ Os,
2148
+ {
2149
+ scope: t,
2150
+ triggerRef: d,
2151
+ contentRef: u,
2152
+ contentId: Z(),
2153
+ titleId: Z(),
2154
+ descriptionId: Z(),
2155
+ open: l,
2156
+ onOpenChange: f,
2157
+ onOpenToggle: s.useCallback(() => f((m) => !m), [f]),
2158
+ modal: c,
2159
+ children: n
2160
+ }
2161
+ );
2162
+ };
2163
+ qn.displayName = Ue;
2164
+ var Yn = "DialogTrigger", Fs = s.forwardRef(
2165
+ (e, t) => {
2166
+ const { __scopeDialog: n, ...o } = e, r = te(Yn, n), a = V(t, r.triggerRef);
2167
+ return /* @__PURE__ */ i.jsx(
2168
+ k.button,
2169
+ {
2170
+ type: "button",
2171
+ "aria-haspopup": "dialog",
2172
+ "aria-expanded": r.open,
2173
+ "aria-controls": r.contentId,
2174
+ "data-state": xt(r.open),
2175
+ ...o,
2176
+ ref: a,
2177
+ onClick: se(e.onClick, r.onOpenToggle)
2178
+ }
2179
+ );
2180
+ }
2181
+ );
2182
+ Fs.displayName = Yn;
2183
+ var ht = "DialogPortal", [Ls, Xn] = Kn(ht, {
2184
+ forceMount: void 0
2185
+ }), Zn = (e) => {
2186
+ const { __scopeDialog: t, forceMount: n, children: o, container: r } = e, a = te(ht, t);
2187
+ return /* @__PURE__ */ i.jsx(Ls, { scope: t, forceMount: n, children: s.Children.map(o, (c) => /* @__PURE__ */ i.jsx(Ve, { present: n || a.open, children: /* @__PURE__ */ i.jsx(Dt, { asChild: !0, container: r, children: c }) })) });
2188
+ };
2189
+ Zn.displayName = ht;
2190
+ var De = "DialogOverlay", Jn = s.forwardRef(
2191
+ (e, t) => {
2192
+ const n = Xn(De, e.__scopeDialog), { forceMount: o = n.forceMount, ...r } = e, a = te(De, e.__scopeDialog);
2193
+ return a.modal ? /* @__PURE__ */ i.jsx(Ve, { present: o || a.open, children: /* @__PURE__ */ i.jsx($s, { ...r, ref: t }) }) : null;
2194
+ }
2195
+ );
2196
+ Jn.displayName = De;
2197
+ var Bs = kt("DialogOverlay.RemoveScroll"), $s = s.forwardRef(
2198
+ (e, t) => {
2199
+ const { __scopeDialog: n, ...o } = e, r = te(De, n);
2200
+ return (
2201
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
2202
+ // ie. when `Overlay` and `Content` are siblings
2203
+ /* @__PURE__ */ i.jsx(Mt, { as: Bs, allowPinchZoom: !0, shards: [r.contentRef], children: /* @__PURE__ */ i.jsx(
2204
+ k.div,
2205
+ {
2206
+ "data-state": xt(r.open),
2207
+ ...o,
2208
+ ref: t,
2209
+ style: { pointerEvents: "auto", ...o.style }
2210
+ }
2211
+ ) })
2212
+ );
2213
+ }
2214
+ ), ve = "DialogContent", Qn = s.forwardRef(
2215
+ (e, t) => {
2216
+ const n = Xn(ve, e.__scopeDialog), { forceMount: o = n.forceMount, ...r } = e, a = te(ve, e.__scopeDialog);
2217
+ return /* @__PURE__ */ i.jsx(Ve, { present: o || a.open, children: a.modal ? /* @__PURE__ */ i.jsx(Vs, { ...r, ref: t }) : /* @__PURE__ */ i.jsx(Us, { ...r, ref: t }) });
2218
+ }
2219
+ );
2220
+ Qn.displayName = ve;
2221
+ var Vs = s.forwardRef(
2222
+ (e, t) => {
2223
+ const n = te(ve, e.__scopeDialog), o = s.useRef(null), r = V(t, n.contentRef, o);
2224
+ return s.useEffect(() => {
2225
+ const a = o.current;
2226
+ if (a) return At(a);
2227
+ }, []), /* @__PURE__ */ i.jsx(
2228
+ er,
2229
+ {
2230
+ ...e,
2231
+ ref: r,
2232
+ trapFocus: n.open,
2233
+ disableOutsidePointerEvents: !0,
2234
+ onCloseAutoFocus: se(e.onCloseAutoFocus, (a) => {
2235
+ a.preventDefault(), n.triggerRef.current?.focus();
2236
+ }),
2237
+ onPointerDownOutside: se(e.onPointerDownOutside, (a) => {
2238
+ const c = a.detail.originalEvent, d = c.button === 0 && c.ctrlKey === !0;
2239
+ (c.button === 2 || d) && a.preventDefault();
2240
+ }),
2241
+ onFocusOutside: se(
2242
+ e.onFocusOutside,
2243
+ (a) => a.preventDefault()
2244
+ )
2245
+ }
2246
+ );
2247
+ }
2248
+ ), Us = s.forwardRef(
2249
+ (e, t) => {
2250
+ const n = te(ve, e.__scopeDialog), o = s.useRef(!1), r = s.useRef(!1);
2251
+ return /* @__PURE__ */ i.jsx(
2252
+ er,
2253
+ {
2254
+ ...e,
2255
+ ref: t,
2256
+ trapFocus: !1,
2257
+ disableOutsidePointerEvents: !1,
2258
+ onCloseAutoFocus: (a) => {
2259
+ e.onCloseAutoFocus?.(a), a.defaultPrevented || (o.current || n.triggerRef.current?.focus(), a.preventDefault()), o.current = !1, r.current = !1;
2260
+ },
2261
+ onInteractOutside: (a) => {
2262
+ e.onInteractOutside?.(a), a.defaultPrevented || (o.current = !0, a.detail.originalEvent.type === "pointerdown" && (r.current = !0));
2263
+ const c = a.target;
2264
+ n.triggerRef.current?.contains(c) && a.preventDefault(), a.detail.originalEvent.type === "focusin" && r.current && a.preventDefault();
2265
+ }
2266
+ }
2267
+ );
2268
+ }
2269
+ ), er = s.forwardRef(
2270
+ (e, t) => {
2271
+ const { __scopeDialog: n, trapFocus: o, onOpenAutoFocus: r, onCloseAutoFocus: a, ...c } = e, d = te(ve, n), u = s.useRef(null), l = V(t, u);
2272
+ return Ms(), /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
2273
+ /* @__PURE__ */ i.jsx(
2274
+ Ot,
2275
+ {
2276
+ asChild: !0,
2277
+ loop: !0,
2278
+ trapped: o,
2279
+ onMountAutoFocus: r,
2280
+ onUnmountAutoFocus: a,
2281
+ children: /* @__PURE__ */ i.jsx(
2282
+ Hn,
2283
+ {
2284
+ role: "dialog",
2285
+ id: d.contentId,
2286
+ "aria-describedby": d.descriptionId,
2287
+ "aria-labelledby": d.titleId,
2288
+ "data-state": xt(d.open),
2289
+ ...c,
2290
+ ref: l,
2291
+ onDismiss: () => d.onOpenChange(!1)
2292
+ }
2293
+ )
2294
+ }
2295
+ ),
2296
+ /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
2297
+ /* @__PURE__ */ i.jsx(zs, { titleId: d.titleId }),
2298
+ /* @__PURE__ */ i.jsx(qs, { contentRef: u, descriptionId: d.descriptionId })
2299
+ ] })
2300
+ ] });
2301
+ }
2302
+ ), gt = "DialogTitle", Gs = s.forwardRef(
2303
+ (e, t) => {
2304
+ const { __scopeDialog: n, ...o } = e, r = te(gt, n);
2305
+ return /* @__PURE__ */ i.jsx(k.h2, { id: r.titleId, ...o, ref: t });
2306
+ }
2307
+ );
2308
+ Gs.displayName = gt;
2309
+ var tr = "DialogDescription", Ws = s.forwardRef(
2310
+ (e, t) => {
2311
+ const { __scopeDialog: n, ...o } = e, r = te(tr, n);
2312
+ return /* @__PURE__ */ i.jsx(k.p, { id: r.descriptionId, ...o, ref: t });
2313
+ }
2314
+ );
2315
+ Ws.displayName = tr;
2316
+ var nr = "DialogClose", Hs = s.forwardRef(
2317
+ (e, t) => {
2318
+ const { __scopeDialog: n, ...o } = e, r = te(nr, n);
2319
+ return /* @__PURE__ */ i.jsx(
2320
+ k.button,
2321
+ {
2322
+ type: "button",
2323
+ ...o,
2324
+ ref: t,
2325
+ onClick: se(e.onClick, () => r.onOpenChange(!1))
2326
+ }
2327
+ );
2328
+ }
2329
+ );
2330
+ Hs.displayName = nr;
2331
+ function xt(e) {
2332
+ return e ? "open" : "closed";
2333
+ }
2334
+ var rr = "DialogTitleWarning", [Va, or] = Rr(rr, {
2335
+ contentName: ve,
2336
+ titleName: gt,
2337
+ docsSlug: "dialog"
2338
+ }), zs = ({ titleId: e }) => {
2339
+ const t = or(rr), n = `\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
2340
+
2341
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
2342
+
2343
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;
2344
+ return s.useEffect(() => {
2345
+ e && (document.getElementById(e) || console.error(n));
2346
+ }, [n, e]), null;
2347
+ }, Ks = "DialogDescriptionWarning", qs = ({ contentRef: e, descriptionId: t }) => {
2348
+ const o = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${or(Ks).contentName}}.`;
2349
+ return s.useEffect(() => {
2350
+ const r = e.current?.getAttribute("aria-describedby");
2351
+ t && r && (document.getElementById(t) || console.warn(o));
2352
+ }, [o, e, t]), null;
2353
+ }, Ys = qn, Xs = Zn, Zs = Jn, Js = Qn, Ie = '[cmdk-group=""]', Je = '[cmdk-group-items=""]', Qs = '[cmdk-group-heading=""]', sr = '[cmdk-item=""]', Nt = `${sr}:not([aria-disabled="true"])`, it = "cmdk-item-select", xe = "data-value", ea = (e, t, n) => Es(e, t, n), ar = s.createContext(void 0), Pe = () => s.useContext(ar), ir = s.createContext(void 0), bt = () => s.useContext(ir), cr = s.createContext(void 0), lr = s.forwardRef((e, t) => {
2354
+ let n = be(() => {
2355
+ var p, R;
2356
+ return { search: "", value: (R = (p = e.value) != null ? p : e.defaultValue) != null ? R : "", selectedItemId: void 0, filtered: { count: 0, items: /* @__PURE__ */ new Map(), groups: /* @__PURE__ */ new Set() } };
2357
+ }), o = be(() => /* @__PURE__ */ new Set()), r = be(() => /* @__PURE__ */ new Map()), a = be(() => /* @__PURE__ */ new Map()), c = be(() => /* @__PURE__ */ new Set()), d = dr(e), { label: u, children: l, value: f, onValueChange: m, filter: g, shouldFilter: x, loop: w, disablePointerSelection: v = !1, vimBindings: h = !0, ...S } = e, y = Z(), I = Z(), A = Z(), M = s.useRef(null), j = ua();
2358
+ he(() => {
2359
+ if (f !== void 0) {
2360
+ let p = f.trim();
2361
+ n.current.value = p, E.emit();
2362
+ }
2363
+ }, [f]), he(() => {
2364
+ j(6, X);
2365
+ }, []);
2366
+ let E = s.useMemo(() => ({ subscribe: (p) => (c.current.add(p), () => c.current.delete(p)), snapshot: () => n.current, setState: (p, R, N) => {
2367
+ var C, _, b, T;
2368
+ if (!Object.is(n.current[p], R)) {
2369
+ if (n.current[p] = R, p === "search") q(), U(), j(1, W);
2370
+ else if (p === "value") {
2371
+ if (document.activeElement.hasAttribute("cmdk-input") || document.activeElement.hasAttribute("cmdk-root")) {
2372
+ let D = document.getElementById(A);
2373
+ D ? D.focus() : (C = document.getElementById(y)) == null || C.focus();
2374
+ }
2375
+ if (j(7, () => {
2376
+ var D;
2377
+ n.current.selectedItemId = (D = H()) == null ? void 0 : D.id, E.emit();
2378
+ }), N || j(5, X), ((_ = d.current) == null ? void 0 : _.value) !== void 0) {
2379
+ let D = R ?? "";
2380
+ (T = (b = d.current).onValueChange) == null || T.call(b, D);
2381
+ return;
2382
+ }
2383
+ }
2384
+ E.emit();
2385
+ }
2386
+ }, emit: () => {
2387
+ c.current.forEach((p) => p());
2388
+ } }), []), P = s.useMemo(() => ({ value: (p, R, N) => {
2389
+ var C;
2390
+ R !== ((C = a.current.get(p)) == null ? void 0 : C.value) && (a.current.set(p, { value: R, keywords: N }), n.current.filtered.items.set(p, K(R, N)), j(2, () => {
2391
+ U(), E.emit();
2392
+ }));
2393
+ }, item: (p, R) => (o.current.add(p), R && (r.current.has(R) ? r.current.get(R).add(p) : r.current.set(R, /* @__PURE__ */ new Set([p]))), j(3, () => {
2394
+ q(), U(), n.current.value || W(), E.emit();
2395
+ }), () => {
2396
+ a.current.delete(p), o.current.delete(p), n.current.filtered.items.delete(p);
2397
+ let N = H();
2398
+ j(4, () => {
2399
+ q(), N?.getAttribute("id") === p && W(), E.emit();
2400
+ });
2401
+ }), group: (p) => (r.current.has(p) || r.current.set(p, /* @__PURE__ */ new Set()), () => {
2402
+ a.current.delete(p), r.current.delete(p);
2403
+ }), filter: () => d.current.shouldFilter, label: u || e["aria-label"], getDisablePointerSelection: () => d.current.disablePointerSelection, listId: y, inputId: A, labelId: I, listInnerRef: M }), []);
2404
+ function K(p, R) {
2405
+ var N, C;
2406
+ let _ = (C = (N = d.current) == null ? void 0 : N.filter) != null ? C : ea;
2407
+ return p ? _(p, n.current.search, R) : 0;
2408
+ }
2409
+ function U() {
2410
+ if (!n.current.search || d.current.shouldFilter === !1) return;
2411
+ let p = n.current.filtered.items, R = [];
2412
+ n.current.filtered.groups.forEach((C) => {
2413
+ let _ = r.current.get(C), b = 0;
2414
+ _.forEach((T) => {
2415
+ let D = p.get(T);
2416
+ b = Math.max(D, b);
2417
+ }), R.push([C, b]);
2418
+ });
2419
+ let N = M.current;
2420
+ z().sort((C, _) => {
2421
+ var b, T;
2422
+ let D = C.getAttribute("id"), O = _.getAttribute("id");
2423
+ return ((b = p.get(O)) != null ? b : 0) - ((T = p.get(D)) != null ? T : 0);
2424
+ }).forEach((C) => {
2425
+ let _ = C.closest(Je);
2426
+ _ ? _.appendChild(C.parentElement === _ ? C : C.closest(`${Je} > *`)) : N.appendChild(C.parentElement === N ? C : C.closest(`${Je} > *`));
2427
+ }), R.sort((C, _) => _[1] - C[1]).forEach((C) => {
2428
+ var _;
2429
+ let b = (_ = M.current) == null ? void 0 : _.querySelector(`${Ie}[${xe}="${encodeURIComponent(C[0])}"]`);
2430
+ b?.parentElement.appendChild(b);
2431
+ });
2432
+ }
2433
+ function W() {
2434
+ let p = z().find((N) => N.getAttribute("aria-disabled") !== "true"), R = p?.getAttribute(xe);
2435
+ E.setState("value", R || void 0);
2436
+ }
2437
+ function q() {
2438
+ var p, R, N, C;
2439
+ if (!n.current.search || d.current.shouldFilter === !1) {
2440
+ n.current.filtered.count = o.current.size;
2441
+ return;
2442
+ }
2443
+ n.current.filtered.groups = /* @__PURE__ */ new Set();
2444
+ let _ = 0;
2445
+ for (let b of o.current) {
2446
+ let T = (R = (p = a.current.get(b)) == null ? void 0 : p.value) != null ? R : "", D = (C = (N = a.current.get(b)) == null ? void 0 : N.keywords) != null ? C : [], O = K(T, D);
2447
+ n.current.filtered.items.set(b, O), O > 0 && _++;
2448
+ }
2449
+ for (let [b, T] of r.current) for (let D of T) if (n.current.filtered.items.get(D) > 0) {
2450
+ n.current.filtered.groups.add(b);
2451
+ break;
2452
+ }
2453
+ n.current.filtered.count = _;
2454
+ }
2455
+ function X() {
2456
+ var p, R, N;
2457
+ let C = H();
2458
+ C && (((p = C.parentElement) == null ? void 0 : p.firstChild) === C && ((N = (R = C.closest(Ie)) == null ? void 0 : R.querySelector(Qs)) == null || N.scrollIntoView({ block: "nearest" })), C.scrollIntoView({ block: "nearest" }));
2459
+ }
2460
+ function H() {
2461
+ var p;
2462
+ return (p = M.current) == null ? void 0 : p.querySelector(`${sr}[aria-selected="true"]`);
2463
+ }
2464
+ function z() {
2465
+ var p;
2466
+ return Array.from(((p = M.current) == null ? void 0 : p.querySelectorAll(Nt)) || []);
2467
+ }
2468
+ function L(p) {
2469
+ let R = z()[p];
2470
+ R && E.setState("value", R.getAttribute(xe));
2471
+ }
2472
+ function Y(p) {
2473
+ var R;
2474
+ let N = H(), C = z(), _ = C.findIndex((T) => T === N), b = C[_ + p];
2475
+ (R = d.current) != null && R.loop && (b = _ + p < 0 ? C[C.length - 1] : _ + p === C.length ? C[0] : C[_ + p]), b && E.setState("value", b.getAttribute(xe));
2476
+ }
2477
+ function J(p) {
2478
+ let R = H(), N = R?.closest(Ie), C;
2479
+ for (; N && !C; ) N = p > 0 ? la(N, Ie) : da(N, Ie), C = N?.querySelector(Nt);
2480
+ C ? E.setState("value", C.getAttribute(xe)) : Y(p);
2481
+ }
2482
+ let Q = () => L(z().length - 1), ge = (p) => {
2483
+ p.preventDefault(), p.metaKey ? Q() : p.altKey ? J(1) : Y(1);
2484
+ }, de = (p) => {
2485
+ p.preventDefault(), p.metaKey ? L(0) : p.altKey ? J(-1) : Y(-1);
2486
+ };
2487
+ return s.createElement(k.div, { ref: t, tabIndex: -1, ...S, "cmdk-root": "", onKeyDown: (p) => {
2488
+ var R;
2489
+ (R = S.onKeyDown) == null || R.call(S, p);
2490
+ let N = p.nativeEvent.isComposing || p.keyCode === 229;
2491
+ if (!(p.defaultPrevented || N)) switch (p.key) {
2492
+ case "n":
2493
+ case "j": {
2494
+ h && p.ctrlKey && ge(p);
2495
+ break;
2496
+ }
2497
+ case "ArrowDown": {
2498
+ ge(p);
2499
+ break;
2500
+ }
2501
+ case "p":
2502
+ case "k": {
2503
+ h && p.ctrlKey && de(p);
2504
+ break;
2505
+ }
2506
+ case "ArrowUp": {
2507
+ de(p);
2508
+ break;
2509
+ }
2510
+ case "Home": {
2511
+ p.preventDefault(), L(0);
2512
+ break;
2513
+ }
2514
+ case "End": {
2515
+ p.preventDefault(), Q();
2516
+ break;
2517
+ }
2518
+ case "Enter": {
2519
+ p.preventDefault();
2520
+ let C = H();
2521
+ if (C) {
2522
+ let _ = new Event(it);
2523
+ C.dispatchEvent(_);
2524
+ }
2525
+ }
2526
+ }
2527
+ } }, s.createElement("label", { "cmdk-label": "", htmlFor: P.inputId, id: P.labelId, style: pa }, u), Ge(e, (p) => s.createElement(ir.Provider, { value: E }, s.createElement(ar.Provider, { value: P }, p))));
2528
+ }), ta = s.forwardRef((e, t) => {
2529
+ var n, o;
2530
+ let r = Z(), a = s.useRef(null), c = s.useContext(cr), d = Pe(), u = dr(e), l = (o = (n = u.current) == null ? void 0 : n.forceMount) != null ? o : c?.forceMount;
2531
+ he(() => {
2532
+ if (!l) return d.item(r, c?.id);
2533
+ }, [l]);
2534
+ let f = ur(r, a, [e.value, e.children, a], e.keywords), m = bt(), g = ie((j) => j.value && j.value === f.current), x = ie((j) => l || d.filter() === !1 ? !0 : j.search ? j.filtered.items.get(r) > 0 : !0);
2535
+ s.useEffect(() => {
2536
+ let j = a.current;
2537
+ if (!(!j || e.disabled)) return j.addEventListener(it, w), () => j.removeEventListener(it, w);
2538
+ }, [x, e.onSelect, e.disabled]);
2539
+ function w() {
2540
+ var j, E;
2541
+ v(), (E = (j = u.current).onSelect) == null || E.call(j, f.current);
2542
+ }
2543
+ function v() {
2544
+ m.setState("value", f.current, !0);
2545
+ }
2546
+ if (!x) return null;
2547
+ let { disabled: h, value: S, onSelect: y, forceMount: I, keywords: A, ...M } = e;
2548
+ return s.createElement(k.div, { ref: Ne(a, t), ...M, id: r, "cmdk-item": "", role: "option", "aria-disabled": !!h, "aria-selected": !!g, "data-disabled": !!h, "data-selected": !!g, onPointerMove: h || d.getDisablePointerSelection() ? void 0 : v, onClick: h ? void 0 : w }, e.children);
2549
+ }), na = s.forwardRef((e, t) => {
2550
+ let { heading: n, children: o, forceMount: r, ...a } = e, c = Z(), d = s.useRef(null), u = s.useRef(null), l = Z(), f = Pe(), m = ie((x) => r || f.filter() === !1 ? !0 : x.search ? x.filtered.groups.has(c) : !0);
2551
+ he(() => f.group(c), []), ur(c, d, [e.value, e.heading, u]);
2552
+ let g = s.useMemo(() => ({ id: c, forceMount: r }), [r]);
2553
+ return s.createElement(k.div, { ref: Ne(d, t), ...a, "cmdk-group": "", role: "presentation", hidden: m ? void 0 : !0 }, n && s.createElement("div", { ref: u, "cmdk-group-heading": "", "aria-hidden": !0, id: l }, n), Ge(e, (x) => s.createElement("div", { "cmdk-group-items": "", role: "group", "aria-labelledby": n ? l : void 0 }, s.createElement(cr.Provider, { value: g }, x))));
2554
+ }), ra = s.forwardRef((e, t) => {
2555
+ let { alwaysRender: n, ...o } = e, r = s.useRef(null), a = ie((c) => !c.search);
2556
+ return !n && !a ? null : s.createElement(k.div, { ref: Ne(r, t), ...o, "cmdk-separator": "", role: "separator" });
2557
+ }), oa = s.forwardRef((e, t) => {
2558
+ let { onValueChange: n, ...o } = e, r = e.value != null, a = bt(), c = ie((l) => l.search), d = ie((l) => l.selectedItemId), u = Pe();
2559
+ return s.useEffect(() => {
2560
+ e.value != null && a.setState("search", e.value);
2561
+ }, [e.value]), s.createElement(k.input, { ref: t, ...o, "cmdk-input": "", autoComplete: "off", autoCorrect: "off", spellCheck: !1, "aria-autocomplete": "list", role: "combobox", "aria-expanded": !0, "aria-controls": u.listId, "aria-labelledby": u.labelId, "aria-activedescendant": d, id: u.inputId, type: "text", value: r ? e.value : c, onChange: (l) => {
2562
+ r || a.setState("search", l.target.value), n?.(l.target.value);
2563
+ } });
2564
+ }), sa = s.forwardRef((e, t) => {
2565
+ let { children: n, label: o = "Suggestions", ...r } = e, a = s.useRef(null), c = s.useRef(null), d = ie((l) => l.selectedItemId), u = Pe();
2566
+ return s.useEffect(() => {
2567
+ if (c.current && a.current) {
2568
+ let l = c.current, f = a.current, m, g = new ResizeObserver(() => {
2569
+ m = requestAnimationFrame(() => {
2570
+ let x = l.offsetHeight;
2571
+ f.style.setProperty("--cmdk-list-height", x.toFixed(1) + "px");
2572
+ });
2573
+ });
2574
+ return g.observe(l), () => {
2575
+ cancelAnimationFrame(m), g.unobserve(l);
2576
+ };
2577
+ }
2578
+ }, []), s.createElement(k.div, { ref: Ne(a, t), ...r, "cmdk-list": "", role: "listbox", tabIndex: -1, "aria-activedescendant": d, "aria-label": o, id: u.listId }, Ge(e, (l) => s.createElement("div", { ref: Ne(c, u.listInnerRef), "cmdk-list-sizer": "" }, l)));
2579
+ }), aa = s.forwardRef((e, t) => {
2580
+ let { open: n, onOpenChange: o, overlayClassName: r, contentClassName: a, container: c, ...d } = e;
2581
+ return s.createElement(Ys, { open: n, onOpenChange: o }, s.createElement(Xs, { container: c }, s.createElement(Zs, { "cmdk-overlay": "", className: r }), s.createElement(Js, { "aria-label": e.label, "cmdk-dialog": "", className: a }, s.createElement(lr, { ref: t, ...d }))));
2582
+ }), ia = s.forwardRef((e, t) => ie((n) => n.filtered.count === 0) ? s.createElement(k.div, { ref: t, ...e, "cmdk-empty": "", role: "presentation" }) : null), ca = s.forwardRef((e, t) => {
2583
+ let { progress: n, children: o, label: r = "Loading...", ...a } = e;
2584
+ return s.createElement(k.div, { ref: t, ...a, "cmdk-loading": "", role: "progressbar", "aria-valuenow": n, "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": r }, Ge(e, (c) => s.createElement("div", { "aria-hidden": !0 }, c)));
2585
+ }), Ee = Object.assign(lr, { List: sa, Item: ta, Input: oa, Group: na, Separator: ra, Dialog: aa, Empty: ia, Loading: ca });
2586
+ function la(e, t) {
2587
+ let n = e.nextElementSibling;
2588
+ for (; n; ) {
2589
+ if (n.matches(t)) return n;
2590
+ n = n.nextElementSibling;
2591
+ }
2592
+ }
2593
+ function da(e, t) {
2594
+ let n = e.previousElementSibling;
2595
+ for (; n; ) {
2596
+ if (n.matches(t)) return n;
2597
+ n = n.previousElementSibling;
2598
+ }
2599
+ }
2600
+ function dr(e) {
2601
+ let t = s.useRef(e);
2602
+ return he(() => {
2603
+ t.current = e;
2604
+ }), t;
2605
+ }
2606
+ var he = typeof window > "u" ? s.useEffect : s.useLayoutEffect;
2607
+ function be(e) {
2608
+ let t = s.useRef();
2609
+ return t.current === void 0 && (t.current = e()), t;
2610
+ }
2611
+ function ie(e) {
2612
+ let t = bt(), n = () => e(t.snapshot());
2613
+ return s.useSyncExternalStore(t.subscribe, n, n);
2614
+ }
2615
+ function ur(e, t, n, o = []) {
2616
+ let r = s.useRef(), a = Pe();
2617
+ return he(() => {
2618
+ var c;
2619
+ let d = (() => {
2620
+ var l;
2621
+ for (let f of n) {
2622
+ if (typeof f == "string") return f.trim();
2623
+ if (typeof f == "object" && "current" in f) return f.current ? (l = f.current.textContent) == null ? void 0 : l.trim() : r.current;
2624
+ }
2625
+ })(), u = o.map((l) => l.trim());
2626
+ a.value(e, d, u), (c = t.current) == null || c.setAttribute(xe, d), r.current = d;
2627
+ }), r;
2628
+ }
2629
+ var ua = () => {
2630
+ let [e, t] = s.useState(), n = be(() => /* @__PURE__ */ new Map());
2631
+ return he(() => {
2632
+ n.current.forEach((o) => o()), n.current = /* @__PURE__ */ new Map();
2633
+ }, [e]), (o, r) => {
2634
+ n.current.set(o, r), t({});
2635
+ };
2636
+ };
2637
+ function fa(e) {
2638
+ let t = e.type;
2639
+ return typeof t == "function" ? t(e.props) : "render" in t ? t.render(e.props) : e;
2640
+ }
2641
+ function Ge({ asChild: e, children: t }, n) {
2642
+ return e && s.isValidElement(t) ? s.cloneElement(fa(t), { ref: t.ref }, n(t.props.children)) : n(t);
2643
+ }
2644
+ var pa = { position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" };
2645
+ function ma({ className: e, ...t }) {
2646
+ return /* @__PURE__ */ i.jsx(
2647
+ Ee,
2648
+ {
2649
+ className: $(
2650
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
2651
+ e
2652
+ ),
2653
+ "data-slot": "command",
2654
+ ...t
2655
+ }
2656
+ );
2657
+ }
2658
+ function va({ className: e, ...t }) {
2659
+ return /* @__PURE__ */ i.jsxs("div", { className: "flex h-9 items-center gap-2 border-b px-3", "data-slot": "command-input-wrapper", children: [
2660
+ /* @__PURE__ */ i.jsx(Vr, { className: "size-4 shrink-0 opacity-50" }),
2661
+ /* @__PURE__ */ i.jsx(
2662
+ Ee.Input,
2663
+ {
2664
+ className: $(
2665
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
2666
+ e
2667
+ ),
2668
+ "data-slot": "command-input",
2669
+ ...t
2670
+ }
2671
+ )
2672
+ ] });
2673
+ }
2674
+ function ha({ className: e, ...t }) {
2675
+ return /* @__PURE__ */ i.jsx(
2676
+ Ee.List,
2677
+ {
2678
+ className: $("max-h-[300px] scroll-py-1 overflow-y-auto overflow-x-hidden", e),
2679
+ "data-slot": "command-list",
2680
+ ...t
2681
+ }
2682
+ );
2683
+ }
2684
+ function ga({ ...e }) {
2685
+ return /* @__PURE__ */ i.jsx(Ee.Empty, { className: "py-6 text-center text-sm", "data-slot": "command-empty", ...e });
2686
+ }
2687
+ function xa({ className: e, ...t }) {
2688
+ return /* @__PURE__ */ i.jsx(
2689
+ Ee.Group,
2690
+ {
2691
+ className: $(
2692
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:text-xs",
2693
+ e
2694
+ ),
2695
+ "data-slot": "command-group",
2696
+ ...t
2697
+ }
2698
+ );
2699
+ }
2700
+ function ba({ className: e, ...t }) {
2701
+ return /* @__PURE__ */ i.jsx(
2702
+ Ee.Item,
2703
+ {
2704
+ className: $(
2705
+ "relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0",
2706
+ e
2707
+ ),
2708
+ "data-slot": "command-item",
2709
+ ...t
2710
+ }
2711
+ );
2712
+ }
2713
+ const ya = ({
2714
+ placeholder: e,
2715
+ selected: t,
2716
+ className: n,
2717
+ open: o,
2718
+ renderSelected: r = (a) => a.label
2719
+ }) => /* @__PURE__ */ i.jsx(Lt, { asChild: !0, children: /* @__PURE__ */ i.jsxs(pr, { "aria-expanded": o, className: `justify-between ${n}`, role: "combobox", variant: "outline", children: [
2720
+ r(t || { label: e, value: "" }),
2721
+ /* @__PURE__ */ i.jsx(Dr, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
2722
+ ] }) }), Ua = ({
2723
+ options: e,
2724
+ value: t = "",
2725
+ placeholder: n = "Select a value...",
2726
+ className: o = "",
2727
+ onSelect: r = () => {
2728
+ },
2729
+ renderSelected: a = (c) => c.label
2730
+ }) => {
2731
+ const [c, d] = lt(!1), u = vr(() => e.find((l) => l.value === t), [e, t]);
2732
+ return /* @__PURE__ */ i.jsxs(Ft, { onOpenChange: d, open: c, children: [
2733
+ /* @__PURE__ */ i.jsx(
2734
+ ya,
2735
+ {
2736
+ className: `w-full ${o}`,
2737
+ open: c,
2738
+ placeholder: n,
2739
+ renderSelected: a,
2740
+ selected: u
2741
+ }
2742
+ ),
2743
+ /* @__PURE__ */ i.jsx(Bt, { className: "w-full p-0", children: /* @__PURE__ */ i.jsxs(ma, { value: t, children: [
2744
+ /* @__PURE__ */ i.jsx(va, { "aria-label": "Search options", className: "h-9", placeholder: "Search" }),
2745
+ /* @__PURE__ */ i.jsxs(ha, { children: [
2746
+ /* @__PURE__ */ i.jsx(ga, { children: "No results found" }),
2747
+ /* @__PURE__ */ i.jsx(xa, { children: e.map((l) => /* @__PURE__ */ i.jsxs(
2748
+ ba,
2749
+ {
2750
+ onSelect: () => {
2751
+ d(!1), r(l.value);
2752
+ },
2753
+ value: l.value,
2754
+ children: [
2755
+ l.icon ? /* @__PURE__ */ i.jsx("span", { className: "mr-2", children: l.icon }) : "",
2756
+ l.label,
2757
+ /* @__PURE__ */ i.jsx(ut, { className: $("ml-auto", l.value === t ? "opacity-100" : "opacity-0") })
2758
+ ]
2759
+ },
2760
+ l.value
2761
+ )) })
2762
+ ] })
2763
+ ] }) })
2764
+ ] });
2765
+ };
2766
+ function wa({ className: e, ...t }) {
2767
+ return /* @__PURE__ */ i.jsx(
2768
+ "textarea",
2769
+ {
2770
+ className: $(
2771
+ "field-sizing-content flex min-h-16 w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-xs outline-none transition-[color,box-shadow] placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm dark:aria-invalid:ring-destructive/40",
2772
+ e
2773
+ ),
2774
+ "data-slot": "textarea",
2775
+ ...t
2776
+ }
2777
+ );
2778
+ }
2779
+ function Ga({ label: e, name: t, note: n, placeholder: o, className: r, error: a, ...c }) {
2780
+ return /* @__PURE__ */ i.jsxs(ae, { className: "w-full", direction: "col", gap: "2", children: [
2781
+ e && /* @__PURE__ */ i.jsx(Se, { htmlFor: t, children: e }),
2782
+ /* @__PURE__ */ i.jsx(
2783
+ wa,
2784
+ {
2785
+ "aria-label": e || t,
2786
+ className: r,
2787
+ id: t,
2788
+ name: t,
2789
+ placeholder: o,
2790
+ ...c
2791
+ }
2792
+ ),
2793
+ n && /* @__PURE__ */ i.jsx(Ae, { size: "sm", variant: "muted", children: n }),
2794
+ a && /* @__PURE__ */ i.jsx(je, { message: a })
2795
+ ] });
2796
+ }
2797
+ export {
2798
+ Aa as C,
2799
+ Ta as D,
2800
+ je as I,
2801
+ Se as L,
2802
+ Fa as N,
2803
+ La as R,
2804
+ Da as S,
2805
+ Ga as T,
2806
+ Ma as a,
2807
+ Oa as b,
2808
+ os as c,
2809
+ Ba as d,
2810
+ Ua as e,
2811
+ Un as f,
2812
+ Zt as g,
2813
+ so as h,
2814
+ ao as i
2815
+ };