tmex-cli 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/runtime/server.js +718 -186
  2. package/package.json +1 -1
  3. package/resources/fe-dist/assets/DevicePage-n4JoyDed.js +26 -0
  4. package/resources/fe-dist/assets/DevicePage-n4JoyDed.js.map +1 -0
  5. package/resources/fe-dist/assets/DevicesPage-BwLKaiUR.js +17 -0
  6. package/resources/fe-dist/assets/{DevicesPage-CtNzaW_c.js.map → DevicesPage-BwLKaiUR.js.map} +1 -1
  7. package/resources/fe-dist/assets/SettingsPage-hS99lHcp.js +17 -0
  8. package/resources/fe-dist/assets/SettingsPage-hS99lHcp.js.map +1 -0
  9. package/resources/fe-dist/assets/index-CJaX5rlK.css +1 -4527
  10. package/resources/fe-dist/assets/index-CJyFlAt8.js +449 -0
  11. package/resources/fe-dist/assets/index-CJyFlAt8.js.map +1 -0
  12. package/resources/fe-dist/assets/select-DGBwxGiK.js +17 -0
  13. package/resources/fe-dist/assets/{select-BNsiC9zT.js.map → select-DGBwxGiK.js.map} +1 -1
  14. package/resources/fe-dist/assets/switch-CWUBjs7N.js +12 -0
  15. package/resources/fe-dist/assets/{switch-CIU4AisU.js.map → switch-CWUBjs7N.js.map} +1 -1
  16. package/resources/fe-dist/assets/useValueChanged-DwJ_SDCu.js +7 -0
  17. package/resources/fe-dist/assets/{useValueChanged-V23H0VpC.js.map → useValueChanged-DwJ_SDCu.js.map} +1 -1
  18. package/resources/fe-dist/index.html +1 -1
  19. package/resources/gateway-drizzle/0002_broad_vengeance.sql +3 -0
  20. package/resources/gateway-drizzle/meta/0000_snapshot.json +17 -6
  21. package/resources/gateway-drizzle/meta/0001_snapshot.json +17 -6
  22. package/resources/gateway-drizzle/meta/0002_snapshot.json +535 -0
  23. package/resources/gateway-drizzle/meta/_journal.json +8 -1
  24. package/resources/fe-dist/assets/DevicePage-iSkEDEpS.js +0 -4570
  25. package/resources/fe-dist/assets/DevicePage-iSkEDEpS.js.map +0 -1
  26. package/resources/fe-dist/assets/DevicesPage-CtNzaW_c.js +0 -2143
  27. package/resources/fe-dist/assets/SettingsPage-D25_d6j9.js +0 -1144
  28. package/resources/fe-dist/assets/SettingsPage-D25_d6j9.js.map +0 -1
  29. package/resources/fe-dist/assets/index-dsVN7rgz.js +0 -200
  30. package/resources/fe-dist/assets/index-dsVN7rgz.js.map +0 -1
  31. package/resources/fe-dist/assets/select-BNsiC9zT.js +0 -2805
  32. package/resources/fe-dist/assets/switch-CIU4AisU.js +0 -234
  33. package/resources/fe-dist/assets/useValueChanged-V23H0VpC.js +0 -351
@@ -1,2805 +0,0 @@
1
- var Yt = (e) => {
2
- throw TypeError(e);
3
- };
4
- var Ct = (e, t, n) => t.has(e) || Yt('Cannot ' + n);
5
- var le = (e, t, n) => (Ct(e, t, 'read from private field'), n ? n.call(e) : t.get(e)),
6
- Xe = (e, t, n) =>
7
- t.has(e)
8
- ? Yt('Cannot add the same private member more than once')
9
- : t instanceof WeakSet
10
- ? t.add(e)
11
- : t.set(e, n),
12
- Je = (e, t, n, r) => (Ct(e, t, 'write to private field'), r ? r.call(e, n) : t.set(e, n), n),
13
- Ze = (e, t, n) => (Ct(e, t, 'access private method'), n);
14
- import {
15
- bh as $n,
16
- aW as $t,
17
- ah as At,
18
- bd as Be,
19
- ba as Bn,
20
- bj as Bt,
21
- aV as Dn,
22
- Y as Dt,
23
- aX as Fn,
24
- bu as Ft,
25
- az as Ge,
26
- bi as Gn,
27
- b4 as Gt,
28
- j as H,
29
- a as Hn,
30
- bl as Jn,
31
- bf as Jt,
32
- b2 as Ke,
33
- a4 as Kn,
34
- bk as L,
35
- aU as Ln,
36
- b6 as Lt,
37
- b0 as Me,
38
- z as Mt,
39
- q as Ot,
40
- br as Pt,
41
- a0 as Q,
42
- ap as Qn,
43
- an as Qt,
44
- p as St,
45
- a_ as Un,
46
- c as Ut,
47
- y as Ve,
48
- b5 as Vt,
49
- b3 as We,
50
- ax as Wn,
51
- a7 as Xn,
52
- b9 as Xt,
53
- bg as Yn,
54
- ak as Zn,
55
- as as Zt,
56
- bb as _n,
57
- aY as an,
58
- L as ar,
59
- K as bn,
60
- F as br,
61
- b8 as cn,
62
- M as cr,
63
- ag as dn,
64
- Q as dr,
65
- a5 as ee,
66
- bs as en,
67
- a2 as er,
68
- bc as fn,
69
- N as fr,
70
- b1 as ft,
71
- ac as ge,
72
- w as gn,
73
- bq as gr,
74
- E as he,
75
- H as hn,
76
- aE as hr,
77
- aA as ir,
78
- aa as je,
79
- aZ as jn,
80
- k as ke,
81
- bp as lr,
82
- s as mn,
83
- bt as mr,
84
- bn as nr,
85
- C as or,
86
- v as pn,
87
- R as pr,
88
- be as qn,
89
- bo as rr,
90
- r as s,
91
- aJ as sr,
92
- bm as tr,
93
- Z as un,
94
- ab as ur,
95
- av as ut,
96
- b7 as wt,
97
- G as xn,
98
- bv as xr,
99
- J as yr,
100
- ae as zn,
101
- a$ as zt,
102
- } from './index-dsVN7rgz.js';
103
- import {
104
- j as Kt,
105
- k as Rn,
106
- m as Rr,
107
- u as _t,
108
- l as vn,
109
- n as vr,
110
- i as yn,
111
- } from './useValueChanged-V23H0VpC.js';
112
- var Fe,
113
- _e,
114
- Ie,
115
- He,
116
- Ue,
117
- Rt,
118
- Ht,
119
- ln,
120
- wr =
121
- ((ln = class extends Ln {
122
- constructor(n, r) {
123
- super();
124
- Xe(this, Ue);
125
- Xe(this, Fe);
126
- Xe(this, _e);
127
- Xe(this, Ie);
128
- Xe(this, He);
129
- Je(this, Fe, n), this.setOptions(r), this.bindMethods(), Ze(this, Ue, Rt).call(this);
130
- }
131
- bindMethods() {
132
- (this.mutate = this.mutate.bind(this)), (this.reset = this.reset.bind(this));
133
- }
134
- setOptions(n) {
135
- var u;
136
- const r = this.options;
137
- (this.options = le(this, Fe).defaultMutationOptions(n)),
138
- Dn(this.options, r) ||
139
- le(this, Fe)
140
- .getMutationCache()
141
- .notify({ type: 'observerOptionsUpdated', mutation: le(this, Ie), observer: this }),
142
- r != null &&
143
- r.mutationKey &&
144
- this.options.mutationKey &&
145
- $t(r.mutationKey) !== $t(this.options.mutationKey)
146
- ? this.reset()
147
- : ((u = le(this, Ie)) == null ? void 0 : u.state.status) === 'pending' &&
148
- le(this, Ie).setOptions(this.options);
149
- }
150
- onUnsubscribe() {
151
- var n;
152
- this.hasListeners() || (n = le(this, Ie)) == null || n.removeObserver(this);
153
- }
154
- onMutationUpdate(n) {
155
- Ze(this, Ue, Rt).call(this), Ze(this, Ue, Ht).call(this, n);
156
- }
157
- getCurrentResult() {
158
- return le(this, _e);
159
- }
160
- reset() {
161
- var n;
162
- (n = le(this, Ie)) == null || n.removeObserver(this),
163
- Je(this, Ie, void 0),
164
- Ze(this, Ue, Rt).call(this),
165
- Ze(this, Ue, Ht).call(this);
166
- }
167
- mutate(n, r) {
168
- var u;
169
- return (
170
- Je(this, He, r),
171
- (u = le(this, Ie)) == null || u.removeObserver(this),
172
- Je(this, Ie, le(this, Fe).getMutationCache().build(le(this, Fe), this.options)),
173
- le(this, Ie).addObserver(this),
174
- le(this, Ie).execute(n)
175
- );
176
- }
177
- }),
178
- (Fe = new WeakMap()),
179
- (_e = new WeakMap()),
180
- (Ie = new WeakMap()),
181
- (He = new WeakMap()),
182
- (Ue = new WeakSet()),
183
- (Rt = function () {
184
- var r;
185
- const n = ((r = le(this, Ie)) == null ? void 0 : r.state) ?? Fn();
186
- Je(this, _e, {
187
- ...n,
188
- isPending: n.status === 'pending',
189
- isSuccess: n.status === 'success',
190
- isError: n.status === 'error',
191
- isIdle: n.status === 'idle',
192
- mutate: this.mutate,
193
- reset: this.reset,
194
- });
195
- }),
196
- (Ht = function (n) {
197
- an.batch(() => {
198
- var r, u, o, d, l, f, p, x;
199
- if (le(this, He) && this.hasListeners()) {
200
- const i = le(this, _e).variables,
201
- b = le(this, _e).context,
202
- M = {
203
- client: le(this, Fe),
204
- meta: this.options.meta,
205
- mutationKey: this.options.mutationKey,
206
- };
207
- if ((n == null ? void 0 : n.type) === 'success') {
208
- try {
209
- (u = (r = le(this, He)).onSuccess) == null || u.call(r, n.data, i, b, M);
210
- } catch (I) {
211
- Promise.reject(I);
212
- }
213
- try {
214
- (d = (o = le(this, He)).onSettled) == null || d.call(o, n.data, null, i, b, M);
215
- } catch (I) {
216
- Promise.reject(I);
217
- }
218
- } else if ((n == null ? void 0 : n.type) === 'error') {
219
- try {
220
- (f = (l = le(this, He)).onError) == null || f.call(l, n.error, i, b, M);
221
- } catch (I) {
222
- Promise.reject(I);
223
- }
224
- try {
225
- (x = (p = le(this, He)).onSettled) == null || x.call(p, void 0, n.error, i, b, M);
226
- } catch (I) {
227
- Promise.reject(I);
228
- }
229
- }
230
- }
231
- this.listeners.forEach((i) => {
232
- i(le(this, _e));
233
- });
234
- });
235
- }),
236
- ln);
237
- function Po(e, t) {
238
- const n = Hn(),
239
- [r] = s.useState(() => new wr(n, e));
240
- s.useEffect(() => {
241
- r.setOptions(e);
242
- }, [r, e]);
243
- const u = s.useSyncExternalStore(
244
- s.useCallback((d) => r.subscribe(an.batchCalls(d)), [r]),
245
- () => r.getCurrentResult(),
246
- () => r.getCurrentResult()
247
- ),
248
- o = s.useCallback(
249
- (d, l) => {
250
- r.mutate(d, l).catch(jn);
251
- },
252
- [r]
253
- );
254
- if (u.error && Un(r.options.throwOnError, [u.error])) throw u.error;
255
- return { ...u, mutate: o, mutateAsync: u.mutate };
256
- } /**
257
- * @license lucide-react v0.564.0 - ISC
258
- *
259
- * This source code is licensed under the ISC license.
260
- * See the LICENSE file in the root directory of this source tree.
261
- */
262
- const Sr = [['path', { d: 'M20 6 9 17l-5-5', key: '1gmf2c' }]],
263
- Mr = Ut('check', Sr); /**
264
- * @license lucide-react v0.564.0 - ISC
265
- *
266
- * This source code is licensed under the ISC license.
267
- * See the LICENSE file in the root directory of this source tree.
268
- */
269
- const Tr = [['path', { d: 'm6 9 6 6 6-6', key: 'qrunsl' }]],
270
- wn = Ut('chevron-down', Tr); /**
271
- * @license lucide-react v0.564.0 - ISC
272
- *
273
- * This source code is licensed under the ISC license.
274
- * See the LICENSE file in the root directory of this source tree.
275
- */
276
- const Ir = [['path', { d: 'm18 15-6-6-6 6', key: '153udz' }]],
277
- Er = Ut('chevron-up', Ir);
278
- function bt(e, t, n) {
279
- return Math.floor(e / t) !== n;
280
- }
281
- function lt(e, t) {
282
- return t < 0 || t >= e.current.length;
283
- }
284
- function Nt(e, t) {
285
- return xe(e, { disabledIndices: t });
286
- }
287
- function tn(e, t) {
288
- return xe(e, { decrement: !0, startingIndex: e.current.length, disabledIndices: t });
289
- }
290
- function xe(
291
- e,
292
- { startingIndex: t = -1, decrement: n = !1, disabledIndices: r, amount: u = 1 } = {}
293
- ) {
294
- let o = t;
295
- do o += n ? -u : u;
296
- while (o >= 0 && o <= e.current.length - 1 && at(e, o, r));
297
- return o;
298
- }
299
- function Cr(
300
- e,
301
- {
302
- event: t,
303
- orientation: n,
304
- loopFocus: r,
305
- rtl: u,
306
- cols: o,
307
- disabledIndices: d,
308
- minIndex: l,
309
- maxIndex: f,
310
- prevIndex: p,
311
- stopEvent: x = !1,
312
- }
313
- ) {
314
- let i = p;
315
- const b = [],
316
- M = {};
317
- let I = !1;
318
- {
319
- let a = null,
320
- h = -1;
321
- e.current.forEach((g, c) => {
322
- if (g == null) return;
323
- const m = g.closest('[role="row"]');
324
- m && (I = !0),
325
- (m !== a || h === -1) && ((a = m), (h += 1), (b[h] = [])),
326
- b[h].push(c),
327
- (M[c] = h);
328
- });
329
- }
330
- const R = I && b.length > 0 && b.some((a) => a.length !== o);
331
- function S(a) {
332
- if (!R || p === -1) return;
333
- const h = M[p];
334
- if (h == null) return;
335
- const g = b[h].indexOf(p);
336
- let c = a === 'up' ? h - 1 : h + 1;
337
- r && (c < 0 ? (c = b.length - 1) : c >= b.length && (c = 0));
338
- const m = new Set();
339
- while (c >= 0 && c < b.length && !m.has(c)) {
340
- m.add(c);
341
- const j = b[c];
342
- if (j.length === 0) {
343
- c = a === 'up' ? c - 1 : c + 1;
344
- continue;
345
- }
346
- const U = Math.min(g, j.length - 1);
347
- for (let F = U; F >= 0; F -= 1) {
348
- const Z = j[F];
349
- if (!at(e, Z, d)) return Z;
350
- }
351
- (c = a === 'up' ? c - 1 : c + 1),
352
- r && (c < 0 ? (c = b.length - 1) : c >= b.length && (c = 0));
353
- }
354
- }
355
- if (t.key === zt) {
356
- const a = S('up');
357
- if (a !== void 0) x && Me(t), (i = a);
358
- else {
359
- if ((x && Me(t), p === -1)) i = f;
360
- else if (
361
- ((i = xe(e, { startingIndex: i, amount: o, decrement: !0, disabledIndices: d })),
362
- r && (p - o < l || i < 0))
363
- ) {
364
- const h = p % o,
365
- g = f % o,
366
- c = f - (g - h);
367
- g === h ? (i = f) : (i = g > h ? c : c - o);
368
- }
369
- lt(e, i) && (i = p);
370
- }
371
- }
372
- if (t.key === ft) {
373
- const a = S('down');
374
- a !== void 0
375
- ? (x && Me(t), (i = a))
376
- : (x && Me(t),
377
- p === -1
378
- ? (i = l)
379
- : ((i = xe(e, { startingIndex: p, amount: o, disabledIndices: d })),
380
- r &&
381
- p + o > f &&
382
- (i = xe(e, { startingIndex: (p % o) - o, amount: o, disabledIndices: d }))),
383
- lt(e, i) && (i = p));
384
- }
385
- if (n === 'both') {
386
- const a = Gt(p / o);
387
- t.key === (u ? Ke : We) &&
388
- (x && Me(t),
389
- p % o !== o - 1
390
- ? ((i = xe(e, { startingIndex: p, disabledIndices: d })),
391
- r && bt(i, o, a) && (i = xe(e, { startingIndex: p - (p % o) - 1, disabledIndices: d })))
392
- : r && (i = xe(e, { startingIndex: p - (p % o) - 1, disabledIndices: d })),
393
- bt(i, o, a) && (i = p)),
394
- t.key === (u ? We : Ke) &&
395
- (x && Me(t),
396
- p % o !== 0
397
- ? ((i = xe(e, { startingIndex: p, decrement: !0, disabledIndices: d })),
398
- r &&
399
- bt(i, o, a) &&
400
- (i = xe(e, { startingIndex: p + (o - (p % o)), decrement: !0, disabledIndices: d })))
401
- : r &&
402
- (i = xe(e, { startingIndex: p + (o - (p % o)), decrement: !0, disabledIndices: d })),
403
- bt(i, o, a) && (i = p));
404
- const h = Gt(f / o) === a;
405
- lt(e, i) &&
406
- (r && h
407
- ? (i =
408
- t.key === (u ? We : Ke)
409
- ? f
410
- : xe(e, { startingIndex: p - (p % o) - 1, disabledIndices: d }))
411
- : (i = p));
412
- }
413
- return i;
414
- }
415
- function Ar(e, t, n) {
416
- const r = [];
417
- let u = 0;
418
- return (
419
- e.forEach(({ width: o, height: d }, l) => {
420
- let f = !1;
421
- while (!f) {
422
- const p = [];
423
- for (let x = 0; x < o; x += 1) for (let i = 0; i < d; i += 1) p.push(u + x + i * t);
424
- (u % t) + o <= t && p.every((x) => r[x] == null)
425
- ? (p.forEach((x) => {
426
- r[x] = l;
427
- }),
428
- (f = !0))
429
- : (u += 1);
430
- }
431
- }),
432
- [...r]
433
- );
434
- }
435
- function Pr(e, t, n, r, u) {
436
- if (e === -1) return -1;
437
- const o = n.indexOf(e),
438
- d = t[e];
439
- switch (u) {
440
- case 'tl':
441
- return o;
442
- case 'tr':
443
- return d ? o + d.width - 1 : o;
444
- case 'bl':
445
- return d ? o + (d.height - 1) * r : o;
446
- case 'br':
447
- return n.lastIndexOf(e);
448
- default:
449
- return -1;
450
- }
451
- }
452
- function Or(e, t) {
453
- return t.flatMap((n, r) => (e.includes(n) ? [r] : []));
454
- }
455
- function at(e, t, n) {
456
- if (typeof n == 'function') return n(t);
457
- if (n) return n.includes(t);
458
- const r = e.current[t];
459
- return r ? r.hasAttribute('disabled') || r.getAttribute('aria-disabled') === 'true' : !1;
460
- }
461
- const Nr = s.forwardRef((t, n) => {
462
- const {
463
- render: r,
464
- className: u,
465
- id: o,
466
- name: d,
467
- value: l,
468
- disabled: f = !1,
469
- onValueChange: p,
470
- defaultValue: x,
471
- autoFocus: i = !1,
472
- ...b
473
- } = t,
474
- {
475
- state: M,
476
- name: I,
477
- disabled: R,
478
- setTouched: S,
479
- setDirty: a,
480
- validityData: h,
481
- setFocused: g,
482
- setFilled: c,
483
- validationMode: m,
484
- validation: j,
485
- } = _t(),
486
- U = R || f,
487
- F = I ?? d,
488
- Z = { ...M, disabled: U },
489
- { labelId: ae } = yn(),
490
- X = Kt({ id: o });
491
- ee(() => {
492
- var W;
493
- const y = l != null;
494
- ((W = j.inputRef.current) != null && W.value) || (y && l !== '')
495
- ? c(!0)
496
- : y && l === '' && c(!1);
497
- }, [j.inputRef, c, l]);
498
- const z = s.useRef(null);
499
- ee(() => {
500
- i && z.current === Vt(ut(z.current)) && g(!0);
501
- }, [i, g]);
502
- const [q] = Lt({ controlled: l, default: x, name: 'FieldControl', state: 'value' }),
503
- E = l !== void 0,
504
- te = E ? q : void 0;
505
- return (
506
- Rn({
507
- id: X,
508
- name: F,
509
- commit: j.commit,
510
- value: te,
511
- getValue: () => {
512
- var y;
513
- return (y = j.inputRef.current) == null ? void 0 : y.value;
514
- },
515
- controlRef: j.inputRef,
516
- }),
517
- Ve('input', t, {
518
- ref: [n, z],
519
- state: Z,
520
- props: [
521
- {
522
- id: X,
523
- disabled: U,
524
- name: F,
525
- ref: j.inputRef,
526
- 'aria-labelledby': ae,
527
- autoFocus: i,
528
- ...(E ? { value: te } : { defaultValue: x }),
529
- onChange(y) {
530
- const W = y.currentTarget.value;
531
- p == null || p(W, he(wt, y.nativeEvent)), a(W !== h.initialValue), c(W !== '');
532
- },
533
- onFocus() {
534
- g(!0);
535
- },
536
- onBlur(y) {
537
- S(!0), g(!1), m === 'onBlur' && j.commit(y.currentTarget.value);
538
- },
539
- onKeyDown(y) {
540
- y.currentTarget.tagName === 'INPUT' &&
541
- y.key === 'Enter' &&
542
- (S(!0), j.commit(y.currentTarget.value));
543
- },
544
- },
545
- j.getInputValidationProps(),
546
- b,
547
- ],
548
- stateAttributesMapping: vn,
549
- })
550
- );
551
- }),
552
- kr = s.forwardRef((t, n) => H.jsx(Nr, { ref: n, ...t }));
553
- function Oo({ className: e, type: t, ...n }) {
554
- return H.jsx(kr, {
555
- type: t,
556
- 'data-slot': 'input',
557
- className: ke(
558
- 'dark:bg-input/30 border-input focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 disabled:bg-input/50 dark:disabled:bg-input/80 h-8 rounded-lg border bg-transparent px-2.5 py-1 text-base transition-colors file:h-6 file:text-sm file:font-medium focus-visible:ring-3 aria-invalid:ring-3 md:text-sm file:text-foreground placeholder:text-muted-foreground w-full min-w-0 outline-none file:inline-flex file:border-0 file:bg-transparent disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50',
559
- e
560
- ),
561
- ...n,
562
- });
563
- }
564
- function Vr(e, t = {}) {
565
- const n = 'rootStore' in e ? e.rootStore : e,
566
- r = n.context.dataRef,
567
- {
568
- enabled: u = !0,
569
- event: o = 'click',
570
- toggle: d = !0,
571
- ignoreMouse: l = !1,
572
- stickIfOpen: f = !0,
573
- touchOpenDelay: p = 0,
574
- reason: x = zn,
575
- } = t,
576
- i = s.useRef(void 0),
577
- b = cn(),
578
- M = je(),
579
- I = s.useMemo(
580
- () => ({
581
- onPointerDown(R) {
582
- i.current = R.pointerType;
583
- },
584
- onMouseDown(R) {
585
- const S = i.current,
586
- a = R.nativeEvent,
587
- h = n.select('open');
588
- if (R.button !== 0 || o === 'click' || (Xt(S, !0) && l)) return;
589
- const g = r.current.openEvent,
590
- c = g == null ? void 0 : g.type,
591
- m = n.select('domReferenceElement') !== R.currentTarget,
592
- j = (h && m) || !(h && d && (!(g && f) || c === 'click' || c === 'mousedown'));
593
- if (_n(a.target)) {
594
- const F = he(x, a, a.target);
595
- j && S === 'touch' && p > 0
596
- ? M.start(p, () => {
597
- n.setOpen(!0, F);
598
- })
599
- : n.setOpen(j, F);
600
- return;
601
- }
602
- const U = R.currentTarget;
603
- b.request(() => {
604
- const F = he(x, a, U);
605
- j && S === 'touch' && p > 0
606
- ? M.start(p, () => {
607
- n.setOpen(!0, F);
608
- })
609
- : n.setOpen(j, F);
610
- });
611
- },
612
- onClick(R) {
613
- if (o === 'mousedown-only') return;
614
- const S = i.current;
615
- if (o === 'mousedown' && S) {
616
- i.current = void 0;
617
- return;
618
- }
619
- if (Xt(S, !0) && l) return;
620
- const a = n.select('open'),
621
- h = r.current.openEvent,
622
- g = n.select('domReferenceElement') !== R.currentTarget,
623
- c = (a && g) || !(a && d && (!(h && f) || Bn(h))),
624
- m = he(x, R.nativeEvent, R.currentTarget);
625
- c && S === 'touch' && p > 0
626
- ? M.start(p, () => {
627
- n.setOpen(!0, m);
628
- })
629
- : n.setOpen(c, m);
630
- },
631
- onKeyDown() {
632
- i.current = void 0;
633
- },
634
- }),
635
- [r, o, l, n, f, d, b, M, p, x]
636
- );
637
- return s.useMemo(() => (u ? { reference: I } : un), [u, I]);
638
- }
639
- const Lr = 'Escape';
640
- function Tt(e, t, n) {
641
- switch (e) {
642
- case 'vertical':
643
- return t;
644
- case 'horizontal':
645
- return n;
646
- default:
647
- return t || n;
648
- }
649
- }
650
- function xt(e, t) {
651
- return Tt(t, e === zt || e === ft, e === Ke || e === We);
652
- }
653
- function kt(e, t, n) {
654
- return Tt(t, e === ft, n ? e === Ke : e === We) || e === 'Enter' || e === ' ' || e === '';
655
- }
656
- function Dr(e, t, n) {
657
- return Tt(t, n ? e === Ke : e === We, e === ft);
658
- }
659
- function Fr(e, t, n, r) {
660
- const u = n ? e === We : e === Ke,
661
- o = e === zt;
662
- return t === 'both' || (t === 'horizontal' && r && r > 1) ? e === Lr : Tt(t, u, o);
663
- }
664
- function Hr(e, t) {
665
- const n = 'rootStore' in e ? e.rootStore : e,
666
- r = n.useState('open'),
667
- u = n.useState('floatingElement'),
668
- o = n.useState('domReferenceElement'),
669
- d = n.context.dataRef,
670
- {
671
- listRef: l,
672
- activeIndex: f,
673
- onNavigate: p = () => {},
674
- enabled: x = !0,
675
- selectedIndex: i = null,
676
- allowEscape: b = !1,
677
- loopFocus: M = !1,
678
- nested: I = !1,
679
- rtl: R = !1,
680
- virtual: S = !1,
681
- focusItemOnOpen: a = 'auto',
682
- focusItemOnHover: h = !0,
683
- openOnArrowKeyDown: g = !0,
684
- disabledIndices: c = void 0,
685
- orientation: m = 'vertical',
686
- parentOrientation: j,
687
- cols: U = 1,
688
- id: F,
689
- resetOnPointerLeave: Z = !0,
690
- externalTree: ae,
691
- } = t,
692
- X = fn(u),
693
- z = Be(X),
694
- q = Kn(),
695
- E = Wn(ae);
696
- ee(() => {
697
- d.current.orientation = m;
698
- }, [d, m]);
699
- const te = qn(o),
700
- Y = s.useRef(a),
701
- y = s.useRef(i ?? -1),
702
- W = s.useRef(null),
703
- v = s.useRef(!0),
704
- P = ge((T) => {
705
- p(y.current === -1 ? null : y.current, T);
706
- }),
707
- J = s.useRef(P),
708
- C = s.useRef(!!u),
709
- me = s.useRef(r),
710
- A = s.useRef(!1),
711
- ne = s.useRef(!1),
712
- O = Be(c),
713
- $ = Be(r),
714
- se = Be(i),
715
- Ee = Be(Z),
716
- Pe = ge(() => {
717
- function T(_) {
718
- S
719
- ? E == null || E.events.emit('virtualfocus', _)
720
- : Jt(_, { sync: A.current, preventScroll: !0 });
721
- }
722
- const N = l.current[y.current],
723
- w = ne.current;
724
- N && T(N),
725
- (A.current ? (_) => _() : requestAnimationFrame)(() => {
726
- var ue;
727
- const _ = l.current[y.current] || N;
728
- if (!_) return;
729
- N || T(_),
730
- G &&
731
- (w || !v.current) &&
732
- ((ue = _.scrollIntoView) == null ||
733
- ue.call(_, { block: 'nearest', inline: 'nearest' }));
734
- });
735
- });
736
- ee(() => {
737
- x &&
738
- (r && u
739
- ? ((y.current = i ?? -1), Y.current && i != null && ((ne.current = !0), P()))
740
- : C.current && ((y.current = -1), J.current()));
741
- }, [x, r, u, i, P]),
742
- ee(() => {
743
- if (x) {
744
- if (!r) {
745
- A.current = !1;
746
- return;
747
- }
748
- if (u)
749
- if (f == null) {
750
- if (((A.current = !1), se.current != null)) return;
751
- if (
752
- (C.current && ((y.current = -1), Pe()),
753
- (!me.current || !C.current) &&
754
- Y.current &&
755
- (W.current != null || (Y.current === !0 && W.current == null)))
756
- ) {
757
- let T = 0;
758
- const N = () => {
759
- l.current[0] == null
760
- ? (T < 2 && (T ? requestAnimationFrame : queueMicrotask)(N), (T += 1))
761
- : ((y.current = W.current == null || kt(W.current, m, R) || I ? Nt(l) : tn(l)),
762
- (W.current = null),
763
- P());
764
- };
765
- N();
766
- }
767
- } else lt(l, f) || ((y.current = f), Pe(), (ne.current = !1));
768
- }
769
- }, [x, r, u, f, se, I, l, m, R, P, Pe, O]),
770
- ee(() => {
771
- var _, V;
772
- if (!x || u || !E || S || !C.current) return;
773
- const T = E.nodesRef.current,
774
- N =
775
- (V = (_ = T.find((ue) => ue.id === q)) == null ? void 0 : _.context) == null
776
- ? void 0
777
- : V.elements.floating,
778
- w = Vt(ut(u)),
779
- D = T.some((ue) => ue.context && Ge(ue.context.elements.floating, w));
780
- N && !D && v.current && N.focus({ preventScroll: !0 });
781
- }, [x, u, E, q, S]),
782
- ee(() => {
783
- (J.current = P), (me.current = r), (C.current = !!u);
784
- }),
785
- ee(() => {
786
- r || ((W.current = null), (Y.current = a));
787
- }, [r, a]);
788
- const B = f != null,
789
- G = s.useMemo(() => {
790
- function T(w) {
791
- if (!$.current) return;
792
- const D = l.current.indexOf(w.currentTarget);
793
- D !== -1 && y.current !== D && ((y.current = D), P(w));
794
- }
795
- return {
796
- onFocus(w) {
797
- (A.current = !0), T(w);
798
- },
799
- onClick: ({ currentTarget: w }) => w.focus({ preventScroll: !0 }),
800
- onMouseMove(w) {
801
- (A.current = !0), (ne.current = !1), h && T(w);
802
- },
803
- onPointerLeave(w) {
804
- var _;
805
- if (!$.current || !v.current || w.pointerType === 'touch') return;
806
- A.current = !0;
807
- const D = w.relatedTarget;
808
- !h ||
809
- l.current.includes(D) ||
810
- (Ee.current &&
811
- (Jt(null, { sync: !0 }),
812
- (y.current = -1),
813
- P(w),
814
- S || (_ = z.current) == null || _.focus({ preventScroll: !0 })));
815
- },
816
- };
817
- }, [$, z, h, l, P, Ee, S]),
818
- de = s.useCallback(() => {
819
- var T, N, w;
820
- return (
821
- j ??
822
- ((w =
823
- (N =
824
- (T = E == null ? void 0 : E.nodesRef.current.find((D) => D.id === q)) == null
825
- ? void 0
826
- : T.context) == null
827
- ? void 0
828
- : N.dataRef) == null
829
- ? void 0
830
- : w.current.orientation)
831
- );
832
- }, [q, E, j]),
833
- ce = ge((T) => {
834
- if (
835
- ((v.current = !1),
836
- (A.current = !0),
837
- T.which === 229 || (!$.current && T.currentTarget === z.current))
838
- )
839
- return;
840
- if (I && Fr(T.key, m, R, U)) {
841
- xt(T.key, de()) || Me(T),
842
- n.setOpen(!1, he(At, T.nativeEvent)),
843
- Zt(o) && (S ? E == null || E.events.emit('virtualfocus', o) : o.focus());
844
- return;
845
- }
846
- const N = y.current,
847
- w = Nt(l, c),
848
- D = tn(l, c);
849
- if (
850
- (te ||
851
- (T.key === 'Home' && (Me(T), (y.current = w), P(T)),
852
- T.key === 'End' && (Me(T), (y.current = D), P(T))),
853
- U > 1)
854
- ) {
855
- const _ = Array.from({ length: l.current.length }, () => ({ width: 1, height: 1 })),
856
- V = Ar(_, U),
857
- ue = V.findIndex((Re) => Re != null && !at(l, Re, c)),
858
- ye = V.reduce((Re, re, ve) => (re != null && !at(l, re, c) ? ve : Re), -1),
859
- Ce =
860
- V[
861
- Cr(
862
- { current: V.map((Re) => (Re != null ? l.current[Re] : null)) },
863
- {
864
- event: T,
865
- orientation: m,
866
- loopFocus: M,
867
- rtl: R,
868
- cols: U,
869
- disabledIndices: Or(
870
- [
871
- ...((typeof c != 'function' ? c : null) ||
872
- l.current.map((Re, re) => (at(l, re, c) ? re : void 0))),
873
- void 0,
874
- ],
875
- V
876
- ),
877
- minIndex: ue,
878
- maxIndex: ye,
879
- prevIndex: Pr(
880
- y.current > D ? w : y.current,
881
- _,
882
- V,
883
- U,
884
- T.key === ft ? 'bl' : T.key === (R ? Ke : We) ? 'tr' : 'tl'
885
- ),
886
- stopEvent: !0,
887
- }
888
- )
889
- ];
890
- if ((Ce != null && ((y.current = Ce), P(T)), m === 'both')) return;
891
- }
892
- if (xt(T.key, m)) {
893
- if ((Me(T), r && !S && Vt(T.currentTarget.ownerDocument) === T.currentTarget)) {
894
- (y.current = kt(T.key, m, R) ? w : D), P(T);
895
- return;
896
- }
897
- kt(T.key, m, R)
898
- ? M
899
- ? N >= D
900
- ? b && N !== l.current.length
901
- ? (y.current = -1)
902
- : ((A.current = !1), (y.current = w))
903
- : (y.current = xe(l, { startingIndex: N, disabledIndices: c }))
904
- : (y.current = Math.min(D, xe(l, { startingIndex: N, disabledIndices: c })))
905
- : M
906
- ? N <= w
907
- ? b && N !== -1
908
- ? (y.current = l.current.length)
909
- : ((A.current = !1), (y.current = D))
910
- : (y.current = xe(l, { startingIndex: N, decrement: !0, disabledIndices: c }))
911
- : (y.current = Math.max(
912
- w,
913
- xe(l, { startingIndex: N, decrement: !0, disabledIndices: c })
914
- )),
915
- lt(l, y.current) && (y.current = -1),
916
- P(T);
917
- }
918
- }),
919
- fe = s.useMemo(() => S && r && B && { 'aria-activedescendant': `${F}-${f}` }, [S, r, B, F, f]),
920
- be = s.useMemo(
921
- () => ({
922
- 'aria-orientation': m === 'both' ? void 0 : m,
923
- ...(te ? {} : fe),
924
- onKeyDown(T) {
925
- if (T.key === 'Tab' && T.shiftKey && r && !S) {
926
- const N = Yn(T.nativeEvent);
927
- if (N && !Ge(z.current, N)) return;
928
- Me(T), n.setOpen(!1, he(dn, T.nativeEvent)), Zt(o) && o.focus();
929
- return;
930
- }
931
- ce(T);
932
- },
933
- onPointerMove() {
934
- v.current = !0;
935
- },
936
- }),
937
- [fe, ce, z, m, te, n, r, S, o]
938
- ),
939
- ie = s.useMemo(() => {
940
- function T(w) {
941
- a === 'auto' && $n(w.nativeEvent) && (Y.current = !S);
942
- }
943
- function N(w) {
944
- (Y.current = a), a === 'auto' && Gn(w.nativeEvent) && (Y.current = !0);
945
- }
946
- return {
947
- onKeyDown(w) {
948
- const D = n.select('open');
949
- v.current = !1;
950
- const _ = w.key.startsWith('Arrow'),
951
- V = Dr(w.key, de(), R),
952
- ue = xt(w.key, m),
953
- ye = (I ? V : ue) || w.key === 'Enter' || w.key.trim() === '';
954
- if (S && D) return ce(w);
955
- if (!(!D && !g && _)) {
956
- if (ye) {
957
- const Ce = xt(w.key, de());
958
- W.current = I && Ce ? null : w.key;
959
- }
960
- if (I) {
961
- V &&
962
- (Me(w),
963
- D
964
- ? ((y.current = Nt(l, O.current)), P(w))
965
- : n.setOpen(!0, he(At, w.nativeEvent, w.currentTarget)));
966
- return;
967
- }
968
- ue &&
969
- (se.current != null && (y.current = se.current),
970
- Me(w),
971
- !D && g ? n.setOpen(!0, he(At, w.nativeEvent, w.currentTarget)) : ce(w),
972
- D && P(w));
973
- }
974
- },
975
- onFocus(w) {
976
- n.select('open') && !S && ((y.current = -1), P(w));
977
- },
978
- onPointerDown: N,
979
- onPointerEnter: N,
980
- onMouseDown: T,
981
- onClick: T,
982
- };
983
- }, [ce, O, a, l, I, P, n, g, m, de, R, se, S]),
984
- pe = s.useMemo(() => ({ ...fe, ...ie }), [fe, ie]);
985
- return s.useMemo(
986
- () => (x ? { reference: pe, floating: be, item: G, trigger: ie } : {}),
987
- [x, pe, be, ie, G]
988
- );
989
- }
990
- function jr(e, t) {
991
- const n = 'rootStore' in e ? e.rootStore : e,
992
- r = n.context.dataRef,
993
- u = n.useState('open'),
994
- {
995
- listRef: o,
996
- activeIndex: d,
997
- onMatch: l,
998
- onTypingChange: f,
999
- enabled: p = !0,
1000
- resetMs: x = 750,
1001
- selectedIndex: i = null,
1002
- } = t,
1003
- b = je(),
1004
- M = s.useRef(''),
1005
- I = s.useRef(i ?? d ?? -1),
1006
- R = s.useRef(null);
1007
- ee(() => {
1008
- (!u && i !== null) || (b.clear(), (R.current = null), M.current !== '' && (M.current = ''));
1009
- }, [u, i, b]),
1010
- ee(() => {
1011
- u && M.current === '' && (I.current = i ?? d ?? -1);
1012
- }, [u, i, d]);
1013
- const S = ge((m) => {
1014
- m
1015
- ? r.current.typing || ((r.current.typing = m), f == null || f(m))
1016
- : r.current.typing && ((r.current.typing = m), f == null || f(m));
1017
- }),
1018
- a = ge((m) => {
1019
- function j(z, q, E) {
1020
- const te = q.find(
1021
- (Y) => (Y == null ? void 0 : Y.toLocaleLowerCase().indexOf(E.toLocaleLowerCase())) === 0
1022
- );
1023
- return te ? z.indexOf(te) : -1;
1024
- }
1025
- const U = o.current;
1026
- if (
1027
- (M.current.length > 0 &&
1028
- M.current[0] !== ' ' &&
1029
- (j(U, U, M.current) === -1 ? S(!1) : m.key === ' ' && Me(m)),
1030
- U == null || m.key.length !== 1 || m.ctrlKey || m.metaKey || m.altKey)
1031
- )
1032
- return;
1033
- u && m.key !== ' ' && (Me(m), S(!0));
1034
- const F = M.current === '';
1035
- F && (I.current = i ?? d ?? -1),
1036
- U.every((z) => {
1037
- var q, E;
1038
- return z
1039
- ? ((q = z[0]) == null ? void 0 : q.toLocaleLowerCase()) !==
1040
- ((E = z[1]) == null ? void 0 : E.toLocaleLowerCase())
1041
- : !0;
1042
- }) &&
1043
- M.current === m.key &&
1044
- ((M.current = ''), (I.current = R.current)),
1045
- (M.current += m.key),
1046
- b.start(x, () => {
1047
- (M.current = ''), (I.current = R.current), S(!1);
1048
- });
1049
- const ae = F ? (i ?? d ?? -1) : I.current,
1050
- X = j(U, [...U.slice((ae || 0) + 1), ...U.slice(0, (ae || 0) + 1)], M.current);
1051
- X !== -1 ? (l == null || l(X), (R.current = X)) : m.key !== ' ' && ((M.current = ''), S(!1));
1052
- }),
1053
- h = ge((m) => {
1054
- const j = m.relatedTarget,
1055
- U = n.select('domReferenceElement'),
1056
- F = n.select('floatingElement'),
1057
- Z = Ge(U, j),
1058
- ae = Ge(F, j);
1059
- Z || ae || (b.clear(), (M.current = ''), (I.current = R.current), S(!1));
1060
- }),
1061
- g = s.useMemo(() => ({ onKeyDown: a, onBlur: h }), [a, h]),
1062
- c = s.useMemo(
1063
- () => ({
1064
- onKeyDown: a,
1065
- onKeyUp(m) {
1066
- m.key === ' ' && S(!1);
1067
- },
1068
- onBlur: h,
1069
- }),
1070
- [a, h, S]
1071
- );
1072
- return s.useMemo(() => (p ? { reference: g, floating: c } : {}), [p, g, c]);
1073
- }
1074
- function No({ className: e, size: t = 'default', ...n }) {
1075
- return H.jsx('div', {
1076
- 'data-slot': 'card',
1077
- 'data-size': t,
1078
- className: ke(
1079
- 'ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col',
1080
- e
1081
- ),
1082
- ...n,
1083
- });
1084
- }
1085
- function ko({ className: e, ...t }) {
1086
- return H.jsx('div', {
1087
- 'data-slot': 'card-header',
1088
- className: ke(
1089
- 'gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3 group/card-header @container/card-header grid auto-rows-min items-start has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto]',
1090
- e
1091
- ),
1092
- ...t,
1093
- });
1094
- }
1095
- function Vo({ className: e, ...t }) {
1096
- return H.jsx('div', {
1097
- 'data-slot': 'card-title',
1098
- className: ke('text-base leading-snug font-medium group-data-[size=sm]/card:text-sm', e),
1099
- ...t,
1100
- });
1101
- }
1102
- function Lo({ className: e, ...t }) {
1103
- return H.jsx('div', {
1104
- 'data-slot': 'card-description',
1105
- className: ke('text-muted-foreground text-sm', e),
1106
- ...t,
1107
- });
1108
- }
1109
- function Do({ className: e, ...t }) {
1110
- return H.jsx('div', {
1111
- 'data-slot': 'card-content',
1112
- className: ke('px-4 group-data-[size=sm]/card:px-3', e),
1113
- ...t,
1114
- });
1115
- }
1116
- const Sn = s.createContext(null),
1117
- Mn = s.createContext(null);
1118
- function De() {
1119
- const e = s.useContext(Sn);
1120
- if (e === null) throw new Error(St(60));
1121
- return e;
1122
- }
1123
- function Tn() {
1124
- const e = s.useContext(Mn);
1125
- if (e === null) throw new Error(St(61));
1126
- return e;
1127
- }
1128
- const Ur = (e, t) => Object.is(e, t);
1129
- function et(e, t, n) {
1130
- return e == null || t == null ? Object.is(e, t) : n(e, t);
1131
- }
1132
- function zr(e, t, n) {
1133
- return !e || e.length === 0 ? !1 : e.some((r) => (r === void 0 ? !1 : et(t, r, n)));
1134
- }
1135
- function ct(e, t, n) {
1136
- return !e || e.length === 0 ? -1 : e.findIndex((r) => (r === void 0 ? !1 : et(r, t, n)));
1137
- }
1138
- function Br(e, t, n) {
1139
- return e.filter((r) => !et(t, r, n));
1140
- }
1141
- function jt(e) {
1142
- if (e == null) return '';
1143
- if (typeof e == 'string') return e;
1144
- try {
1145
- return JSON.stringify(e);
1146
- } catch {
1147
- return String(e);
1148
- }
1149
- }
1150
- function In(e) {
1151
- return e != null && e.length > 0 && typeof e[0] == 'object' && e[0] != null && 'items' in e[0];
1152
- }
1153
- function _r(e) {
1154
- if (!Array.isArray(e)) return e != null && !('null' in e);
1155
- if (In(e)) {
1156
- for (const t of e)
1157
- for (const n of t.items) if (n && n.value == null && n.label != null) return !0;
1158
- return !1;
1159
- }
1160
- for (const t of e) if (t && t.value == null && t.label != null) return !0;
1161
- return !1;
1162
- }
1163
- function Kr(e, t) {
1164
- if (t && e != null) return t(e) ?? '';
1165
- if (e && typeof e == 'object') {
1166
- if ('label' in e && e.label != null) return String(e.label);
1167
- if ('value' in e) return String(e.value);
1168
- }
1169
- return jt(e);
1170
- }
1171
- function Qe(e, t) {
1172
- return t && e != null
1173
- ? (t(e) ?? '')
1174
- : e && typeof e == 'object' && 'value' in e && 'label' in e
1175
- ? jt(e.value)
1176
- : jt(e);
1177
- }
1178
- function En(e, t, n) {
1179
- function r() {
1180
- return Kr(e, n);
1181
- }
1182
- if (n && e != null) return n(e);
1183
- if (e && typeof e == 'object' && 'label' in e && e.label != null) return e.label;
1184
- if (t && !Array.isArray(t)) return t[e] ?? r();
1185
- if (Array.isArray(t)) {
1186
- const u = In(t) ? t.flatMap((o) => o.items) : t;
1187
- if (e == null || typeof e != 'object') {
1188
- const o = u.find((d) => d.value === e);
1189
- return o && o.label != null ? o.label : r();
1190
- }
1191
- if ('value' in e) {
1192
- const o = u.find((d) => d && d.value === e.value);
1193
- if (o && o.label != null) return o.label;
1194
- }
1195
- }
1196
- return r();
1197
- }
1198
- function Wr(e, t, n) {
1199
- return e.reduce(
1200
- (r, u, o) => (
1201
- o > 0 && r.push(', '), r.push(H.jsx(s.Fragment, { children: En(u, t, n) }, o)), r
1202
- ),
1203
- []
1204
- );
1205
- }
1206
- const k = {
1207
- id: Q((e) => e.id),
1208
- modal: Q((e) => e.modal),
1209
- multiple: Q((e) => e.multiple),
1210
- items: Q((e) => e.items),
1211
- itemToStringLabel: Q((e) => e.itemToStringLabel),
1212
- itemToStringValue: Q((e) => e.itemToStringValue),
1213
- isItemEqualToValue: Q((e) => e.isItemEqualToValue),
1214
- value: Q((e) => e.value),
1215
- hasSelectedValue: Q((e) => {
1216
- const { value: t, multiple: n, itemToStringValue: r } = e;
1217
- return t == null ? !1 : n && Array.isArray(t) ? t.length > 0 : Qe(t, r) !== '';
1218
- }),
1219
- hasNullItemLabel: Q((e, t) => (t ? _r(e.items) : !1)),
1220
- open: Q((e) => e.open),
1221
- mounted: Q((e) => e.mounted),
1222
- forceMount: Q((e) => e.forceMount),
1223
- transitionStatus: Q((e) => e.transitionStatus),
1224
- openMethod: Q((e) => e.openMethod),
1225
- activeIndex: Q((e) => e.activeIndex),
1226
- selectedIndex: Q((e) => e.selectedIndex),
1227
- isActive: Q((e, t) => e.activeIndex === t),
1228
- isSelected: Q((e, t, n) => {
1229
- const r = e.isItemEqualToValue,
1230
- u = e.value;
1231
- return e.multiple
1232
- ? Array.isArray(u) && u.some((o) => et(n, o, r))
1233
- : e.selectedIndex === t && e.selectedIndex !== null
1234
- ? !0
1235
- : et(n, u, r);
1236
- }),
1237
- isSelectedByFocus: Q((e, t) => e.selectedIndex === t),
1238
- popupProps: Q((e) => e.popupProps),
1239
- triggerProps: Q((e) => e.triggerProps),
1240
- triggerElement: Q((e) => e.triggerElement),
1241
- positionerElement: Q((e) => e.positionerElement),
1242
- listElement: Q((e) => e.listElement),
1243
- scrollUpArrowVisible: Q((e) => e.scrollUpArrowVisible),
1244
- scrollDownArrowVisible: Q((e) => e.scrollDownArrowVisible),
1245
- hasScrollArrows: Q((e) => e.hasScrollArrows),
1246
- };
1247
- function qr(e) {
1248
- const {
1249
- id: t,
1250
- value: n,
1251
- defaultValue: r = null,
1252
- onValueChange: u,
1253
- open: o,
1254
- defaultOpen: d = !1,
1255
- onOpenChange: l,
1256
- name: f,
1257
- autoComplete: p,
1258
- disabled: x = !1,
1259
- readOnly: i = !1,
1260
- required: b = !1,
1261
- modal: M = !0,
1262
- actionsRef: I,
1263
- inputRef: R,
1264
- onOpenChangeComplete: S,
1265
- items: a,
1266
- multiple: h = !1,
1267
- itemToStringLabel: g,
1268
- itemToStringValue: c,
1269
- isItemEqualToValue: m = Ur,
1270
- highlightItemOnHover: j = !0,
1271
- children: U,
1272
- } = e,
1273
- { clearErrors: F } = Rr(),
1274
- {
1275
- setDirty: Z,
1276
- setTouched: ae,
1277
- setFocused: X,
1278
- shouldValidateOnChange: z,
1279
- validityData: q,
1280
- setFilled: E,
1281
- name: te,
1282
- disabled: Y,
1283
- validation: y,
1284
- validationMode: W,
1285
- } = _t(),
1286
- v = Kt({ id: t }),
1287
- P = Y || x,
1288
- J = te ?? f,
1289
- [C, me] = Lt({ controlled: n, default: h ? (r ?? Qt) : r, name: 'Select', state: 'value' }),
1290
- [A, ne] = Lt({ controlled: o, default: d, name: 'Select', state: 'open' }),
1291
- O = s.useRef([]),
1292
- $ = s.useRef([]),
1293
- se = s.useRef(null),
1294
- Ee = s.useRef(null),
1295
- Pe = s.useRef(0),
1296
- B = s.useRef(null),
1297
- G = s.useRef([]),
1298
- de = s.useRef(!1),
1299
- ce = s.useRef(!1),
1300
- fe = s.useRef(null),
1301
- be = s.useRef({ allowSelectedMouseUp: !1, allowUnselectedMouseUp: !1 }),
1302
- ie = s.useRef(!1),
1303
- { mounted: pe, setMounted: T, transitionStatus: N } = Bt(A),
1304
- { openMethod: w, triggerProps: D, reset: _ } = Xn(A),
1305
- V = Dt(
1306
- () =>
1307
- new rr({
1308
- id: v,
1309
- modal: M,
1310
- multiple: h,
1311
- itemToStringLabel: g,
1312
- itemToStringValue: c,
1313
- isItemEqualToValue: m,
1314
- value: C,
1315
- open: A,
1316
- mounted: pe,
1317
- transitionStatus: N,
1318
- items: a,
1319
- forceMount: !1,
1320
- openMethod: null,
1321
- activeIndex: null,
1322
- selectedIndex: null,
1323
- popupProps: {},
1324
- triggerProps: {},
1325
- triggerElement: null,
1326
- positionerElement: null,
1327
- listElement: null,
1328
- scrollUpArrowVisible: !1,
1329
- scrollDownArrowVisible: !1,
1330
- hasScrollArrows: !1,
1331
- })
1332
- ).current,
1333
- ue = L(V, k.activeIndex),
1334
- ye = L(V, k.selectedIndex),
1335
- Ce = L(V, k.triggerElement),
1336
- Re = L(V, k.positionerElement),
1337
- re = s.useMemo(() => (h && Array.isArray(C) && C.length === 0 ? '' : Qe(C, c)), [h, C, c]),
1338
- ve = s.useMemo(() => (h && Array.isArray(C) ? C.map((K) => Qe(K, c)) : Qe(C, c)), [h, C, c]),
1339
- Te = Be(V.state.triggerElement);
1340
- Rn({ id: v, commit: y.commit, value: C, controlRef: Te, name: J, getValue: () => ve });
1341
- const Oe = s.useRef(C);
1342
- ee(() => {
1343
- C !== Oe.current && V.set('forceMount', !0);
1344
- }, [V, C]),
1345
- ee(() => {
1346
- E(h ? Array.isArray(C) && C.length > 0 : C != null);
1347
- }, [h, C, E]),
1348
- ee(() => {
1349
- if (A) return;
1350
- const oe = G.current;
1351
- if (h) {
1352
- const Ne = Array.isArray(C) ? C : [];
1353
- if (Ne.length === 0) {
1354
- V.set('selectedIndex', null);
1355
- return;
1356
- }
1357
- const Ae = Ne[Ne.length - 1],
1358
- ze = ct(oe, Ae, m);
1359
- V.set('selectedIndex', ze === -1 ? null : ze);
1360
- return;
1361
- }
1362
- const Se = ct(oe, C, m);
1363
- V.set('selectedIndex', Se === -1 ? null : Se);
1364
- }, [h, A, C, G, m, V]),
1365
- vr(C, () => {
1366
- F(J), Z(C !== q.initialValue), z() ? y.commit(C) : y.commit(C, !0);
1367
- });
1368
- const tt = ge((K, oe) => {
1369
- if (
1370
- (l == null || l(K, oe),
1371
- !oe.isCanceled &&
1372
- (ne(K),
1373
- !K &&
1374
- (oe.reason === dn || oe.reason === or) &&
1375
- (ae(!0), X(!1), W === 'onBlur' && y.commit(C)),
1376
- !K && V.state.activeIndex !== null))
1377
- ) {
1378
- const Se = O.current[V.state.activeIndex];
1379
- queueMicrotask(() => {
1380
- Se == null || Se.setAttribute('tabindex', '-1');
1381
- });
1382
- }
1383
- }),
1384
- nt = ge(() => {
1385
- T(!1), V.set('activeIndex', null), _(), S == null || S(!1);
1386
- });
1387
- Mt({
1388
- enabled: !I,
1389
- open: A,
1390
- ref: se,
1391
- onComplete() {
1392
- A || nt();
1393
- },
1394
- }),
1395
- s.useImperativeHandle(I, () => ({ unmount: nt }), [nt]);
1396
- const qe = ge((K, oe) => {
1397
- u == null || u(K, oe), !oe.isCanceled && me(K);
1398
- }),
1399
- rt = ge(() => {
1400
- const K = V.state.listElement || se.current;
1401
- if (!K) return;
1402
- const oe = K.scrollTop,
1403
- Se = K.scrollTop + K.clientHeight,
1404
- Ne = oe > 1,
1405
- Ae = Se < K.scrollHeight - 1;
1406
- V.state.scrollUpArrowVisible !== Ne && V.set('scrollUpArrowVisible', Ne),
1407
- V.state.scrollDownArrowVisible !== Ae && V.set('scrollDownArrowVisible', Ae);
1408
- }),
1409
- we = Jn({ open: A, onOpenChange: tt, elements: { reference: Ce, floating: Re } }),
1410
- dt = Vr(we, { enabled: !i && !P, event: 'mousedown' }),
1411
- pt = Zn(we, { bubbles: !1 }),
1412
- ot = Hr(we, {
1413
- enabled: !i && !P,
1414
- listRef: O,
1415
- activeIndex: ue,
1416
- selectedIndex: ye,
1417
- disabledIndices: Qt,
1418
- onNavigate(K) {
1419
- (K === null && !A) || V.set('activeIndex', K);
1420
- },
1421
- focusItemOnHover: !1,
1422
- }),
1423
- Le = jr(we, {
1424
- enabled: !i && !P && (A || !h),
1425
- listRef: $,
1426
- activeIndex: ue,
1427
- selectedIndex: ye,
1428
- onMatch(K) {
1429
- A ? V.set('activeIndex', K) : qe(G.current[K], he('none'));
1430
- },
1431
- onTypingChange(K) {
1432
- de.current = K;
1433
- },
1434
- }),
1435
- { getReferenceProps: gt, getFloatingProps: Ye, getItemProps: st } = Qn([dt, pt, ot, Le]),
1436
- it = s.useMemo(() => pn(gt(), D, v ? { id: v } : un), [gt, D, v]);
1437
- er(() => {
1438
- V.update({ popupProps: Ye(), triggerProps: it });
1439
- }),
1440
- ee(() => {
1441
- V.update({
1442
- id: v,
1443
- modal: M,
1444
- multiple: h,
1445
- value: C,
1446
- open: A,
1447
- mounted: pe,
1448
- transitionStatus: N,
1449
- popupProps: Ye(),
1450
- triggerProps: it,
1451
- items: a,
1452
- itemToStringLabel: g,
1453
- itemToStringValue: c,
1454
- isItemEqualToValue: m,
1455
- openMethod: w,
1456
- });
1457
- }, [V, v, M, h, C, A, pe, N, Ye, it, a, g, c, m, w]);
1458
- const It = s.useMemo(
1459
- () => ({
1460
- store: V,
1461
- name: J,
1462
- required: b,
1463
- disabled: P,
1464
- readOnly: i,
1465
- multiple: h,
1466
- itemToStringLabel: g,
1467
- itemToStringValue: c,
1468
- highlightItemOnHover: j,
1469
- setValue: qe,
1470
- setOpen: tt,
1471
- listRef: O,
1472
- popupRef: se,
1473
- scrollHandlerRef: Ee,
1474
- handleScrollArrowVisibility: rt,
1475
- scrollArrowsMountedCountRef: Pe,
1476
- getItemProps: st,
1477
- events: we.context.events,
1478
- valueRef: B,
1479
- valuesRef: G,
1480
- labelsRef: $,
1481
- typingRef: de,
1482
- selectionRef: be,
1483
- selectedItemTextRef: fe,
1484
- validation: y,
1485
- onOpenChangeComplete: S,
1486
- keyboardActiveRef: ce,
1487
- alignItemWithTriggerActiveRef: ie,
1488
- initialValueRef: Oe,
1489
- }),
1490
- [V, J, b, P, i, h, g, c, j, qe, tt, st, we.context.events, y, S, rt]
1491
- ),
1492
- mt = gn(R, y.inputRef),
1493
- ht = h && Array.isArray(C) && C.length > 0,
1494
- Et = s.useMemo(
1495
- () =>
1496
- !h || !Array.isArray(C) || !J
1497
- ? null
1498
- : C.map((K) => {
1499
- const oe = Qe(K, c);
1500
- return H.jsx('input', { type: 'hidden', name: J, value: oe }, oe);
1501
- }),
1502
- [h, C, J, c]
1503
- );
1504
- return H.jsx(Sn.Provider, {
1505
- value: It,
1506
- children: H.jsxs(Mn.Provider, {
1507
- value: we,
1508
- children: [
1509
- U,
1510
- H.jsx('input', {
1511
- ...y.getInputValidationProps({
1512
- onFocus() {
1513
- var K;
1514
- (K = V.state.triggerElement) == null || K.focus({ focusVisible: !0 });
1515
- },
1516
- onChange(K) {
1517
- if (K.nativeEvent.defaultPrevented) return;
1518
- const oe = K.target.value,
1519
- Se = he(wt, K.nativeEvent);
1520
- function Ne() {
1521
- if (h) return;
1522
- const Ae = G.current.find((ze) => Qe(ze, c).toLowerCase() === oe.toLowerCase());
1523
- Ae != null && (Z(Ae !== q.initialValue), qe(Ae, Se), z() && y.commit(Ae));
1524
- }
1525
- V.set('forceMount', !0), queueMicrotask(Ne);
1526
- },
1527
- }),
1528
- name: h ? void 0 : J,
1529
- autoComplete: p,
1530
- value: re,
1531
- disabled: P,
1532
- required: b && !ht,
1533
- readOnly: i,
1534
- ref: mt,
1535
- style: J ? tr : nr,
1536
- tabIndex: -1,
1537
- 'aria-hidden': !0,
1538
- }),
1539
- Et,
1540
- ],
1541
- }),
1542
- });
1543
- }
1544
- function Yr(e) {
1545
- const t = e.getBoundingClientRect(),
1546
- n = window.getComputedStyle(e, '::before'),
1547
- r = window.getComputedStyle(e, '::after');
1548
- if (!(n.content !== 'none' || r.content !== 'none')) return t;
1549
- const o = Number.parseFloat(n.width) || 0,
1550
- d = Number.parseFloat(n.height) || 0,
1551
- l = Number.parseFloat(r.width) || 0,
1552
- f = Number.parseFloat(r.height) || 0,
1553
- p = Math.max(t.width, o, l),
1554
- x = Math.max(t.height, d, f),
1555
- i = p - t.width,
1556
- b = x - t.height;
1557
- return {
1558
- left: t.left - i / 2,
1559
- right: t.right + i / 2,
1560
- top: t.top - b / 2,
1561
- bottom: t.bottom + b / 2,
1562
- };
1563
- }
1564
- const yt = 2,
1565
- $r = 400,
1566
- nn = 200,
1567
- Gr = { ...sr, ...vn, value: () => null },
1568
- Xr = s.forwardRef((t, n) => {
1569
- const { render: r, className: u, id: o, disabled: d = !1, nativeButton: l = !0, ...f } = t,
1570
- { setTouched: p, setFocused: x, validationMode: i, state: b, disabled: M } = _t(),
1571
- { labelId: I } = yn(),
1572
- {
1573
- store: R,
1574
- setOpen: S,
1575
- selectionRef: a,
1576
- validation: h,
1577
- readOnly: g,
1578
- required: c,
1579
- alignItemWithTriggerActiveRef: m,
1580
- disabled: j,
1581
- keyboardActiveRef: U,
1582
- } = De(),
1583
- F = M || j || d,
1584
- Z = L(R, k.open),
1585
- ae = L(R, k.value),
1586
- X = L(R, k.triggerProps),
1587
- z = L(R, k.positionerElement),
1588
- q = L(R, k.listElement),
1589
- E = L(R, k.id),
1590
- te = L(R, k.hasSelectedValue),
1591
- Y = !te && Z,
1592
- y = L(R, k.hasNullItemLabel, Y),
1593
- W = o ?? E;
1594
- Kt({ id: W });
1595
- const v = Be(z),
1596
- P = s.useRef(null),
1597
- { getButtonProps: J, buttonRef: C } = mn({ disabled: F, native: l }),
1598
- me = ge((G) => {
1599
- R.set('triggerElement', G);
1600
- }),
1601
- A = gn(n, P, C, me),
1602
- ne = je(),
1603
- O = je(),
1604
- $ = je(),
1605
- se = je();
1606
- s.useEffect(() => {
1607
- if (Z)
1608
- return (
1609
- !(te || y)
1610
- ? $.start($r, () => {
1611
- (a.current.allowUnselectedMouseUp = !0), (a.current.allowSelectedMouseUp = !0);
1612
- })
1613
- : se.start(nn, () => {
1614
- (a.current.allowUnselectedMouseUp = !0),
1615
- $.start(nn, () => {
1616
- a.current.allowSelectedMouseUp = !0;
1617
- });
1618
- }),
1619
- () => {
1620
- $.clear(), se.clear();
1621
- }
1622
- );
1623
- (a.current = { allowSelectedMouseUp: !1, allowUnselectedMouseUp: !1 }), O.clear();
1624
- }, [Z, te, y, a, O, $, se]);
1625
- const Ee = s.useMemo(() => {
1626
- var G;
1627
- return (q == null ? void 0 : q.id) ?? ((G = fn(z)) == null ? void 0 : G.id);
1628
- }, [q, z]),
1629
- Pe = pn(
1630
- X,
1631
- {
1632
- id: W,
1633
- role: 'combobox',
1634
- 'aria-expanded': Z ? 'true' : 'false',
1635
- 'aria-haspopup': 'listbox',
1636
- 'aria-controls': Z ? Ee : void 0,
1637
- 'aria-labelledby': I,
1638
- 'aria-readonly': g || void 0,
1639
- 'aria-required': c || void 0,
1640
- tabIndex: F ? -1 : 0,
1641
- ref: A,
1642
- onFocus(G) {
1643
- x(!0),
1644
- Z && m.current && S(!1, he(wt, G.nativeEvent)),
1645
- ne.start(0, () => {
1646
- R.set('forceMount', !0);
1647
- });
1648
- },
1649
- onBlur(G) {
1650
- Ge(z, G.relatedTarget) || (p(!0), x(!1), i === 'onBlur' && h.commit(ae));
1651
- },
1652
- onPointerMove() {
1653
- U.current = !1;
1654
- },
1655
- onKeyDown() {
1656
- U.current = !0;
1657
- },
1658
- onMouseDown(G) {
1659
- if (Z) return;
1660
- const de = ut(G.currentTarget);
1661
- function ce(fe) {
1662
- if (!P.current) return;
1663
- const be = fe.target;
1664
- if (Ge(P.current, be) || Ge(v.current, be) || be === P.current) return;
1665
- const ie = Yr(P.current);
1666
- (fe.clientX >= ie.left - yt &&
1667
- fe.clientX <= ie.right + yt &&
1668
- fe.clientY >= ie.top - yt &&
1669
- fe.clientY <= ie.bottom + yt) ||
1670
- S(!1, he(ir, fe));
1671
- }
1672
- O.start(0, () => {
1673
- de.addEventListener('mouseup', ce, { once: !0 });
1674
- });
1675
- },
1676
- },
1677
- h.getValidationProps,
1678
- f,
1679
- J
1680
- );
1681
- Pe.role = 'combobox';
1682
- const B = { ...b, open: Z, disabled: F, value: ae, readOnly: g, placeholder: !te };
1683
- return Ve('button', t, { ref: [n, P], state: B, stateAttributesMapping: Gr, props: Pe });
1684
- }),
1685
- Jr = { value: () => null },
1686
- Zr = s.forwardRef((t, n) => {
1687
- const { className: r, render: u, children: o, placeholder: d, ...l } = t,
1688
- { store: f, valueRef: p } = De(),
1689
- x = L(f, k.value),
1690
- i = L(f, k.items),
1691
- b = L(f, k.itemToStringLabel),
1692
- M = L(f, k.hasSelectedValue),
1693
- I = !M && d != null && o == null,
1694
- R = L(f, k.hasNullItemLabel, I),
1695
- S = { value: x, placeholder: !M };
1696
- let a = null;
1697
- return (
1698
- typeof o == 'function'
1699
- ? (a = o(x))
1700
- : o != null
1701
- ? (a = o)
1702
- : !M && d != null && !R
1703
- ? (a = d)
1704
- : Array.isArray(x)
1705
- ? (a = Wr(x, i, b))
1706
- : (a = En(x, i, b)),
1707
- Ve('span', t, {
1708
- state: S,
1709
- ref: [n, p],
1710
- props: [{ children: a }, l],
1711
- stateAttributesMapping: Jr,
1712
- })
1713
- );
1714
- }),
1715
- Qr = s.forwardRef((t, n) => {
1716
- const { className: r, render: u, ...o } = t,
1717
- { store: d } = De(),
1718
- f = { open: L(d, k.open) };
1719
- return Ve('span', t, {
1720
- state: f,
1721
- ref: n,
1722
- props: [{ 'aria-hidden': !0, children: '▼' }, o],
1723
- stateAttributesMapping: lr,
1724
- });
1725
- }),
1726
- eo = s.createContext(void 0),
1727
- to = s.forwardRef((t, n) => {
1728
- const { store: r } = De(),
1729
- u = L(r, k.mounted),
1730
- o = L(r, k.forceMount);
1731
- return u || o ? H.jsx(eo.Provider, { value: !0, children: H.jsx(ar, { ref: n, ...t }) }) : null;
1732
- }),
1733
- Cn = s.createContext({
1734
- register: () => {},
1735
- unregister: () => {},
1736
- subscribeMapChange: () => () => {},
1737
- elementsRef: { current: [] },
1738
- nextIndexRef: { current: 0 },
1739
- });
1740
- function no() {
1741
- return s.useContext(Cn);
1742
- }
1743
- function ro(e) {
1744
- const { children: t, elementsRef: n, labelsRef: r, onMapChange: u } = e,
1745
- o = ge(u),
1746
- d = s.useRef(0),
1747
- l = Dt(so).current,
1748
- f = Dt(oo).current,
1749
- [p, x] = s.useState(0),
1750
- i = s.useRef(p),
1751
- b = ge((a, h) => {
1752
- f.set(a, h ?? null), (i.current += 1), x(i.current);
1753
- }),
1754
- M = ge((a) => {
1755
- f.delete(a), (i.current += 1), x(i.current);
1756
- }),
1757
- I = s.useMemo(() => {
1758
- const a = new Map();
1759
- return (
1760
- Array.from(f.keys())
1761
- .filter((g) => g.isConnected)
1762
- .sort(io)
1763
- .forEach((g, c) => {
1764
- const m = f.get(g) ?? {};
1765
- a.set(g, { ...m, index: c });
1766
- }),
1767
- a
1768
- );
1769
- }, [f, p]);
1770
- ee(() => {
1771
- if (typeof MutationObserver != 'function' || I.size === 0) return;
1772
- const a = new MutationObserver((h) => {
1773
- const g = new Set(),
1774
- c = (m) => (g.has(m) ? g.delete(m) : g.add(m));
1775
- h.forEach((m) => {
1776
- m.removedNodes.forEach(c), m.addedNodes.forEach(c);
1777
- }),
1778
- g.size === 0 && ((i.current += 1), x(i.current));
1779
- });
1780
- return (
1781
- I.forEach((h, g) => {
1782
- g.parentElement && a.observe(g.parentElement, { childList: !0 });
1783
- }),
1784
- () => {
1785
- a.disconnect();
1786
- }
1787
- );
1788
- }, [I]),
1789
- ee(() => {
1790
- i.current === p &&
1791
- (n.current.length !== I.size && (n.current.length = I.size),
1792
- r && r.current.length !== I.size && (r.current.length = I.size),
1793
- (d.current = I.size)),
1794
- o(I);
1795
- }, [o, I, n, r, p]),
1796
- ee(
1797
- () => () => {
1798
- n.current = [];
1799
- },
1800
- [n]
1801
- ),
1802
- ee(
1803
- () => () => {
1804
- r && (r.current = []);
1805
- },
1806
- [r]
1807
- );
1808
- const R = ge(
1809
- (a) => (
1810
- l.add(a),
1811
- () => {
1812
- l.delete(a);
1813
- }
1814
- )
1815
- );
1816
- ee(() => {
1817
- l.forEach((a) => a(I));
1818
- }, [l, I]);
1819
- const S = s.useMemo(
1820
- () => ({
1821
- register: b,
1822
- unregister: M,
1823
- subscribeMapChange: R,
1824
- elementsRef: n,
1825
- labelsRef: r,
1826
- nextIndexRef: d,
1827
- }),
1828
- [b, M, R, n, r, d]
1829
- );
1830
- return H.jsx(Cn.Provider, { value: S, children: t });
1831
- }
1832
- function oo() {
1833
- return new Map();
1834
- }
1835
- function so() {
1836
- return new Set();
1837
- }
1838
- function io(e, t) {
1839
- const n = e.compareDocumentPosition(t);
1840
- return n & Node.DOCUMENT_POSITION_FOLLOWING || n & Node.DOCUMENT_POSITION_CONTAINED_BY
1841
- ? -1
1842
- : n & Node.DOCUMENT_POSITION_PRECEDING || n & Node.DOCUMENT_POSITION_CONTAINS
1843
- ? 1
1844
- : 0;
1845
- }
1846
- const An = s.createContext(void 0);
1847
- function Wt() {
1848
- const e = s.useContext(An);
1849
- if (!e) throw new Error(St(59));
1850
- return e;
1851
- }
1852
- function vt(e, t) {
1853
- e && Object.assign(e.style, t);
1854
- }
1855
- const Pn = { position: 'relative', maxHeight: '100%', overflowX: 'hidden', overflowY: 'auto' },
1856
- lo = { position: 'fixed' },
1857
- ao = s.forwardRef((t, n) => {
1858
- const {
1859
- anchor: r,
1860
- positionMethod: u = 'absolute',
1861
- className: o,
1862
- render: d,
1863
- side: l = 'bottom',
1864
- align: f = 'center',
1865
- sideOffset: p = 0,
1866
- alignOffset: x = 0,
1867
- collisionBoundary: i = 'clipping-ancestors',
1868
- collisionPadding: b,
1869
- arrowPadding: M = 5,
1870
- sticky: I = !1,
1871
- disableAnchorTracking: R,
1872
- alignItemWithTrigger: S = !0,
1873
- collisionAvoidance: a = cr,
1874
- ...h
1875
- } = t,
1876
- {
1877
- store: g,
1878
- listRef: c,
1879
- labelsRef: m,
1880
- alignItemWithTriggerActiveRef: j,
1881
- selectedItemTextRef: U,
1882
- valuesRef: F,
1883
- initialValueRef: Z,
1884
- popupRef: ae,
1885
- setValue: X,
1886
- } = De(),
1887
- z = Tn(),
1888
- q = L(g, k.open),
1889
- E = L(g, k.mounted),
1890
- te = L(g, k.modal),
1891
- Y = L(g, k.value),
1892
- y = L(g, k.openMethod),
1893
- W = L(g, k.positionerElement),
1894
- v = L(g, k.triggerElement),
1895
- P = L(g, k.isItemEqualToValue),
1896
- J = L(g, k.transitionStatus),
1897
- C = s.useRef(null),
1898
- me = s.useRef(null),
1899
- [A, ne] = s.useState(S),
1900
- O = E && A && y !== 'touch';
1901
- !E && A !== S && ne(S),
1902
- ee(() => {
1903
- E ||
1904
- (k.scrollUpArrowVisible(g.state) && g.set('scrollUpArrowVisible', !1),
1905
- k.scrollDownArrowVisible(g.state) && g.set('scrollDownArrowVisible', !1));
1906
- }, [g, E]),
1907
- s.useImperativeHandle(j, () => O),
1908
- ur((O || te) && q && y !== 'touch', v);
1909
- const $ = fr({
1910
- anchor: r,
1911
- floatingRootContext: z,
1912
- positionMethod: u,
1913
- mounted: E,
1914
- side: l,
1915
- sideOffset: p,
1916
- align: f,
1917
- alignOffset: x,
1918
- arrowPadding: M,
1919
- collisionBoundary: i,
1920
- collisionPadding: b,
1921
- sticky: I,
1922
- disableAnchorTracking: R ?? O,
1923
- collisionAvoidance: a,
1924
- keepMounted: !0,
1925
- }),
1926
- se = O ? 'none' : $.side,
1927
- Ee = O ? lo : $.positionerStyles,
1928
- Pe = s.useMemo(() => {
1929
- const ie = {};
1930
- return (
1931
- q || (ie.pointerEvents = 'none'),
1932
- { role: 'presentation', hidden: !E, style: { ...Ee, ...ie } }
1933
- );
1934
- }, [q, E, Ee]),
1935
- B = { open: q, side: se, align: $.align, anchorHidden: $.anchorHidden },
1936
- G = ge((ie) => {
1937
- g.set('positionerElement', ie);
1938
- }),
1939
- de = Ve('div', t, {
1940
- ref: [n, G],
1941
- state: B,
1942
- stateAttributesMapping: hn,
1943
- props: [Pe, bn(J), h],
1944
- }),
1945
- ce = s.useRef(0),
1946
- fe = ge((ie) => {
1947
- if ((ie.size === 0 && ce.current === 0) || F.current.length === 0) return;
1948
- const pe = ce.current;
1949
- if (((ce.current = ie.size), ie.size === pe)) return;
1950
- const T = he(wt);
1951
- if (pe !== 0 && !g.state.multiple && Y !== null && ct(F.current, Y, P) === -1) {
1952
- const w = Z.current,
1953
- _ = w != null && ct(F.current, w, P) !== -1 ? w : null;
1954
- X(_, T), _ === null && (g.set('selectedIndex', null), (U.current = null));
1955
- }
1956
- if (pe !== 0 && g.state.multiple && Array.isArray(Y)) {
1957
- const N = (D) => ct(F.current, D, P) !== -1,
1958
- w = Y.filter((D) => N(D));
1959
- (w.length !== Y.length || w.some((D) => !zr(Y, D, P))) &&
1960
- (X(w, T), w.length === 0 && (g.set('selectedIndex', null), (U.current = null)));
1961
- }
1962
- if (q && O) {
1963
- g.update({ scrollUpArrowVisible: !1, scrollDownArrowVisible: !1 });
1964
- const N = { height: '' };
1965
- vt(W, N), vt(ae.current, N);
1966
- }
1967
- }),
1968
- be = s.useMemo(
1969
- () => ({
1970
- ...$,
1971
- side: se,
1972
- alignItemWithTriggerActive: O,
1973
- setControlledAlignItemWithTrigger: ne,
1974
- scrollUpArrowRef: C,
1975
- scrollDownArrowRef: me,
1976
- }),
1977
- [$, se, O, ne]
1978
- );
1979
- return H.jsx(ro, {
1980
- elementsRef: c,
1981
- labelsRef: m,
1982
- onMapChange: fe,
1983
- children: H.jsxs(An.Provider, {
1984
- value: be,
1985
- children: [E && te && H.jsx(dr, { inert: pr(!q), cutout: v }), de],
1986
- }),
1987
- });
1988
- });
1989
- function On(e) {
1990
- const t = e.currentTarget.getBoundingClientRect();
1991
- return (
1992
- t.top + 1 <= e.clientY &&
1993
- e.clientY <= t.bottom - 1 &&
1994
- t.left + 1 <= e.clientX &&
1995
- e.clientX <= t.right - 1
1996
- );
1997
- }
1998
- const co = s.createContext(void 0);
1999
- function uo(e) {
2000
- return s.useContext(co);
2001
- }
2002
- const $e = 1,
2003
- fo = { ...hn, ...xn },
2004
- po = s.forwardRef((t, n) => {
2005
- const { render: r, className: u, finalFocus: o, ...d } = t,
2006
- {
2007
- store: l,
2008
- popupRef: f,
2009
- onOpenChangeComplete: p,
2010
- setOpen: x,
2011
- valueRef: i,
2012
- selectedItemTextRef: b,
2013
- keyboardActiveRef: M,
2014
- multiple: I,
2015
- handleScrollArrowVisibility: R,
2016
- scrollHandlerRef: S,
2017
- highlightItemOnHover: a,
2018
- } = De(),
2019
- {
2020
- side: h,
2021
- align: g,
2022
- alignItemWithTriggerActive: c,
2023
- setControlledAlignItemWithTrigger: m,
2024
- scrollDownArrowRef: j,
2025
- scrollUpArrowRef: U,
2026
- } = Wt(),
2027
- F = uo() != null,
2028
- Z = Tn(),
2029
- { nonce: ae, disableStyleElements: X } = gr(),
2030
- z = je(),
2031
- q = L(l, k.id),
2032
- E = L(l, k.open),
2033
- te = L(l, k.mounted),
2034
- Y = L(l, k.popupProps),
2035
- y = L(l, k.transitionStatus),
2036
- W = L(l, k.triggerElement),
2037
- v = L(l, k.positionerElement),
2038
- P = L(l, k.listElement),
2039
- J = s.useRef(0),
2040
- C = s.useRef(!1),
2041
- me = s.useRef(0),
2042
- A = s.useRef(!1),
2043
- ne = s.useRef({}),
2044
- O = cn(),
2045
- $ = ge((B) => {
2046
- if (!v || !f.current || !A.current) return;
2047
- if (C.current || !c) {
2048
- R();
2049
- return;
2050
- }
2051
- const G = v.style.top === '0px',
2052
- de = v.style.bottom === '0px',
2053
- ce = v.getBoundingClientRect().height,
2054
- fe = ut(v),
2055
- be = getComputedStyle(v),
2056
- ie = Number.parseFloat(be.marginTop),
2057
- pe = Number.parseFloat(be.marginBottom),
2058
- T = rn(getComputedStyle(f.current)),
2059
- N = Math.min(fe.documentElement.clientHeight - ie - pe, T),
2060
- w = B.scrollTop,
2061
- D = on(B);
2062
- let _ = 0,
2063
- V = null,
2064
- ue = !1,
2065
- ye = !1;
2066
- const Ce = (re) => {
2067
- v.style.height = `${re}px`;
2068
- },
2069
- Re = (re, ve) => {
2070
- const Te = Pt(re, 0, N - ce);
2071
- Te > 0 && Ce(ce + Te), (B.scrollTop = ve), N - (ce + Te) <= $e && (C.current = !0), R();
2072
- };
2073
- if (G) {
2074
- const re = D - w,
2075
- ve = ce + re,
2076
- Te = Math.min(ve, N);
2077
- if (((_ = Te), re <= $e)) {
2078
- Re(re, D);
2079
- return;
2080
- }
2081
- N - Te > $e ? (ye = !0) : (ue = !0);
2082
- } else if (de) {
2083
- const re = w,
2084
- ve = ce + re,
2085
- Te = Math.min(ve, N),
2086
- Oe = ve - N;
2087
- if (((_ = Te), re <= $e)) {
2088
- Re(re, 0);
2089
- return;
2090
- }
2091
- N - Te > $e ? (V = 0) : ((ue = !0), w < D && (V = w - (re - Oe)));
2092
- }
2093
- if (((_ = Math.ceil(_)), _ !== 0 && Ce(_), ye || V != null)) {
2094
- const re = on(B),
2095
- ve = ye ? re : Pt(V, 0, re);
2096
- Math.abs(B.scrollTop - ve) > $e && (B.scrollTop = ve);
2097
- }
2098
- (ue || _ >= N - $e) && (C.current = !0), R();
2099
- });
2100
- s.useImperativeHandle(S, () => $, [$]),
2101
- Mt({
2102
- open: E,
2103
- ref: f,
2104
- onComplete() {
2105
- E && (p == null || p(!0));
2106
- },
2107
- });
2108
- const se = { open: E, transitionStatus: y, side: h, align: g };
2109
- ee(() => {
2110
- !v ||
2111
- !f.current ||
2112
- Object.keys(ne.current).length ||
2113
- (ne.current = {
2114
- top: v.style.top || '0',
2115
- left: v.style.left || '0',
2116
- right: v.style.right,
2117
- height: v.style.height,
2118
- bottom: v.style.bottom,
2119
- minHeight: v.style.minHeight,
2120
- maxHeight: v.style.maxHeight,
2121
- marginTop: v.style.marginTop,
2122
- marginBottom: v.style.marginBottom,
2123
- });
2124
- }, [f, v]),
2125
- ee(() => {
2126
- E ||
2127
- c ||
2128
- ((A.current = !1),
2129
- (C.current = !1),
2130
- (J.current = 0),
2131
- (me.current = 0),
2132
- vt(v, ne.current));
2133
- }, [E, c, v, f]),
2134
- ee(() => {
2135
- const B = f.current;
2136
- if (!(!E || !W || !v || !B || l.state.transitionStatus === 'ending')) {
2137
- if (!c) {
2138
- (A.current = !0), O.request(R), B.style.removeProperty('--transform-origin');
2139
- return;
2140
- }
2141
- queueMicrotask(() => {
2142
- var de;
2143
- const G = go(B);
2144
- B.style.removeProperty('--transform-origin');
2145
- try {
2146
- const ce = getComputedStyle(v),
2147
- fe = getComputedStyle(B),
2148
- be = ut(W),
2149
- ie = en(v),
2150
- pe = W.getBoundingClientRect(),
2151
- T = v.getBoundingClientRect(),
2152
- N = pe.left,
2153
- w = pe.height,
2154
- D = P || B,
2155
- _ = D.scrollHeight,
2156
- V = Number.parseFloat(fe.borderBottomWidth),
2157
- ue = Number.parseFloat(ce.marginTop) || 10,
2158
- ye = Number.parseFloat(ce.marginBottom) || 10,
2159
- Ce = Number.parseFloat(ce.minHeight) || 100,
2160
- Re = rn(fe),
2161
- re = 5,
2162
- ve = 5,
2163
- Te = 20,
2164
- Oe = be.documentElement.clientHeight - ue - ye,
2165
- tt = be.documentElement.clientWidth,
2166
- nt = Oe - pe.bottom + w,
2167
- qe = b.current,
2168
- rt = i.current;
2169
- let we,
2170
- dt = 0,
2171
- pt = 0;
2172
- if (qe && rt) {
2173
- const oe = rt.getBoundingClientRect();
2174
- we = qe.getBoundingClientRect();
2175
- const Se = oe.left - N,
2176
- Ne = we.left - T.left,
2177
- Ae = oe.top - pe.top + oe.height / 2,
2178
- ze = we.top - T.top + we.height / 2;
2179
- (dt = Se - Ne), (pt = ze - Ae);
2180
- }
2181
- const ot = nt + pt + ye + V;
2182
- let Le = Math.min(Oe, ot);
2183
- const gt = Oe - ue - ye,
2184
- Ye = ot - Le,
2185
- st = Math.max(re, N + dt),
2186
- it = tt - ve,
2187
- It = Math.max(0, st + T.width - it);
2188
- (v.style.left = `${st - It}px`),
2189
- (v.style.height = `${Le}px`),
2190
- (v.style.maxHeight = 'auto'),
2191
- (v.style.marginTop = `${ue}px`),
2192
- (v.style.marginBottom = `${ye}px`),
2193
- (B.style.height = '100%');
2194
- const mt = D.scrollHeight - D.clientHeight,
2195
- ht = Ye >= mt;
2196
- ht && (Le = Math.min(Oe, T.height) - (Ye - mt));
2197
- const Et = pe.top < Te || pe.bottom > Oe - Te || Le < Math.min(_, Ce),
2198
- K = (((de = ie.visualViewport) == null ? void 0 : de.scale) ?? 1) !== 1 && mr;
2199
- if (Et || K) {
2200
- (A.current = !0), vt(v, ne.current), hr.flushSync(() => m(!1));
2201
- return;
2202
- }
2203
- if (ht) {
2204
- const oe = Math.max(0, Oe - ot);
2205
- (v.style.top = T.height >= gt ? '0' : `${oe}px`),
2206
- (v.style.height = `${Le}px`),
2207
- (D.scrollTop = D.scrollHeight - D.clientHeight),
2208
- (J.current = Math.max(Ce, Le));
2209
- } else (v.style.bottom = '0'), (J.current = Math.max(Ce, Le)), (D.scrollTop = Ye);
2210
- if (we) {
2211
- const oe = T.top,
2212
- Se = T.height,
2213
- Ne = we.top + we.height / 2,
2214
- Ae = Se > 0 ? ((Ne - oe) / Se) * 100 : 50,
2215
- ze = Pt(Ae, 0, 100);
2216
- B.style.setProperty('--transform-origin', `50% ${ze}%`);
2217
- }
2218
- (J.current === Oe || Le >= Re) && (C.current = !0),
2219
- R(),
2220
- setTimeout(() => {
2221
- A.current = !0;
2222
- });
2223
- } finally {
2224
- G();
2225
- }
2226
- });
2227
- }
2228
- }, [l, E, v, W, i, b, f, R, c, m, O, j, U, P]),
2229
- s.useEffect(() => {
2230
- if (!c || !v || !E) return;
2231
- const B = en(v);
2232
- function G(de) {
2233
- x(!1, he(xr, de));
2234
- }
2235
- return (
2236
- B.addEventListener('resize', G),
2237
- () => {
2238
- B.removeEventListener('resize', G);
2239
- }
2240
- );
2241
- }, [x, c, v, E]);
2242
- const Ee = {
2243
- ...(P
2244
- ? { role: 'presentation', 'aria-orientation': void 0 }
2245
- : { role: 'listbox', 'aria-multiselectable': I || void 0, id: `${q}-list` }),
2246
- onKeyDown(B) {
2247
- (M.current = !0), F && yr.has(B.key) && B.stopPropagation();
2248
- },
2249
- onMouseMove() {
2250
- M.current = !1;
2251
- },
2252
- onPointerLeave(B) {
2253
- if (!a || On(B) || B.pointerType === 'touch') return;
2254
- const G = B.currentTarget;
2255
- z.start(0, () => {
2256
- l.set('activeIndex', null), G.focus({ preventScroll: !0 });
2257
- });
2258
- },
2259
- onScroll(B) {
2260
- P || $(B.currentTarget);
2261
- },
2262
- ...(c && { style: P ? { height: '100%' } : Pn }),
2263
- },
2264
- Pe = Ve('div', t, {
2265
- ref: [n, f],
2266
- state: se,
2267
- stateAttributesMapping: fo,
2268
- props: [Y, Ee, bn(y), { className: !P && c ? Ft.className : void 0 }, d],
2269
- });
2270
- return H.jsxs(s.Fragment, {
2271
- children: [
2272
- !X && Ft.getElement(ae),
2273
- H.jsx(br, {
2274
- context: Z,
2275
- modal: !1,
2276
- disabled: !te,
2277
- returnFocus: o,
2278
- restoreFocus: !0,
2279
- children: Pe,
2280
- }),
2281
- ],
2282
- });
2283
- });
2284
- function rn(e) {
2285
- const t = e.maxHeight || '';
2286
- return (t.endsWith('px') && Number.parseFloat(t)) || 1 / 0;
2287
- }
2288
- function on(e) {
2289
- return Math.max(0, e.scrollHeight - e.clientHeight);
2290
- }
2291
- const sn = [
2292
- ['transform', 'none'],
2293
- ['scale', '1'],
2294
- ['translate', '0 0'],
2295
- ];
2296
- function go(e) {
2297
- const { style: t } = e,
2298
- n = {};
2299
- for (const [r, u] of sn) (n[r] = t.getPropertyValue(r)), t.setProperty(r, u, 'important');
2300
- return () => {
2301
- for (const [r] of sn) {
2302
- const u = n[r];
2303
- u ? t.setProperty(r, u) : t.removeProperty(r);
2304
- }
2305
- };
2306
- }
2307
- const mo = s.forwardRef((t, n) => {
2308
- const { className: r, render: u, ...o } = t,
2309
- { store: d, scrollHandlerRef: l } = De(),
2310
- { alignItemWithTriggerActive: f } = Wt(),
2311
- p = L(d, k.hasScrollArrows),
2312
- x = L(d, k.openMethod),
2313
- i = L(d, k.multiple),
2314
- M = {
2315
- id: `${L(d, k.id)}-list`,
2316
- role: 'listbox',
2317
- 'aria-multiselectable': i || void 0,
2318
- onScroll(R) {
2319
- var S;
2320
- (S = l.current) == null || S.call(l, R.currentTarget);
2321
- },
2322
- ...(f && { style: Pn }),
2323
- className: p && x !== 'touch' ? Ft.className : void 0,
2324
- },
2325
- I = ge((R) => {
2326
- d.set('listElement', R);
2327
- });
2328
- return Ve('div', t, { ref: [n, I], props: [M, o] });
2329
- });
2330
- const Nn = ((e) => ((e[(e.None = 0)] = 'None'), (e[(e.GuessFromOrder = 1)] = 'GuessFromOrder'), e))(
2331
- {}
2332
- );
2333
- function ho(e = {}) {
2334
- const { label: t, metadata: n, textRef: r, indexGuessBehavior: u, index: o } = e,
2335
- {
2336
- register: d,
2337
- unregister: l,
2338
- subscribeMapChange: f,
2339
- elementsRef: p,
2340
- labelsRef: x,
2341
- nextIndexRef: i,
2342
- } = no(),
2343
- b = s.useRef(-1),
2344
- [M, I] = s.useState(
2345
- o ??
2346
- (u === Nn.GuessFromOrder
2347
- ? () => {
2348
- if (b.current === -1) {
2349
- const a = i.current;
2350
- (i.current += 1), (b.current = a);
2351
- }
2352
- return b.current;
2353
- }
2354
- : -1)
2355
- ),
2356
- R = s.useRef(null),
2357
- S = s.useCallback(
2358
- (a) => {
2359
- var h;
2360
- if (((R.current = a), M !== -1 && a !== null && ((p.current[M] = a), x))) {
2361
- const g = t !== void 0;
2362
- x.current[M] = g
2363
- ? t
2364
- : (((h = r == null ? void 0 : r.current) == null ? void 0 : h.textContent) ??
2365
- a.textContent);
2366
- }
2367
- },
2368
- [M, p, x, t, r]
2369
- );
2370
- return (
2371
- ee(() => {
2372
- if (o != null) return;
2373
- const a = R.current;
2374
- if (a)
2375
- return (
2376
- d(a, n),
2377
- () => {
2378
- l(a);
2379
- }
2380
- );
2381
- }, [o, d, l, n]),
2382
- ee(() => {
2383
- if (o == null)
2384
- return f((a) => {
2385
- var g;
2386
- const h = R.current ? ((g = a.get(R.current)) == null ? void 0 : g.index) : null;
2387
- h != null && I(h);
2388
- });
2389
- }, [o, f, I]),
2390
- s.useMemo(() => ({ ref: S, index: M }), [M, S])
2391
- );
2392
- }
2393
- const kn = s.createContext(void 0);
2394
- function qt() {
2395
- const e = s.useContext(kn);
2396
- if (!e) throw new Error(St(57));
2397
- return e;
2398
- }
2399
- const bo = s.memo(
2400
- s.forwardRef((t, n) => {
2401
- const {
2402
- render: r,
2403
- className: u,
2404
- value: o = null,
2405
- label: d,
2406
- disabled: l = !1,
2407
- nativeButton: f = !1,
2408
- ...p
2409
- } = t,
2410
- x = s.useRef(null),
2411
- i = ho({ label: d, textRef: x, indexGuessBehavior: Nn.GuessFromOrder }),
2412
- {
2413
- store: b,
2414
- getItemProps: M,
2415
- setOpen: I,
2416
- setValue: R,
2417
- selectionRef: S,
2418
- typingRef: a,
2419
- valuesRef: h,
2420
- keyboardActiveRef: g,
2421
- multiple: c,
2422
- highlightItemOnHover: m,
2423
- } = De(),
2424
- j = je(),
2425
- U = L(b, k.isActive, i.index),
2426
- F = L(b, k.isSelected, i.index, o),
2427
- Z = L(b, k.isSelectedByFocus, i.index),
2428
- ae = L(b, k.isItemEqualToValue),
2429
- X = i.index,
2430
- z = X !== -1,
2431
- q = s.useRef(null),
2432
- E = Be(X);
2433
- ee(() => {
2434
- if (!z) return;
2435
- const O = h.current;
2436
- return (
2437
- (O[X] = o),
2438
- () => {
2439
- delete O[X];
2440
- }
2441
- );
2442
- }, [z, X, o, h]),
2443
- ee(() => {
2444
- if (!z) return;
2445
- const O = b.state.value;
2446
- let $ = O;
2447
- c && Array.isArray(O) && O.length > 0 && ($ = O[O.length - 1]),
2448
- $ !== void 0 && et(o, $, ae) && b.set('selectedIndex', X);
2449
- }, [z, X, c, ae, b, o]);
2450
- const te = { disabled: l, selected: F, highlighted: U },
2451
- Y = M({ active: U, selected: F });
2452
- (Y.onFocus = void 0), (Y.id = void 0);
2453
- const y = s.useRef(null),
2454
- W = s.useRef('mouse'),
2455
- v = s.useRef(!1),
2456
- { getButtonProps: P, buttonRef: J } = mn({
2457
- disabled: l,
2458
- focusableWhenDisabled: !0,
2459
- native: f,
2460
- });
2461
- function C(O) {
2462
- const $ = b.state.value;
2463
- if (c) {
2464
- const se = Array.isArray($) ? $ : [],
2465
- Ee = F ? Br(se, o, ae) : [...se, o];
2466
- R(Ee, he(Ot, O));
2467
- } else R(o, he(Ot, O)), I(!1, he(Ot, O));
2468
- }
2469
- const me = {
2470
- role: 'option',
2471
- 'aria-selected': F,
2472
- tabIndex: U ? 0 : -1,
2473
- onFocus() {
2474
- b.set('activeIndex', X);
2475
- },
2476
- onMouseEnter() {
2477
- !g.current && b.state.selectedIndex === null && m && b.set('activeIndex', X);
2478
- },
2479
- onMouseMove() {
2480
- m && b.set('activeIndex', X);
2481
- },
2482
- onMouseLeave(O) {
2483
- !m ||
2484
- g.current ||
2485
- On(O) ||
2486
- j.start(0, () => {
2487
- b.state.activeIndex === X && b.set('activeIndex', null);
2488
- });
2489
- },
2490
- onTouchStart() {
2491
- S.current = { allowSelectedMouseUp: !1, allowUnselectedMouseUp: !1 };
2492
- },
2493
- onKeyDown(O) {
2494
- (y.current = O.key), b.set('activeIndex', X);
2495
- },
2496
- onClick(O) {
2497
- (v.current = !1),
2498
- !(O.type === 'keydown' && y.current === null) &&
2499
- (l ||
2500
- (y.current === ' ' && a.current) ||
2501
- (W.current !== 'touch' && !U) ||
2502
- ((y.current = null), C(O.nativeEvent)));
2503
- },
2504
- onPointerEnter(O) {
2505
- W.current = O.pointerType;
2506
- },
2507
- onPointerDown(O) {
2508
- (W.current = O.pointerType), (v.current = !0);
2509
- },
2510
- onMouseUp(O) {
2511
- if (l) return;
2512
- if (v.current) {
2513
- v.current = !1;
2514
- return;
2515
- }
2516
- const $ = !S.current.allowSelectedMouseUp && F,
2517
- se = !S.current.allowUnselectedMouseUp && !F;
2518
- $ || se || (W.current !== 'touch' && !U) || C(O.nativeEvent);
2519
- },
2520
- },
2521
- A = Ve('div', t, { ref: [J, n, i.ref, q], state: te, props: [Y, me, p, P] }),
2522
- ne = s.useMemo(
2523
- () => ({ selected: F, indexRef: E, textRef: x, selectedByFocus: Z, hasRegistered: z }),
2524
- [F, E, x, Z, z]
2525
- );
2526
- return H.jsx(kn.Provider, { value: ne, children: A });
2527
- })
2528
- ),
2529
- xo = s.forwardRef((t, n) => {
2530
- const r = t.keepMounted ?? !1,
2531
- { selected: u } = qt();
2532
- return r || u ? H.jsx(yo, { ...t, ref: n }) : null;
2533
- }),
2534
- yo = s.memo(
2535
- s.forwardRef((e, t) => {
2536
- const { render: n, className: r, keepMounted: u, ...o } = e,
2537
- { selected: d } = qt(),
2538
- l = s.useRef(null),
2539
- { transitionStatus: f, setMounted: p } = Bt(d),
2540
- i = Ve('span', e, {
2541
- ref: [t, l],
2542
- state: { selected: d, transitionStatus: f },
2543
- props: [{ 'aria-hidden': !0, children: '✔️' }, o],
2544
- stateAttributesMapping: xn,
2545
- });
2546
- return (
2547
- Mt({
2548
- open: d,
2549
- ref: l,
2550
- onComplete() {
2551
- d || p(!1);
2552
- },
2553
- }),
2554
- i
2555
- );
2556
- })
2557
- ),
2558
- Ro = s.memo(
2559
- s.forwardRef((t, n) => {
2560
- const { indexRef: r, textRef: u, selectedByFocus: o, hasRegistered: d } = qt(),
2561
- { selectedItemTextRef: l } = De(),
2562
- { className: f, render: p, ...x } = t,
2563
- i = s.useCallback(
2564
- (M) => {
2565
- if (!M || !d) return;
2566
- const I = l.current === null || !l.current.isConnected;
2567
- (o || (I && r.current === 0)) && (l.current = M);
2568
- },
2569
- [l, r, o, d]
2570
- );
2571
- return Ve('div', t, { ref: [i, n, u], props: x });
2572
- })
2573
- ),
2574
- Vn = s.forwardRef((t, n) => {
2575
- const { render: r, className: u, direction: o, keepMounted: d = !1, ...l } = t,
2576
- {
2577
- store: f,
2578
- popupRef: p,
2579
- listRef: x,
2580
- handleScrollArrowVisibility: i,
2581
- scrollArrowsMountedCountRef: b,
2582
- } = De(),
2583
- { side: M, scrollDownArrowRef: I, scrollUpArrowRef: R } = Wt(),
2584
- S = o === 'up' ? k.scrollUpArrowVisible : k.scrollDownArrowVisible,
2585
- a = L(f, S),
2586
- h = L(f, k.openMethod),
2587
- g = a && h !== 'touch',
2588
- c = je(),
2589
- m = o === 'up' ? R : I,
2590
- { transitionStatus: j, setMounted: U } = Bt(g);
2591
- ee(
2592
- () => (
2593
- (b.current += 1),
2594
- f.state.hasScrollArrows || f.set('hasScrollArrows', !0),
2595
- () => {
2596
- (b.current = Math.max(0, b.current - 1)),
2597
- b.current === 0 && f.state.hasScrollArrows && f.set('hasScrollArrows', !1);
2598
- }
2599
- ),
2600
- [f, b]
2601
- ),
2602
- Mt({
2603
- open: g,
2604
- ref: m,
2605
- onComplete() {
2606
- g || U(!1);
2607
- },
2608
- });
2609
- const ae = Ve('div', t, {
2610
- ref: [n, m],
2611
- state: { direction: o, visible: g, side: M, transitionStatus: j },
2612
- props: [
2613
- {
2614
- 'aria-hidden': !0,
2615
- children: o === 'up' ? '▲' : '▼',
2616
- style: { position: 'absolute' },
2617
- onMouseMove(z) {
2618
- if ((z.movementX === 0 && z.movementY === 0) || c.isStarted()) return;
2619
- f.set('activeIndex', null);
2620
- function q() {
2621
- var W;
2622
- const E = f.state.listElement ?? p.current;
2623
- if (!E) return;
2624
- f.set('activeIndex', null), i();
2625
- const te = E.scrollTop === 0,
2626
- Y = Math.round(E.scrollTop + E.clientHeight) >= E.scrollHeight;
2627
- if (
2628
- (x.current.length === 0 &&
2629
- (o === 'up'
2630
- ? f.set('scrollUpArrowVisible', !te)
2631
- : f.set('scrollDownArrowVisible', !Y)),
2632
- (o === 'up' && te) || (o === 'down' && Y))
2633
- ) {
2634
- c.clear();
2635
- return;
2636
- }
2637
- if ((f.state.listElement || p.current) && x.current && x.current.length > 0) {
2638
- const v = x.current,
2639
- P = ((W = m.current) == null ? void 0 : W.offsetHeight) || 0;
2640
- if (o === 'up') {
2641
- let J = 0;
2642
- const C = E.scrollTop + P;
2643
- for (let A = 0; A < v.length; A += 1) {
2644
- const ne = v[A];
2645
- if (ne && ne.offsetTop >= C) {
2646
- J = A;
2647
- break;
2648
- }
2649
- }
2650
- const me = Math.max(0, J - 1);
2651
- if (me < J) {
2652
- const A = v[me];
2653
- A && (E.scrollTop = Math.max(0, A.offsetTop - P));
2654
- } else E.scrollTop = 0;
2655
- } else {
2656
- let J = v.length - 1;
2657
- const C = E.scrollTop + E.clientHeight - P;
2658
- for (let A = 0; A < v.length; A += 1) {
2659
- const ne = v[A];
2660
- if (ne && ne.offsetTop + ne.offsetHeight > C) {
2661
- J = Math.max(0, A - 1);
2662
- break;
2663
- }
2664
- }
2665
- const me = Math.min(v.length - 1, J + 1);
2666
- if (me > J) {
2667
- const A = v[me];
2668
- A && (E.scrollTop = A.offsetTop + A.offsetHeight - E.clientHeight + P);
2669
- } else E.scrollTop = E.scrollHeight - E.clientHeight;
2670
- }
2671
- }
2672
- c.start(40, q);
2673
- }
2674
- c.start(40, q);
2675
- },
2676
- onMouseLeave() {
2677
- c.clear();
2678
- },
2679
- },
2680
- l,
2681
- ],
2682
- });
2683
- return g || d ? ae : null;
2684
- }),
2685
- vo = s.forwardRef((t, n) => H.jsx(Vn, { ...t, ref: n, direction: 'down' })),
2686
- wo = s.forwardRef((t, n) => H.jsx(Vn, { ...t, ref: n, direction: 'up' })),
2687
- Fo = qr;
2688
- function Ho({ className: e, ...t }) {
2689
- return H.jsx(Zr, {
2690
- 'data-slot': 'select-value',
2691
- className: ke('flex flex-1 text-left', e),
2692
- ...t,
2693
- });
2694
- }
2695
- function jo({ className: e, size: t = 'default', children: n, ...r }) {
2696
- return H.jsxs(Xr, {
2697
- 'data-slot': 'select-trigger',
2698
- 'data-size': t,
2699
- className: ke(
2700
- "border-input data-placeholder:text-muted-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 gap-1.5 rounded-lg border bg-transparent py-2 pr-2 pl-2.5 text-sm transition-colors select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:gap-1.5 [&_svg:not([class*='size-'])]:size-4 flex w-fit items-center justify-between whitespace-nowrap outline-none disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center [&_svg]:pointer-events-none [&_svg]:shrink-0",
2701
- e
2702
- ),
2703
- ...r,
2704
- children: [
2705
- n,
2706
- H.jsx(Qr, {
2707
- render: H.jsx(wn, { className: 'text-muted-foreground size-4 pointer-events-none' }),
2708
- }),
2709
- ],
2710
- });
2711
- }
2712
- function Uo({
2713
- className: e,
2714
- children: t,
2715
- side: n = 'bottom',
2716
- sideOffset: r = 4,
2717
- align: u = 'center',
2718
- alignOffset: o = 0,
2719
- alignItemWithTrigger: d = !0,
2720
- ...l
2721
- }) {
2722
- return H.jsx(to, {
2723
- children: H.jsx(ao, {
2724
- side: n,
2725
- sideOffset: r,
2726
- align: u,
2727
- alignOffset: o,
2728
- alignItemWithTrigger: d,
2729
- className: 'isolate z-50',
2730
- children: H.jsxs(po, {
2731
- 'data-slot': 'select-content',
2732
- 'data-align-trigger': d,
2733
- className: ke(
2734
- 'bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-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 ring-foreground/10 min-w-36 rounded-lg shadow-md ring-1 duration-100 data-[side=inline-start]:slide-in-from-right-2 data-[side=inline-end]:slide-in-from-left-2 relative isolate z-50 max-h-(--available-height) w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto data-[align-trigger=true]:animate-none',
2735
- e
2736
- ),
2737
- ...l,
2738
- children: [H.jsx(So, {}), H.jsx(mo, { children: t }), H.jsx(Mo, {})],
2739
- }),
2740
- }),
2741
- });
2742
- }
2743
- function zo({ className: e, children: t, ...n }) {
2744
- return H.jsxs(bo, {
2745
- 'data-slot': 'select-item',
2746
- className: ke(
2747
- "focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 relative flex w-full cursor-default items-center outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
2748
- e
2749
- ),
2750
- ...n,
2751
- children: [
2752
- H.jsx(Ro, { className: 'flex flex-1 gap-2 shrink-0 whitespace-nowrap', children: t }),
2753
- H.jsx(xo, {
2754
- render: H.jsx('span', {
2755
- className: 'pointer-events-none absolute right-2 flex size-4 items-center justify-center',
2756
- }),
2757
- children: H.jsx(Mr, { className: 'pointer-events-none' }),
2758
- }),
2759
- ],
2760
- });
2761
- }
2762
- function So({ className: e, ...t }) {
2763
- return H.jsx(wo, {
2764
- 'data-slot': 'select-scroll-up-button',
2765
- className: ke(
2766
- "bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 top-0 w-full",
2767
- e
2768
- ),
2769
- ...t,
2770
- children: H.jsx(Er, {}),
2771
- });
2772
- }
2773
- function Mo({ className: e, ...t }) {
2774
- return H.jsx(vo, {
2775
- 'data-slot': 'select-scroll-down-button',
2776
- className: ke(
2777
- "bg-popover z-10 flex cursor-default items-center justify-center py-1 [&_svg:not([class*='size-'])]:size-4 bottom-0 w-full",
2778
- e
2779
- ),
2780
- ...t,
2781
- children: H.jsx(wn, {}),
2782
- });
2783
- }
2784
- export {
2785
- No as C,
2786
- Oo as I,
2787
- Fo as S,
2788
- ko as a,
2789
- Vo as b,
2790
- Do as c,
2791
- jo as d,
2792
- Ho as e,
2793
- Uo as f,
2794
- zo as g,
2795
- ho as h,
2796
- uo as i,
2797
- ro as j,
2798
- Hr as k,
2799
- jr as l,
2800
- Yr as m,
2801
- Vr as n,
2802
- Lo as o,
2803
- Po as u,
2804
- };
2805
- //# sourceMappingURL=select-BNsiC9zT.js.map