@daxence/flexy-date-picker 1.0.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,3764 @@
1
+ import { jsxs as z, jsx as T, Fragment as nt } from "react/jsx-runtime";
2
+ import * as g from "react";
3
+ import Er, { createContext as Rr, useContext as Sr, useRef as Vt, useState as oe, useEffect as Ne, useLayoutEffect as Mn, useMemo as Mr, useCallback as me } from "react";
4
+ import ee from "dayjs";
5
+ import * as Ln from "react-dom";
6
+ var Tn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
7
+ function Dn(e) {
8
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
9
+ }
10
+ var An = { exports: {} };
11
+ (function(e, t) {
12
+ (function(n, r) {
13
+ e.exports = r();
14
+ })(Tn, function() {
15
+ return function(n, r, o) {
16
+ r.prototype.isToday = function() {
17
+ var s = "YYYY-MM-DD", i = o();
18
+ return this.format(s) === i.format(s);
19
+ };
20
+ };
21
+ });
22
+ })(An);
23
+ var Lr = An.exports;
24
+ const Tr = /* @__PURE__ */ Dn(Lr);
25
+ var Pn = { exports: {} };
26
+ (function(e, t) {
27
+ (function(n, r) {
28
+ e.exports = r();
29
+ })(Tn, function() {
30
+ var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" };
31
+ return function(r, o, s) {
32
+ var i = o.prototype, l = i.format;
33
+ s.en.formats = n, i.format = function(a) {
34
+ a === void 0 && (a = "YYYY-MM-DDTHH:mm:ssZ");
35
+ var c = this.$locale().formats, f = function(d, p) {
36
+ return d.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(u, v, m) {
37
+ var y = m && m.toUpperCase();
38
+ return v || p[m] || n[m] || p[y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(h, x, E) {
39
+ return x || E.slice(1);
40
+ });
41
+ });
42
+ }(a, c === void 0 ? {} : c);
43
+ return l.call(this, f);
44
+ };
45
+ };
46
+ });
47
+ })(Pn);
48
+ var Dr = Pn.exports;
49
+ const Ar = /* @__PURE__ */ Dn(Dr), kn = Rr(null);
50
+ function Wt() {
51
+ const e = Sr(kn);
52
+ if (!e)
53
+ throw new Error("useDatePickerContext must be used inside <DatePicker>");
54
+ return e;
55
+ }
56
+ function H(...e) {
57
+ return e.filter(Boolean).join(" ");
58
+ }
59
+ function ve(e, t) {
60
+ return !e || !t ? !1 : e.isSame(t, "day");
61
+ }
62
+ function Nt(e, t, n) {
63
+ if (!t || !n) return !1;
64
+ const r = t.isBefore(n) ? t : n, o = t.isBefore(n) ? n : t;
65
+ return e.isAfter(r, "day") && e.isBefore(o, "day");
66
+ }
67
+ function Nn(e, t) {
68
+ if (!t.start) return !1;
69
+ const n = t.end && t.start.isAfter(t.end) ? t.end : t.start;
70
+ return ve(e, n);
71
+ }
72
+ function On(e, t) {
73
+ if (!t.end) return !1;
74
+ const n = t.start && t.start.isAfter(t.end) ? t.start : t.end;
75
+ return ve(e, n);
76
+ }
77
+ function ls(e, t) {
78
+ return !t.start || !t.end ? !1 : Nn(e, t) || On(e, t) || Nt(e, t.start, t.end);
79
+ }
80
+ function Pr(e, t) {
81
+ var n, r;
82
+ return t === !0 ? !0 : t ? !!(t.before && e.isBefore(t.before, "day") || t.after && e.isAfter(t.after, "day") || (n = t.dates) != null && n.some((o) => ve(e, o)) || (r = t.predicate) != null && r.call(t, e)) : !1;
83
+ }
84
+ function kr(e, t, n = 0) {
85
+ const r = ee(new Date(e, t, 1)), o = r.endOf("month");
86
+ let s = r.day() - n;
87
+ s < 0 && (s += 7);
88
+ const i = s + o.date(), l = i % 7 === 0 ? 0 : 7 - i % 7, a = [];
89
+ for (let c = s; c > 0; c--)
90
+ a.push(r.subtract(c, "day"));
91
+ for (let c = 1; c <= o.date(); c++)
92
+ a.push(ee(new Date(e, t, c)));
93
+ for (let c = 1; c <= l; c++)
94
+ a.push(o.add(c, "day"));
95
+ return a;
96
+ }
97
+ function Nr(e = 0, t) {
98
+ const n = ee().locale(t ?? "en"), r = [];
99
+ for (let o = 0; o < 7; o++) {
100
+ const s = (e + o) % 7;
101
+ r.push(n.day(s).format("dd"));
102
+ }
103
+ return r;
104
+ }
105
+ function Or(e) {
106
+ const t = ee().locale(e ?? "en");
107
+ return Array.from(
108
+ { length: 12 },
109
+ (n, r) => t.month(r).format("MMMM")
110
+ );
111
+ }
112
+ function Ir(e = 50) {
113
+ const t = ee().year(), n = [];
114
+ for (let r = t - e; r <= t + e; r++)
115
+ n.push(r);
116
+ return n;
117
+ }
118
+ function rn(e) {
119
+ const [t, n] = e.split(":"), r = Number(t), o = Number(n);
120
+ return !Number.isInteger(r) || !Number.isInteger(o) || r < 0 || r > 23 || o < 0 || o > 59 ? null : r * 60 + o;
121
+ }
122
+ function Ht(e = 15, t = "00:00", n = "23:59") {
123
+ const r = rn(t) ?? 0, o = rn(n) ?? 24 * 60 - 1, s = Math.max(1, e), i = Math.min(r, o), l = Math.max(r, o), a = [];
124
+ for (let c = i; c <= l; c += s) {
125
+ const f = String(Math.floor(c / 60)).padStart(2, "0"), d = String(c % 60).padStart(2, "0");
126
+ a.push(`${f}:${d}`);
127
+ }
128
+ return a;
129
+ }
130
+ function In(e) {
131
+ var r;
132
+ if (e.unavailable) return [];
133
+ if (!((r = e.ranges) != null && r.length)) return [];
134
+ const t = /* @__PURE__ */ new Set(), n = [];
135
+ for (const o of e.ranges) {
136
+ const s = Ht(o.step, o.from, o.to);
137
+ for (const i of s)
138
+ t.has(i) || (t.add(i), n.push(i));
139
+ }
140
+ return n;
141
+ }
142
+ function Cn(e, t, n) {
143
+ var l, a, c;
144
+ if (!n) return !1;
145
+ const r = e.day(), o = (l = n.weekdays) == null ? void 0 : l[r];
146
+ if (o != null && o.includes(t)) return !0;
147
+ const s = e.format("YYYY-MM-DD"), i = (a = n.dates) == null ? void 0 : a[s];
148
+ return !!(i != null && i.includes(t) || (c = n.predicate) != null && c.call(n, e, t));
149
+ }
150
+ const Cr = "‹", Fr = "›";
151
+ function Yr({ panelIndex: e = 0, totalPanels: t = 1 }) {
152
+ const n = Vt(null), [r, o] = oe(null), {
153
+ currentYear: s,
154
+ currentMonth: i,
155
+ setCurrentYear: l,
156
+ setCurrentMonth: a,
157
+ locale: c,
158
+ showMonthYearSelectors: f = !0,
159
+ classNames: d,
160
+ styles: p,
161
+ renderNavButton: u,
162
+ onMonthChange: v,
163
+ onYearChange: m
164
+ } = Wt(), y = (i + e) % 12, h = s + Math.floor((i + e) / 12), x = Or(c), E = Ir(50), S = e === 0, D = e === t - 1;
165
+ Ne(() => {
166
+ function M(w) {
167
+ n.current && !n.current.contains(w.target) && o(null);
168
+ }
169
+ return r && document.addEventListener("mousedown", M), () => document.removeEventListener("mousedown", M);
170
+ }, [r]);
171
+ function A(M) {
172
+ const w = s * 12 + i + M, O = Math.floor(w / 12), F = (w % 12 + 12) % 12;
173
+ a(F), l(O), v == null || v(F, O);
174
+ }
175
+ function N(M, w) {
176
+ const O = w * 12 + M - e, F = Math.floor(O / 12), L = (O % 12 + 12) % 12;
177
+ a(L), l(F), v == null || v(M, w);
178
+ }
179
+ function R(M, w) {
180
+ (M.key === "Enter" || M.key === " ") && (M.preventDefault(), w());
181
+ }
182
+ function C() {
183
+ A(-1);
184
+ }
185
+ function I() {
186
+ A(1);
187
+ }
188
+ function $(M) {
189
+ N(M, h), o(null);
190
+ }
191
+ function _(M) {
192
+ N(y, M), m == null || m(M), o(null);
193
+ }
194
+ return /* @__PURE__ */ z(
195
+ "div",
196
+ {
197
+ ref: n,
198
+ className: H("fldp-calendar-header", d.calendarHeader),
199
+ style: p.calendarHeader,
200
+ children: [
201
+ S ? u ? u("prev", C) : /* @__PURE__ */ T(
202
+ "span",
203
+ {
204
+ onClick: C,
205
+ onKeyDown: (M) => R(M, C),
206
+ "aria-label": "Previous month",
207
+ role: "button",
208
+ tabIndex: 0,
209
+ className: H("fldp-nav-button", d.navButton),
210
+ style: p.navButton,
211
+ children: Cr
212
+ }
213
+ ) : /* @__PURE__ */ T("span", { style: { width: 28 } }),
214
+ /* @__PURE__ */ T("div", { className: "fldp-month-year-selectors", style: p.monthYearLabel, children: f ? /* @__PURE__ */ z(nt, { children: [
215
+ /* @__PURE__ */ z("div", { className: "fldp-header-field-group", children: [
216
+ /* @__PURE__ */ z(
217
+ "span",
218
+ {
219
+ className: H("fldp-header-trigger", r === "month" && "fldp-header-trigger--open"),
220
+ role: "button",
221
+ tabIndex: 0,
222
+ "aria-haspopup": "listbox",
223
+ "aria-expanded": r === "month",
224
+ onClick: () => o(r === "month" ? null : "month"),
225
+ onKeyDown: (M) => R(M, () => o(r === "month" ? null : "month")),
226
+ children: [
227
+ /* @__PURE__ */ T("span", { className: "fldp-header-trigger-label", children: x[y] }),
228
+ /* @__PURE__ */ T("span", { className: "fldp-header-trigger-caret", "aria-hidden": "true", children: "▾" })
229
+ ]
230
+ }
231
+ ),
232
+ r === "month" && /* @__PURE__ */ T("div", { className: "fldp-header-menu", role: "listbox", "aria-label": "Select month", children: x.map((M, w) => /* @__PURE__ */ T(
233
+ "span",
234
+ {
235
+ className: H("fldp-header-option", w === y && "fldp-header-option--active"),
236
+ role: "option",
237
+ "aria-selected": w === y,
238
+ tabIndex: 0,
239
+ onClick: () => $(w),
240
+ onKeyDown: (O) => R(O, () => $(w)),
241
+ children: M
242
+ },
243
+ M
244
+ )) })
245
+ ] }),
246
+ /* @__PURE__ */ z("div", { className: "fldp-header-field-group", children: [
247
+ /* @__PURE__ */ z(
248
+ "span",
249
+ {
250
+ className: H("fldp-header-trigger", r === "year" && "fldp-header-trigger--open"),
251
+ role: "button",
252
+ tabIndex: 0,
253
+ "aria-haspopup": "listbox",
254
+ "aria-expanded": r === "year",
255
+ onClick: () => o(r === "year" ? null : "year"),
256
+ onKeyDown: (M) => R(M, () => o(r === "year" ? null : "year")),
257
+ children: [
258
+ /* @__PURE__ */ T("span", { className: "fldp-header-trigger-label", children: h }),
259
+ /* @__PURE__ */ T("span", { className: "fldp-header-trigger-caret", "aria-hidden": "true", children: "▾" })
260
+ ]
261
+ }
262
+ ),
263
+ r === "year" && /* @__PURE__ */ T("div", { className: "fldp-header-menu fldp-header-menu--year", role: "listbox", "aria-label": "Select year", children: E.map((M) => /* @__PURE__ */ T(
264
+ "span",
265
+ {
266
+ className: H("fldp-header-option", M === h && "fldp-header-option--active"),
267
+ role: "option",
268
+ "aria-selected": M === h,
269
+ tabIndex: 0,
270
+ onClick: () => _(M),
271
+ onKeyDown: (w) => R(w, () => _(M)),
272
+ children: M
273
+ },
274
+ M
275
+ )) })
276
+ ] })
277
+ ] }) : /* @__PURE__ */ z("div", { className: "fldp-month-year-label", children: [
278
+ x[y].toUpperCase(),
279
+ " ",
280
+ h
281
+ ] }) }),
282
+ D ? u ? u("next", I) : /* @__PURE__ */ T(
283
+ "span",
284
+ {
285
+ onClick: I,
286
+ onKeyDown: (M) => R(M, I),
287
+ "aria-label": "Next month",
288
+ role: "button",
289
+ tabIndex: 0,
290
+ className: H("fldp-nav-button", d.navButton),
291
+ style: p.navButton,
292
+ children: Fr
293
+ }
294
+ ) : /* @__PURE__ */ T("span", { style: { width: 28 } })
295
+ ]
296
+ }
297
+ );
298
+ }
299
+ function at() {
300
+ return typeof window < "u";
301
+ }
302
+ function Fe(e) {
303
+ return Kt(e) ? (e.nodeName || "").toLowerCase() : "#document";
304
+ }
305
+ function te(e) {
306
+ var t;
307
+ return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
308
+ }
309
+ function pe(e) {
310
+ var t;
311
+ return (t = (Kt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
312
+ }
313
+ function Kt(e) {
314
+ return at() ? e instanceof Node || e instanceof te(e).Node : !1;
315
+ }
316
+ function U(e) {
317
+ return at() ? e instanceof Element || e instanceof te(e).Element : !1;
318
+ }
319
+ function ie(e) {
320
+ return at() ? e instanceof HTMLElement || e instanceof te(e).HTMLElement : !1;
321
+ }
322
+ function Ot(e) {
323
+ return !at() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof te(e).ShadowRoot;
324
+ }
325
+ function Ue(e) {
326
+ const {
327
+ overflow: t,
328
+ overflowX: n,
329
+ overflowY: r,
330
+ display: o
331
+ } = ne(e);
332
+ return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && o !== "inline" && o !== "contents";
333
+ }
334
+ function _r(e) {
335
+ return /^(table|td|th)$/.test(Fe(e));
336
+ }
337
+ function ut(e) {
338
+ try {
339
+ if (e.matches(":popover-open"))
340
+ return !0;
341
+ } catch {
342
+ }
343
+ try {
344
+ return e.matches(":modal");
345
+ } catch {
346
+ return !1;
347
+ }
348
+ }
349
+ const Br = /transform|translate|scale|rotate|perspective|filter/, $r = /paint|layout|strict|content/, Re = (e) => !!e && e !== "none";
350
+ let Rt;
351
+ function jt(e) {
352
+ const t = U(e) ? ne(e) : e;
353
+ return Re(t.transform) || Re(t.translate) || Re(t.scale) || Re(t.rotate) || Re(t.perspective) || !ft() && (Re(t.backdropFilter) || Re(t.filter)) || Br.test(t.willChange || "") || $r.test(t.contain || "");
354
+ }
355
+ function Vr(e) {
356
+ let t = ge(e);
357
+ for (; ie(t) && !he(t); ) {
358
+ if (jt(t))
359
+ return t;
360
+ if (ut(t))
361
+ return null;
362
+ t = ge(t);
363
+ }
364
+ return null;
365
+ }
366
+ function ft() {
367
+ return Rt == null && (Rt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), Rt;
368
+ }
369
+ function he(e) {
370
+ return /^(html|body|#document)$/.test(Fe(e));
371
+ }
372
+ function ne(e) {
373
+ return te(e).getComputedStyle(e);
374
+ }
375
+ function dt(e) {
376
+ return U(e) ? {
377
+ scrollLeft: e.scrollLeft,
378
+ scrollTop: e.scrollTop
379
+ } : {
380
+ scrollLeft: e.scrollX,
381
+ scrollTop: e.scrollY
382
+ };
383
+ }
384
+ function ge(e) {
385
+ if (Fe(e) === "html")
386
+ return e;
387
+ const t = (
388
+ // Step into the shadow DOM of the parent of a slotted node.
389
+ e.assignedSlot || // DOM Element detected.
390
+ e.parentNode || // ShadowRoot detected.
391
+ Ot(e) && e.host || // Fallback.
392
+ pe(e)
393
+ );
394
+ return Ot(t) ? t.host : t;
395
+ }
396
+ function Fn(e) {
397
+ const t = ge(e);
398
+ return he(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : ie(t) && Ue(t) ? t : Fn(t);
399
+ }
400
+ function we(e, t, n) {
401
+ var r;
402
+ t === void 0 && (t = []), n === void 0 && (n = !0);
403
+ const o = Fn(e), s = o === ((r = e.ownerDocument) == null ? void 0 : r.body), i = te(o);
404
+ if (s) {
405
+ const l = It(i);
406
+ return t.concat(i, i.visualViewport || [], Ue(o) ? o : [], l && n ? we(l) : []);
407
+ } else
408
+ return t.concat(o, we(o, [], n));
409
+ }
410
+ function It(e) {
411
+ return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
412
+ }
413
+ const Ie = Math.min, Se = Math.max, rt = Math.round, Je = Math.floor, de = (e) => ({
414
+ x: e,
415
+ y: e
416
+ }), Wr = {
417
+ left: "right",
418
+ right: "left",
419
+ bottom: "top",
420
+ top: "bottom"
421
+ };
422
+ function Ct(e, t, n) {
423
+ return Se(e, Ie(t, n));
424
+ }
425
+ function Xe(e, t) {
426
+ return typeof e == "function" ? e(t) : e;
427
+ }
428
+ function Me(e) {
429
+ return e.split("-")[0];
430
+ }
431
+ function ze(e) {
432
+ return e.split("-")[1];
433
+ }
434
+ function Yn(e) {
435
+ return e === "x" ? "y" : "x";
436
+ }
437
+ function Ut(e) {
438
+ return e === "y" ? "height" : "width";
439
+ }
440
+ function be(e) {
441
+ const t = e[0];
442
+ return t === "t" || t === "b" ? "y" : "x";
443
+ }
444
+ function Xt(e) {
445
+ return Yn(be(e));
446
+ }
447
+ function Hr(e, t, n) {
448
+ n === void 0 && (n = !1);
449
+ const r = ze(e), o = Xt(e), s = Ut(o);
450
+ let i = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
451
+ return t.reference[s] > t.floating[s] && (i = ot(i)), [i, ot(i)];
452
+ }
453
+ function Kr(e) {
454
+ const t = ot(e);
455
+ return [Ft(e), t, Ft(t)];
456
+ }
457
+ function Ft(e) {
458
+ return e.includes("start") ? e.replace("start", "end") : e.replace("end", "start");
459
+ }
460
+ const on = ["left", "right"], sn = ["right", "left"], jr = ["top", "bottom"], Ur = ["bottom", "top"];
461
+ function Xr(e, t, n) {
462
+ switch (e) {
463
+ case "top":
464
+ case "bottom":
465
+ return n ? t ? sn : on : t ? on : sn;
466
+ case "left":
467
+ case "right":
468
+ return t ? jr : Ur;
469
+ default:
470
+ return [];
471
+ }
472
+ }
473
+ function zr(e, t, n, r) {
474
+ const o = ze(e);
475
+ let s = Xr(Me(e), n === "start", r);
476
+ return o && (s = s.map((i) => i + "-" + o), t && (s = s.concat(s.map(Ft)))), s;
477
+ }
478
+ function ot(e) {
479
+ const t = Me(e);
480
+ return Wr[t] + e.slice(t.length);
481
+ }
482
+ function qr(e) {
483
+ return {
484
+ top: 0,
485
+ right: 0,
486
+ bottom: 0,
487
+ left: 0,
488
+ ...e
489
+ };
490
+ }
491
+ function _n(e) {
492
+ return typeof e != "number" ? qr(e) : {
493
+ top: e,
494
+ right: e,
495
+ bottom: e,
496
+ left: e
497
+ };
498
+ }
499
+ function it(e) {
500
+ const {
501
+ x: t,
502
+ y: n,
503
+ width: r,
504
+ height: o
505
+ } = e;
506
+ return {
507
+ width: r,
508
+ height: o,
509
+ top: n,
510
+ left: t,
511
+ right: t + r,
512
+ bottom: n + o,
513
+ x: t,
514
+ y: n
515
+ };
516
+ }
517
+ /*!
518
+ * tabbable 6.4.0
519
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
520
+ */
521
+ var Gr = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"], Yt = /* @__PURE__ */ Gr.join(","), Bn = typeof Element > "u", Ke = Bn ? function() {
522
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, st = !Bn && Element.prototype.getRootNode ? function(e) {
523
+ var t;
524
+ return e == null || (t = e.getRootNode) === null || t === void 0 ? void 0 : t.call(e);
525
+ } : function(e) {
526
+ return e == null ? void 0 : e.ownerDocument;
527
+ }, lt = function(t, n) {
528
+ var r;
529
+ n === void 0 && (n = !0);
530
+ var o = t == null || (r = t.getAttribute) === null || r === void 0 ? void 0 : r.call(t, "inert"), s = o === "" || o === "true", i = s || n && t && // closest does not exist on shadow roots, so we fall back to a manual
531
+ // lookup upward, in case it is not defined.
532
+ (typeof t.closest == "function" ? t.closest("[inert]") : lt(t.parentNode));
533
+ return i;
534
+ }, Zr = function(t) {
535
+ var n, r = t == null || (n = t.getAttribute) === null || n === void 0 ? void 0 : n.call(t, "contenteditable");
536
+ return r === "" || r === "true";
537
+ }, Jr = function(t, n, r) {
538
+ if (lt(t))
539
+ return [];
540
+ var o = Array.prototype.slice.apply(t.querySelectorAll(Yt));
541
+ return n && Ke.call(t, Yt) && o.unshift(t), o = o.filter(r), o;
542
+ }, _t = function(t, n, r) {
543
+ for (var o = [], s = Array.from(t); s.length; ) {
544
+ var i = s.shift();
545
+ if (!lt(i, !1))
546
+ if (i.tagName === "SLOT") {
547
+ var l = i.assignedElements(), a = l.length ? l : i.children, c = _t(a, !0, r);
548
+ r.flatten ? o.push.apply(o, c) : o.push({
549
+ scopeParent: i,
550
+ candidates: c
551
+ });
552
+ } else {
553
+ var f = Ke.call(i, Yt);
554
+ f && r.filter(i) && (n || !t.includes(i)) && o.push(i);
555
+ var d = i.shadowRoot || // check for an undisclosed shadow
556
+ typeof r.getShadowRoot == "function" && r.getShadowRoot(i), p = !lt(d, !1) && (!r.shadowRootFilter || r.shadowRootFilter(i));
557
+ if (d && p) {
558
+ var u = _t(d === !0 ? i.children : d.children, !0, r);
559
+ r.flatten ? o.push.apply(o, u) : o.push({
560
+ scopeParent: i,
561
+ candidates: u
562
+ });
563
+ } else
564
+ s.unshift.apply(s, i.children);
565
+ }
566
+ }
567
+ return o;
568
+ }, $n = function(t) {
569
+ return !isNaN(parseInt(t.getAttribute("tabindex"), 10));
570
+ }, Vn = function(t) {
571
+ if (!t)
572
+ throw new Error("No node provided");
573
+ return t.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName) || Zr(t)) && !$n(t) ? 0 : t.tabIndex;
574
+ }, Qr = function(t, n) {
575
+ var r = Vn(t);
576
+ return r < 0 && n && !$n(t) ? 0 : r;
577
+ }, eo = function(t, n) {
578
+ return t.tabIndex === n.tabIndex ? t.documentOrder - n.documentOrder : t.tabIndex - n.tabIndex;
579
+ }, Wn = function(t) {
580
+ return t.tagName === "INPUT";
581
+ }, to = function(t) {
582
+ return Wn(t) && t.type === "hidden";
583
+ }, no = function(t) {
584
+ var n = t.tagName === "DETAILS" && Array.prototype.slice.apply(t.children).some(function(r) {
585
+ return r.tagName === "SUMMARY";
586
+ });
587
+ return n;
588
+ }, ro = function(t, n) {
589
+ for (var r = 0; r < t.length; r++)
590
+ if (t[r].checked && t[r].form === n)
591
+ return t[r];
592
+ }, oo = function(t) {
593
+ if (!t.name)
594
+ return !0;
595
+ var n = t.form || st(t), r = function(l) {
596
+ return n.querySelectorAll('input[type="radio"][name="' + l + '"]');
597
+ }, o;
598
+ if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
599
+ o = r(window.CSS.escape(t.name));
600
+ else
601
+ try {
602
+ o = r(t.name);
603
+ } catch (i) {
604
+ return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", i.message), !1;
605
+ }
606
+ var s = ro(o, t.form);
607
+ return !s || s === t;
608
+ }, io = function(t) {
609
+ return Wn(t) && t.type === "radio";
610
+ }, so = function(t) {
611
+ return io(t) && !oo(t);
612
+ }, lo = function(t) {
613
+ var n, r = t && st(t), o = (n = r) === null || n === void 0 ? void 0 : n.host, s = !1;
614
+ if (r && r !== t) {
615
+ var i, l, a;
616
+ for (s = !!((i = o) !== null && i !== void 0 && (l = i.ownerDocument) !== null && l !== void 0 && l.contains(o) || t != null && (a = t.ownerDocument) !== null && a !== void 0 && a.contains(t)); !s && o; ) {
617
+ var c, f, d;
618
+ r = st(o), o = (c = r) === null || c === void 0 ? void 0 : c.host, s = !!((f = o) !== null && f !== void 0 && (d = f.ownerDocument) !== null && d !== void 0 && d.contains(o));
619
+ }
620
+ }
621
+ return s;
622
+ }, ln = function(t) {
623
+ var n = t.getBoundingClientRect(), r = n.width, o = n.height;
624
+ return r === 0 && o === 0;
625
+ }, co = function(t, n) {
626
+ var r = n.displayCheck, o = n.getShadowRoot;
627
+ if (r === "full-native" && "checkVisibility" in t) {
628
+ var s = t.checkVisibility({
629
+ // Checking opacity might be desirable for some use cases, but natively,
630
+ // opacity zero elements _are_ focusable and tabbable.
631
+ checkOpacity: !1,
632
+ opacityProperty: !1,
633
+ contentVisibilityAuto: !0,
634
+ visibilityProperty: !0,
635
+ // This is an alias for `visibilityProperty`. Contemporary browsers
636
+ // support both. However, this alias has wider browser support (Chrome
637
+ // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
638
+ // we include it anyway.
639
+ checkVisibilityCSS: !0
640
+ });
641
+ return !s;
642
+ }
643
+ if (getComputedStyle(t).visibility === "hidden")
644
+ return !0;
645
+ var i = Ke.call(t, "details>summary:first-of-type"), l = i ? t.parentElement : t;
646
+ if (Ke.call(l, "details:not([open]) *"))
647
+ return !0;
648
+ if (!r || r === "full" || // full-native can run this branch when it falls through in case
649
+ // Element#checkVisibility is unsupported
650
+ r === "full-native" || r === "legacy-full") {
651
+ if (typeof o == "function") {
652
+ for (var a = t; t; ) {
653
+ var c = t.parentElement, f = st(t);
654
+ if (c && !c.shadowRoot && o(c) === !0)
655
+ return ln(t);
656
+ t.assignedSlot ? t = t.assignedSlot : !c && f !== t.ownerDocument ? t = f.host : t = c;
657
+ }
658
+ t = a;
659
+ }
660
+ if (lo(t))
661
+ return !t.getClientRects().length;
662
+ if (r !== "legacy-full")
663
+ return !0;
664
+ } else if (r === "non-zero-area")
665
+ return ln(t);
666
+ return !1;
667
+ }, ao = function(t) {
668
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))
669
+ for (var n = t.parentElement; n; ) {
670
+ if (n.tagName === "FIELDSET" && n.disabled) {
671
+ for (var r = 0; r < n.children.length; r++) {
672
+ var o = n.children.item(r);
673
+ if (o.tagName === "LEGEND")
674
+ return Ke.call(n, "fieldset[disabled] *") ? !0 : !o.contains(t);
675
+ }
676
+ return !0;
677
+ }
678
+ n = n.parentElement;
679
+ }
680
+ return !1;
681
+ }, uo = function(t, n) {
682
+ return !(n.disabled || to(n) || co(n, t) || // For a details element with a summary, the summary element gets the focus
683
+ no(n) || ao(n));
684
+ }, cn = function(t, n) {
685
+ return !(so(n) || Vn(n) < 0 || !uo(t, n));
686
+ }, fo = function(t) {
687
+ var n = parseInt(t.getAttribute("tabindex"), 10);
688
+ return !!(isNaN(n) || n >= 0);
689
+ }, Hn = function(t) {
690
+ var n = [], r = [];
691
+ return t.forEach(function(o, s) {
692
+ var i = !!o.scopeParent, l = i ? o.scopeParent : o, a = Qr(l, i), c = i ? Hn(o.candidates) : l;
693
+ a === 0 ? i ? n.push.apply(n, c) : n.push(l) : r.push({
694
+ documentOrder: s,
695
+ tabIndex: a,
696
+ item: o,
697
+ isScope: i,
698
+ content: c
699
+ });
700
+ }), r.sort(eo).reduce(function(o, s) {
701
+ return s.isScope ? o.push.apply(o, s.content) : o.push(s.content), o;
702
+ }, []).concat(n);
703
+ }, Kn = function(t, n) {
704
+ n = n || {};
705
+ var r;
706
+ return n.getShadowRoot ? r = _t([t], n.includeContainer, {
707
+ filter: cn.bind(null, n),
708
+ flatten: !1,
709
+ getShadowRoot: n.getShadowRoot,
710
+ shadowRootFilter: fo
711
+ }) : r = Jr(t, n.includeContainer, cn.bind(null, n)), Hn(r);
712
+ };
713
+ function po() {
714
+ const e = navigator.userAgentData;
715
+ return e != null && e.platform ? e.platform : navigator.platform;
716
+ }
717
+ function mo() {
718
+ const e = navigator.userAgentData;
719
+ return e && Array.isArray(e.brands) ? e.brands.map((t) => {
720
+ let {
721
+ brand: n,
722
+ version: r
723
+ } = t;
724
+ return n + "/" + r;
725
+ }).join(" ") : navigator.userAgent;
726
+ }
727
+ function jn() {
728
+ return /apple/i.test(navigator.vendor);
729
+ }
730
+ function vo() {
731
+ return po().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
732
+ }
733
+ function ho() {
734
+ return mo().includes("jsdom/");
735
+ }
736
+ const an = "data-floating-ui-focusable", go = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
737
+ function Bt(e) {
738
+ let t = e.activeElement;
739
+ for (; ((n = t) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
740
+ var n;
741
+ t = t.shadowRoot.activeElement;
742
+ }
743
+ return t;
744
+ }
745
+ function Ce(e, t) {
746
+ if (!e || !t)
747
+ return !1;
748
+ const n = t.getRootNode == null ? void 0 : t.getRootNode();
749
+ if (e.contains(t))
750
+ return !0;
751
+ if (n && Ot(n)) {
752
+ let r = t;
753
+ for (; r; ) {
754
+ if (e === r)
755
+ return !0;
756
+ r = r.parentNode || r.host;
757
+ }
758
+ }
759
+ return !1;
760
+ }
761
+ function ke(e) {
762
+ return "composedPath" in e ? e.composedPath()[0] : e.target;
763
+ }
764
+ function St(e, t) {
765
+ if (t == null)
766
+ return !1;
767
+ if ("composedPath" in e)
768
+ return e.composedPath().includes(t);
769
+ const n = e;
770
+ return n.target != null && t.contains(n.target);
771
+ }
772
+ function yo(e) {
773
+ return e.matches("html,body");
774
+ }
775
+ function fe(e) {
776
+ return (e == null ? void 0 : e.ownerDocument) || document;
777
+ }
778
+ function bo(e) {
779
+ return ie(e) && e.matches(go);
780
+ }
781
+ function wo(e) {
782
+ if (!e || ho()) return !0;
783
+ try {
784
+ return e.matches(":focus-visible");
785
+ } catch {
786
+ return !0;
787
+ }
788
+ }
789
+ function xo(e) {
790
+ return e ? e.hasAttribute(an) ? e : e.querySelector("[" + an + "]") || e : null;
791
+ }
792
+ function et(e, t, n) {
793
+ return n === void 0 && (n = !0), e.filter((o) => {
794
+ var s;
795
+ return o.parentId === t && (!n || ((s = o.context) == null ? void 0 : s.open));
796
+ }).flatMap((o) => [o, ...et(e, o.id, n)]);
797
+ }
798
+ function Eo(e) {
799
+ return "nativeEvent" in e;
800
+ }
801
+ function $t(e, t) {
802
+ const n = ["mouse", "pen"];
803
+ return n.push("", void 0), n.includes(e);
804
+ }
805
+ var Ro = typeof document < "u", So = function() {
806
+ }, le = Ro ? Mn : So;
807
+ const Mo = {
808
+ ...g
809
+ };
810
+ function Qe(e) {
811
+ const t = g.useRef(e);
812
+ return le(() => {
813
+ t.current = e;
814
+ }), t;
815
+ }
816
+ const Lo = Mo.useInsertionEffect, To = Lo || ((e) => e());
817
+ function ue(e) {
818
+ const t = g.useRef(() => {
819
+ if (process.env.NODE_ENV !== "production")
820
+ throw new Error("Cannot call an event handler while rendering.");
821
+ });
822
+ return To(() => {
823
+ t.current = e;
824
+ }), g.useCallback(function() {
825
+ for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
826
+ r[o] = arguments[o];
827
+ return t.current == null ? void 0 : t.current(...r);
828
+ }, []);
829
+ }
830
+ const Un = () => ({
831
+ getShadowRoot: !0,
832
+ displayCheck: (
833
+ // JSDOM does not support the `tabbable` library. To solve this we can
834
+ // check if `ResizeObserver` is a real function (not polyfilled), which
835
+ // determines if the current environment is JSDOM-like.
836
+ typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
837
+ )
838
+ });
839
+ function Xn(e, t) {
840
+ const n = Kn(e, Un()), r = n.length;
841
+ if (r === 0) return;
842
+ const o = Bt(fe(e)), s = n.indexOf(o), i = s === -1 ? t === 1 ? 0 : r - 1 : s + t;
843
+ return n[i];
844
+ }
845
+ function Do(e) {
846
+ return Xn(fe(e).body, 1) || e;
847
+ }
848
+ function Ao(e) {
849
+ return Xn(fe(e).body, -1) || e;
850
+ }
851
+ function Mt(e, t) {
852
+ const n = t || e.currentTarget, r = e.relatedTarget;
853
+ return !r || !Ce(n, r);
854
+ }
855
+ function Po(e) {
856
+ Kn(e, Un()).forEach((n) => {
857
+ n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
858
+ });
859
+ }
860
+ function un(e) {
861
+ e.querySelectorAll("[data-tabindex]").forEach((n) => {
862
+ const r = n.dataset.tabindex;
863
+ delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
864
+ });
865
+ }
866
+ function fn(e, t, n) {
867
+ let {
868
+ reference: r,
869
+ floating: o
870
+ } = e;
871
+ const s = be(t), i = Xt(t), l = Ut(i), a = Me(t), c = s === "y", f = r.x + r.width / 2 - o.width / 2, d = r.y + r.height / 2 - o.height / 2, p = r[l] / 2 - o[l] / 2;
872
+ let u;
873
+ switch (a) {
874
+ case "top":
875
+ u = {
876
+ x: f,
877
+ y: r.y - o.height
878
+ };
879
+ break;
880
+ case "bottom":
881
+ u = {
882
+ x: f,
883
+ y: r.y + r.height
884
+ };
885
+ break;
886
+ case "right":
887
+ u = {
888
+ x: r.x + r.width,
889
+ y: d
890
+ };
891
+ break;
892
+ case "left":
893
+ u = {
894
+ x: r.x - o.width,
895
+ y: d
896
+ };
897
+ break;
898
+ default:
899
+ u = {
900
+ x: r.x,
901
+ y: r.y
902
+ };
903
+ }
904
+ switch (ze(t)) {
905
+ case "start":
906
+ u[i] -= p * (n && c ? -1 : 1);
907
+ break;
908
+ case "end":
909
+ u[i] += p * (n && c ? -1 : 1);
910
+ break;
911
+ }
912
+ return u;
913
+ }
914
+ async function ko(e, t) {
915
+ var n;
916
+ t === void 0 && (t = {});
917
+ const {
918
+ x: r,
919
+ y: o,
920
+ platform: s,
921
+ rects: i,
922
+ elements: l,
923
+ strategy: a
924
+ } = e, {
925
+ boundary: c = "clippingAncestors",
926
+ rootBoundary: f = "viewport",
927
+ elementContext: d = "floating",
928
+ altBoundary: p = !1,
929
+ padding: u = 0
930
+ } = Xe(t, e), v = _n(u), y = l[p ? d === "floating" ? "reference" : "floating" : d], h = it(await s.getClippingRect({
931
+ element: (n = await (s.isElement == null ? void 0 : s.isElement(y))) == null || n ? y : y.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
932
+ boundary: c,
933
+ rootBoundary: f,
934
+ strategy: a
935
+ })), x = d === "floating" ? {
936
+ x: r,
937
+ y: o,
938
+ width: i.floating.width,
939
+ height: i.floating.height
940
+ } : i.reference, E = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), S = await (s.isElement == null ? void 0 : s.isElement(E)) ? await (s.getScale == null ? void 0 : s.getScale(E)) || {
941
+ x: 1,
942
+ y: 1
943
+ } : {
944
+ x: 1,
945
+ y: 1
946
+ }, D = it(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
947
+ elements: l,
948
+ rect: x,
949
+ offsetParent: E,
950
+ strategy: a
951
+ }) : x);
952
+ return {
953
+ top: (h.top - D.top + v.top) / S.y,
954
+ bottom: (D.bottom - h.bottom + v.bottom) / S.y,
955
+ left: (h.left - D.left + v.left) / S.x,
956
+ right: (D.right - h.right + v.right) / S.x
957
+ };
958
+ }
959
+ const No = 50, Oo = async (e, t, n) => {
960
+ const {
961
+ placement: r = "bottom",
962
+ strategy: o = "absolute",
963
+ middleware: s = [],
964
+ platform: i
965
+ } = n, l = i.detectOverflow ? i : {
966
+ ...i,
967
+ detectOverflow: ko
968
+ }, a = await (i.isRTL == null ? void 0 : i.isRTL(t));
969
+ let c = await i.getElementRects({
970
+ reference: e,
971
+ floating: t,
972
+ strategy: o
973
+ }), {
974
+ x: f,
975
+ y: d
976
+ } = fn(c, r, a), p = r, u = 0;
977
+ const v = {};
978
+ for (let m = 0; m < s.length; m++) {
979
+ const y = s[m];
980
+ if (!y)
981
+ continue;
982
+ const {
983
+ name: h,
984
+ fn: x
985
+ } = y, {
986
+ x: E,
987
+ y: S,
988
+ data: D,
989
+ reset: A
990
+ } = await x({
991
+ x: f,
992
+ y: d,
993
+ initialPlacement: r,
994
+ placement: p,
995
+ strategy: o,
996
+ middlewareData: v,
997
+ rects: c,
998
+ platform: l,
999
+ elements: {
1000
+ reference: e,
1001
+ floating: t
1002
+ }
1003
+ });
1004
+ f = E ?? f, d = S ?? d, v[h] = {
1005
+ ...v[h],
1006
+ ...D
1007
+ }, A && u < No && (u++, typeof A == "object" && (A.placement && (p = A.placement), A.rects && (c = A.rects === !0 ? await i.getElementRects({
1008
+ reference: e,
1009
+ floating: t,
1010
+ strategy: o
1011
+ }) : A.rects), {
1012
+ x: f,
1013
+ y: d
1014
+ } = fn(c, p, a)), m = -1);
1015
+ }
1016
+ return {
1017
+ x: f,
1018
+ y: d,
1019
+ placement: p,
1020
+ strategy: o,
1021
+ middlewareData: v
1022
+ };
1023
+ }, Io = (e) => ({
1024
+ name: "arrow",
1025
+ options: e,
1026
+ async fn(t) {
1027
+ const {
1028
+ x: n,
1029
+ y: r,
1030
+ placement: o,
1031
+ rects: s,
1032
+ platform: i,
1033
+ elements: l,
1034
+ middlewareData: a
1035
+ } = t, {
1036
+ element: c,
1037
+ padding: f = 0
1038
+ } = Xe(e, t) || {};
1039
+ if (c == null)
1040
+ return {};
1041
+ const d = _n(f), p = {
1042
+ x: n,
1043
+ y: r
1044
+ }, u = Xt(o), v = Ut(u), m = await i.getDimensions(c), y = u === "y", h = y ? "top" : "left", x = y ? "bottom" : "right", E = y ? "clientHeight" : "clientWidth", S = s.reference[v] + s.reference[u] - p[u] - s.floating[v], D = p[u] - s.reference[u], A = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c));
1045
+ let N = A ? A[E] : 0;
1046
+ (!N || !await (i.isElement == null ? void 0 : i.isElement(A))) && (N = l.floating[E] || s.floating[v]);
1047
+ const R = S / 2 - D / 2, C = N / 2 - m[v] / 2 - 1, I = Ie(d[h], C), $ = Ie(d[x], C), _ = I, M = N - m[v] - $, w = N / 2 - m[v] / 2 + R, O = Ct(_, w, M), F = !a.arrow && ze(o) != null && w !== O && s.reference[v] / 2 - (w < _ ? I : $) - m[v] / 2 < 0, L = F ? w < _ ? w - _ : w - M : 0;
1048
+ return {
1049
+ [u]: p[u] + L,
1050
+ data: {
1051
+ [u]: O,
1052
+ centerOffset: w - O - L,
1053
+ ...F && {
1054
+ alignmentOffset: L
1055
+ }
1056
+ },
1057
+ reset: F
1058
+ };
1059
+ }
1060
+ }), Co = function(e) {
1061
+ return e === void 0 && (e = {}), {
1062
+ name: "flip",
1063
+ options: e,
1064
+ async fn(t) {
1065
+ var n, r;
1066
+ const {
1067
+ placement: o,
1068
+ middlewareData: s,
1069
+ rects: i,
1070
+ initialPlacement: l,
1071
+ platform: a,
1072
+ elements: c
1073
+ } = t, {
1074
+ mainAxis: f = !0,
1075
+ crossAxis: d = !0,
1076
+ fallbackPlacements: p,
1077
+ fallbackStrategy: u = "bestFit",
1078
+ fallbackAxisSideDirection: v = "none",
1079
+ flipAlignment: m = !0,
1080
+ ...y
1081
+ } = Xe(e, t);
1082
+ if ((n = s.arrow) != null && n.alignmentOffset)
1083
+ return {};
1084
+ const h = Me(o), x = be(l), E = Me(l) === l, S = await (a.isRTL == null ? void 0 : a.isRTL(c.floating)), D = p || (E || !m ? [ot(l)] : Kr(l)), A = v !== "none";
1085
+ !p && A && D.push(...zr(l, m, v, S));
1086
+ const N = [l, ...D], R = await a.detectOverflow(t, y), C = [];
1087
+ let I = ((r = s.flip) == null ? void 0 : r.overflows) || [];
1088
+ if (f && C.push(R[h]), d) {
1089
+ const w = Hr(o, i, S);
1090
+ C.push(R[w[0]], R[w[1]]);
1091
+ }
1092
+ if (I = [...I, {
1093
+ placement: o,
1094
+ overflows: C
1095
+ }], !C.every((w) => w <= 0)) {
1096
+ var $, _;
1097
+ const w = ((($ = s.flip) == null ? void 0 : $.index) || 0) + 1, O = N[w];
1098
+ if (O && (!(d === "alignment" ? x !== be(O) : !1) || // We leave the current main axis only if every placement on that axis
1099
+ // overflows the main axis.
1100
+ I.every((b) => be(b.placement) === x ? b.overflows[0] > 0 : !0)))
1101
+ return {
1102
+ data: {
1103
+ index: w,
1104
+ overflows: I
1105
+ },
1106
+ reset: {
1107
+ placement: O
1108
+ }
1109
+ };
1110
+ let F = (_ = I.filter((L) => L.overflows[0] <= 0).sort((L, b) => L.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _.placement;
1111
+ if (!F)
1112
+ switch (u) {
1113
+ case "bestFit": {
1114
+ var M;
1115
+ const L = (M = I.filter((b) => {
1116
+ if (A) {
1117
+ const k = be(b.placement);
1118
+ return k === x || // Create a bias to the `y` side axis due to horizontal
1119
+ // reading directions favoring greater width.
1120
+ k === "y";
1121
+ }
1122
+ return !0;
1123
+ }).map((b) => [b.placement, b.overflows.filter((k) => k > 0).reduce((k, P) => k + P, 0)]).sort((b, k) => b[1] - k[1])[0]) == null ? void 0 : M[0];
1124
+ L && (F = L);
1125
+ break;
1126
+ }
1127
+ case "initialPlacement":
1128
+ F = l;
1129
+ break;
1130
+ }
1131
+ if (o !== F)
1132
+ return {
1133
+ reset: {
1134
+ placement: F
1135
+ }
1136
+ };
1137
+ }
1138
+ return {};
1139
+ }
1140
+ };
1141
+ }, Fo = /* @__PURE__ */ new Set(["left", "top"]);
1142
+ async function Yo(e, t) {
1143
+ const {
1144
+ placement: n,
1145
+ platform: r,
1146
+ elements: o
1147
+ } = e, s = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), i = Me(n), l = ze(n), a = be(n) === "y", c = Fo.has(i) ? -1 : 1, f = s && a ? -1 : 1, d = Xe(t, e);
1148
+ let {
1149
+ mainAxis: p,
1150
+ crossAxis: u,
1151
+ alignmentAxis: v
1152
+ } = typeof d == "number" ? {
1153
+ mainAxis: d,
1154
+ crossAxis: 0,
1155
+ alignmentAxis: null
1156
+ } : {
1157
+ mainAxis: d.mainAxis || 0,
1158
+ crossAxis: d.crossAxis || 0,
1159
+ alignmentAxis: d.alignmentAxis
1160
+ };
1161
+ return l && typeof v == "number" && (u = l === "end" ? v * -1 : v), a ? {
1162
+ x: u * f,
1163
+ y: p * c
1164
+ } : {
1165
+ x: p * c,
1166
+ y: u * f
1167
+ };
1168
+ }
1169
+ const _o = function(e) {
1170
+ return e === void 0 && (e = 0), {
1171
+ name: "offset",
1172
+ options: e,
1173
+ async fn(t) {
1174
+ var n, r;
1175
+ const {
1176
+ x: o,
1177
+ y: s,
1178
+ placement: i,
1179
+ middlewareData: l
1180
+ } = t, a = await Yo(t, e);
1181
+ return i === ((n = l.offset) == null ? void 0 : n.placement) && (r = l.arrow) != null && r.alignmentOffset ? {} : {
1182
+ x: o + a.x,
1183
+ y: s + a.y,
1184
+ data: {
1185
+ ...a,
1186
+ placement: i
1187
+ }
1188
+ };
1189
+ }
1190
+ };
1191
+ }, Bo = function(e) {
1192
+ return e === void 0 && (e = {}), {
1193
+ name: "shift",
1194
+ options: e,
1195
+ async fn(t) {
1196
+ const {
1197
+ x: n,
1198
+ y: r,
1199
+ placement: o,
1200
+ platform: s
1201
+ } = t, {
1202
+ mainAxis: i = !0,
1203
+ crossAxis: l = !1,
1204
+ limiter: a = {
1205
+ fn: (h) => {
1206
+ let {
1207
+ x,
1208
+ y: E
1209
+ } = h;
1210
+ return {
1211
+ x,
1212
+ y: E
1213
+ };
1214
+ }
1215
+ },
1216
+ ...c
1217
+ } = Xe(e, t), f = {
1218
+ x: n,
1219
+ y: r
1220
+ }, d = await s.detectOverflow(t, c), p = be(Me(o)), u = Yn(p);
1221
+ let v = f[u], m = f[p];
1222
+ if (i) {
1223
+ const h = u === "y" ? "top" : "left", x = u === "y" ? "bottom" : "right", E = v + d[h], S = v - d[x];
1224
+ v = Ct(E, v, S);
1225
+ }
1226
+ if (l) {
1227
+ const h = p === "y" ? "top" : "left", x = p === "y" ? "bottom" : "right", E = m + d[h], S = m - d[x];
1228
+ m = Ct(E, m, S);
1229
+ }
1230
+ const y = a.fn({
1231
+ ...t,
1232
+ [u]: v,
1233
+ [p]: m
1234
+ });
1235
+ return {
1236
+ ...y,
1237
+ data: {
1238
+ x: y.x - n,
1239
+ y: y.y - r,
1240
+ enabled: {
1241
+ [u]: i,
1242
+ [p]: l
1243
+ }
1244
+ }
1245
+ };
1246
+ }
1247
+ };
1248
+ };
1249
+ function zn(e) {
1250
+ const t = ne(e);
1251
+ let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
1252
+ const o = ie(e), s = o ? e.offsetWidth : n, i = o ? e.offsetHeight : r, l = rt(n) !== s || rt(r) !== i;
1253
+ return l && (n = s, r = i), {
1254
+ width: n,
1255
+ height: r,
1256
+ $: l
1257
+ };
1258
+ }
1259
+ function zt(e) {
1260
+ return U(e) ? e : e.contextElement;
1261
+ }
1262
+ function Oe(e) {
1263
+ const t = zt(e);
1264
+ if (!ie(t))
1265
+ return de(1);
1266
+ const n = t.getBoundingClientRect(), {
1267
+ width: r,
1268
+ height: o,
1269
+ $: s
1270
+ } = zn(t);
1271
+ let i = (s ? rt(n.width) : n.width) / r, l = (s ? rt(n.height) : n.height) / o;
1272
+ return (!i || !Number.isFinite(i)) && (i = 1), (!l || !Number.isFinite(l)) && (l = 1), {
1273
+ x: i,
1274
+ y: l
1275
+ };
1276
+ }
1277
+ const $o = /* @__PURE__ */ de(0);
1278
+ function qn(e) {
1279
+ const t = te(e);
1280
+ return !ft() || !t.visualViewport ? $o : {
1281
+ x: t.visualViewport.offsetLeft,
1282
+ y: t.visualViewport.offsetTop
1283
+ };
1284
+ }
1285
+ function Vo(e, t, n) {
1286
+ return t === void 0 && (t = !1), !n || t && n !== te(e) ? !1 : t;
1287
+ }
1288
+ function Le(e, t, n, r) {
1289
+ t === void 0 && (t = !1), n === void 0 && (n = !1);
1290
+ const o = e.getBoundingClientRect(), s = zt(e);
1291
+ let i = de(1);
1292
+ t && (r ? U(r) && (i = Oe(r)) : i = Oe(e));
1293
+ const l = Vo(s, n, r) ? qn(s) : de(0);
1294
+ let a = (o.left + l.x) / i.x, c = (o.top + l.y) / i.y, f = o.width / i.x, d = o.height / i.y;
1295
+ if (s) {
1296
+ const p = te(s), u = r && U(r) ? te(r) : r;
1297
+ let v = p, m = It(v);
1298
+ for (; m && r && u !== v; ) {
1299
+ const y = Oe(m), h = m.getBoundingClientRect(), x = ne(m), E = h.left + (m.clientLeft + parseFloat(x.paddingLeft)) * y.x, S = h.top + (m.clientTop + parseFloat(x.paddingTop)) * y.y;
1300
+ a *= y.x, c *= y.y, f *= y.x, d *= y.y, a += E, c += S, v = te(m), m = It(v);
1301
+ }
1302
+ }
1303
+ return it({
1304
+ width: f,
1305
+ height: d,
1306
+ x: a,
1307
+ y: c
1308
+ });
1309
+ }
1310
+ function pt(e, t) {
1311
+ const n = dt(e).scrollLeft;
1312
+ return t ? t.left + n : Le(pe(e)).left + n;
1313
+ }
1314
+ function Gn(e, t) {
1315
+ const n = e.getBoundingClientRect(), r = n.left + t.scrollLeft - pt(e, n), o = n.top + t.scrollTop;
1316
+ return {
1317
+ x: r,
1318
+ y: o
1319
+ };
1320
+ }
1321
+ function Wo(e) {
1322
+ let {
1323
+ elements: t,
1324
+ rect: n,
1325
+ offsetParent: r,
1326
+ strategy: o
1327
+ } = e;
1328
+ const s = o === "fixed", i = pe(r), l = t ? ut(t.floating) : !1;
1329
+ if (r === i || l && s)
1330
+ return n;
1331
+ let a = {
1332
+ scrollLeft: 0,
1333
+ scrollTop: 0
1334
+ }, c = de(1);
1335
+ const f = de(0), d = ie(r);
1336
+ if ((d || !d && !s) && ((Fe(r) !== "body" || Ue(i)) && (a = dt(r)), d)) {
1337
+ const u = Le(r);
1338
+ c = Oe(r), f.x = u.x + r.clientLeft, f.y = u.y + r.clientTop;
1339
+ }
1340
+ const p = i && !d && !s ? Gn(i, a) : de(0);
1341
+ return {
1342
+ width: n.width * c.x,
1343
+ height: n.height * c.y,
1344
+ x: n.x * c.x - a.scrollLeft * c.x + f.x + p.x,
1345
+ y: n.y * c.y - a.scrollTop * c.y + f.y + p.y
1346
+ };
1347
+ }
1348
+ function Ho(e) {
1349
+ return Array.from(e.getClientRects());
1350
+ }
1351
+ function Ko(e) {
1352
+ const t = pe(e), n = dt(e), r = e.ownerDocument.body, o = Se(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), s = Se(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
1353
+ let i = -n.scrollLeft + pt(e);
1354
+ const l = -n.scrollTop;
1355
+ return ne(r).direction === "rtl" && (i += Se(t.clientWidth, r.clientWidth) - o), {
1356
+ width: o,
1357
+ height: s,
1358
+ x: i,
1359
+ y: l
1360
+ };
1361
+ }
1362
+ const dn = 25;
1363
+ function jo(e, t) {
1364
+ const n = te(e), r = pe(e), o = n.visualViewport;
1365
+ let s = r.clientWidth, i = r.clientHeight, l = 0, a = 0;
1366
+ if (o) {
1367
+ s = o.width, i = o.height;
1368
+ const f = ft();
1369
+ (!f || f && t === "fixed") && (l = o.offsetLeft, a = o.offsetTop);
1370
+ }
1371
+ const c = pt(r);
1372
+ if (c <= 0) {
1373
+ const f = r.ownerDocument, d = f.body, p = getComputedStyle(d), u = f.compatMode === "CSS1Compat" && parseFloat(p.marginLeft) + parseFloat(p.marginRight) || 0, v = Math.abs(r.clientWidth - d.clientWidth - u);
1374
+ v <= dn && (s -= v);
1375
+ } else c <= dn && (s += c);
1376
+ return {
1377
+ width: s,
1378
+ height: i,
1379
+ x: l,
1380
+ y: a
1381
+ };
1382
+ }
1383
+ function Uo(e, t) {
1384
+ const n = Le(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, s = ie(e) ? Oe(e) : de(1), i = e.clientWidth * s.x, l = e.clientHeight * s.y, a = o * s.x, c = r * s.y;
1385
+ return {
1386
+ width: i,
1387
+ height: l,
1388
+ x: a,
1389
+ y: c
1390
+ };
1391
+ }
1392
+ function pn(e, t, n) {
1393
+ let r;
1394
+ if (t === "viewport")
1395
+ r = jo(e, n);
1396
+ else if (t === "document")
1397
+ r = Ko(pe(e));
1398
+ else if (U(t))
1399
+ r = Uo(t, n);
1400
+ else {
1401
+ const o = qn(e);
1402
+ r = {
1403
+ x: t.x - o.x,
1404
+ y: t.y - o.y,
1405
+ width: t.width,
1406
+ height: t.height
1407
+ };
1408
+ }
1409
+ return it(r);
1410
+ }
1411
+ function Zn(e, t) {
1412
+ const n = ge(e);
1413
+ return n === t || !U(n) || he(n) ? !1 : ne(n).position === "fixed" || Zn(n, t);
1414
+ }
1415
+ function Xo(e, t) {
1416
+ const n = t.get(e);
1417
+ if (n)
1418
+ return n;
1419
+ let r = we(e, [], !1).filter((l) => U(l) && Fe(l) !== "body"), o = null;
1420
+ const s = ne(e).position === "fixed";
1421
+ let i = s ? ge(e) : e;
1422
+ for (; U(i) && !he(i); ) {
1423
+ const l = ne(i), a = jt(i);
1424
+ !a && l.position === "fixed" && (o = null), (s ? !a && !o : !a && l.position === "static" && !!o && (o.position === "absolute" || o.position === "fixed") || Ue(i) && !a && Zn(e, i)) ? r = r.filter((f) => f !== i) : o = l, i = ge(i);
1425
+ }
1426
+ return t.set(e, r), r;
1427
+ }
1428
+ function zo(e) {
1429
+ let {
1430
+ element: t,
1431
+ boundary: n,
1432
+ rootBoundary: r,
1433
+ strategy: o
1434
+ } = e;
1435
+ const i = [...n === "clippingAncestors" ? ut(t) ? [] : Xo(t, this._c) : [].concat(n), r], l = pn(t, i[0], o);
1436
+ let a = l.top, c = l.right, f = l.bottom, d = l.left;
1437
+ for (let p = 1; p < i.length; p++) {
1438
+ const u = pn(t, i[p], o);
1439
+ a = Se(u.top, a), c = Ie(u.right, c), f = Ie(u.bottom, f), d = Se(u.left, d);
1440
+ }
1441
+ return {
1442
+ width: c - d,
1443
+ height: f - a,
1444
+ x: d,
1445
+ y: a
1446
+ };
1447
+ }
1448
+ function qo(e) {
1449
+ const {
1450
+ width: t,
1451
+ height: n
1452
+ } = zn(e);
1453
+ return {
1454
+ width: t,
1455
+ height: n
1456
+ };
1457
+ }
1458
+ function Go(e, t, n) {
1459
+ const r = ie(t), o = pe(t), s = n === "fixed", i = Le(e, !0, s, t);
1460
+ let l = {
1461
+ scrollLeft: 0,
1462
+ scrollTop: 0
1463
+ };
1464
+ const a = de(0);
1465
+ function c() {
1466
+ a.x = pt(o);
1467
+ }
1468
+ if (r || !r && !s)
1469
+ if ((Fe(t) !== "body" || Ue(o)) && (l = dt(t)), r) {
1470
+ const u = Le(t, !0, s, t);
1471
+ a.x = u.x + t.clientLeft, a.y = u.y + t.clientTop;
1472
+ } else o && c();
1473
+ s && !r && o && c();
1474
+ const f = o && !r && !s ? Gn(o, l) : de(0), d = i.left + l.scrollLeft - a.x - f.x, p = i.top + l.scrollTop - a.y - f.y;
1475
+ return {
1476
+ x: d,
1477
+ y: p,
1478
+ width: i.width,
1479
+ height: i.height
1480
+ };
1481
+ }
1482
+ function Lt(e) {
1483
+ return ne(e).position === "static";
1484
+ }
1485
+ function mn(e, t) {
1486
+ if (!ie(e) || ne(e).position === "fixed")
1487
+ return null;
1488
+ if (t)
1489
+ return t(e);
1490
+ let n = e.offsetParent;
1491
+ return pe(e) === n && (n = n.ownerDocument.body), n;
1492
+ }
1493
+ function Jn(e, t) {
1494
+ const n = te(e);
1495
+ if (ut(e))
1496
+ return n;
1497
+ if (!ie(e)) {
1498
+ let o = ge(e);
1499
+ for (; o && !he(o); ) {
1500
+ if (U(o) && !Lt(o))
1501
+ return o;
1502
+ o = ge(o);
1503
+ }
1504
+ return n;
1505
+ }
1506
+ let r = mn(e, t);
1507
+ for (; r && _r(r) && Lt(r); )
1508
+ r = mn(r, t);
1509
+ return r && he(r) && Lt(r) && !jt(r) ? n : r || Vr(e) || n;
1510
+ }
1511
+ const Zo = async function(e) {
1512
+ const t = this.getOffsetParent || Jn, n = this.getDimensions, r = await n(e.floating);
1513
+ return {
1514
+ reference: Go(e.reference, await t(e.floating), e.strategy),
1515
+ floating: {
1516
+ x: 0,
1517
+ y: 0,
1518
+ width: r.width,
1519
+ height: r.height
1520
+ }
1521
+ };
1522
+ };
1523
+ function Jo(e) {
1524
+ return ne(e).direction === "rtl";
1525
+ }
1526
+ const Qo = {
1527
+ convertOffsetParentRelativeRectToViewportRelativeRect: Wo,
1528
+ getDocumentElement: pe,
1529
+ getClippingRect: zo,
1530
+ getOffsetParent: Jn,
1531
+ getElementRects: Zo,
1532
+ getClientRects: Ho,
1533
+ getDimensions: qo,
1534
+ getScale: Oe,
1535
+ isElement: U,
1536
+ isRTL: Jo
1537
+ };
1538
+ function Qn(e, t) {
1539
+ return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1540
+ }
1541
+ function ei(e, t) {
1542
+ let n = null, r;
1543
+ const o = pe(e);
1544
+ function s() {
1545
+ var l;
1546
+ clearTimeout(r), (l = n) == null || l.disconnect(), n = null;
1547
+ }
1548
+ function i(l, a) {
1549
+ l === void 0 && (l = !1), a === void 0 && (a = 1), s();
1550
+ const c = e.getBoundingClientRect(), {
1551
+ left: f,
1552
+ top: d,
1553
+ width: p,
1554
+ height: u
1555
+ } = c;
1556
+ if (l || t(), !p || !u)
1557
+ return;
1558
+ const v = Je(d), m = Je(o.clientWidth - (f + p)), y = Je(o.clientHeight - (d + u)), h = Je(f), E = {
1559
+ rootMargin: -v + "px " + -m + "px " + -y + "px " + -h + "px",
1560
+ threshold: Se(0, Ie(1, a)) || 1
1561
+ };
1562
+ let S = !0;
1563
+ function D(A) {
1564
+ const N = A[0].intersectionRatio;
1565
+ if (N !== a) {
1566
+ if (!S)
1567
+ return i();
1568
+ N ? i(!1, N) : r = setTimeout(() => {
1569
+ i(!1, 1e-7);
1570
+ }, 1e3);
1571
+ }
1572
+ N === 1 && !Qn(c, e.getBoundingClientRect()) && i(), S = !1;
1573
+ }
1574
+ try {
1575
+ n = new IntersectionObserver(D, {
1576
+ ...E,
1577
+ // Handle <iframe>s
1578
+ root: o.ownerDocument
1579
+ });
1580
+ } catch {
1581
+ n = new IntersectionObserver(D, E);
1582
+ }
1583
+ n.observe(e);
1584
+ }
1585
+ return i(!0), s;
1586
+ }
1587
+ function ti(e, t, n, r) {
1588
+ r === void 0 && (r = {});
1589
+ const {
1590
+ ancestorScroll: o = !0,
1591
+ ancestorResize: s = !0,
1592
+ elementResize: i = typeof ResizeObserver == "function",
1593
+ layoutShift: l = typeof IntersectionObserver == "function",
1594
+ animationFrame: a = !1
1595
+ } = r, c = zt(e), f = o || s ? [...c ? we(c) : [], ...t ? we(t) : []] : [];
1596
+ f.forEach((h) => {
1597
+ o && h.addEventListener("scroll", n, {
1598
+ passive: !0
1599
+ }), s && h.addEventListener("resize", n);
1600
+ });
1601
+ const d = c && l ? ei(c, n) : null;
1602
+ let p = -1, u = null;
1603
+ i && (u = new ResizeObserver((h) => {
1604
+ let [x] = h;
1605
+ x && x.target === c && u && t && (u.unobserve(t), cancelAnimationFrame(p), p = requestAnimationFrame(() => {
1606
+ var E;
1607
+ (E = u) == null || E.observe(t);
1608
+ })), n();
1609
+ }), c && !a && u.observe(c), t && u.observe(t));
1610
+ let v, m = a ? Le(e) : null;
1611
+ a && y();
1612
+ function y() {
1613
+ const h = Le(e);
1614
+ m && !Qn(m, h) && n(), m = h, v = requestAnimationFrame(y);
1615
+ }
1616
+ return n(), () => {
1617
+ var h;
1618
+ f.forEach((x) => {
1619
+ o && x.removeEventListener("scroll", n), s && x.removeEventListener("resize", n);
1620
+ }), d == null || d(), (h = u) == null || h.disconnect(), u = null, a && cancelAnimationFrame(v);
1621
+ };
1622
+ }
1623
+ const ni = _o, ri = Bo, oi = Co, vn = Io, ii = (e, t, n) => {
1624
+ const r = /* @__PURE__ */ new Map(), o = {
1625
+ platform: Qo,
1626
+ ...n
1627
+ }, s = {
1628
+ ...o.platform,
1629
+ _c: r
1630
+ };
1631
+ return Oo(e, t, {
1632
+ ...o,
1633
+ platform: s
1634
+ });
1635
+ };
1636
+ var si = typeof document < "u", li = function() {
1637
+ }, tt = si ? Mn : li;
1638
+ function ct(e, t) {
1639
+ if (e === t)
1640
+ return !0;
1641
+ if (typeof e != typeof t)
1642
+ return !1;
1643
+ if (typeof e == "function" && e.toString() === t.toString())
1644
+ return !0;
1645
+ let n, r, o;
1646
+ if (e && t && typeof e == "object") {
1647
+ if (Array.isArray(e)) {
1648
+ if (n = e.length, n !== t.length) return !1;
1649
+ for (r = n; r-- !== 0; )
1650
+ if (!ct(e[r], t[r]))
1651
+ return !1;
1652
+ return !0;
1653
+ }
1654
+ if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1655
+ return !1;
1656
+ for (r = n; r-- !== 0; )
1657
+ if (!{}.hasOwnProperty.call(t, o[r]))
1658
+ return !1;
1659
+ for (r = n; r-- !== 0; ) {
1660
+ const s = o[r];
1661
+ if (!(s === "_owner" && e.$$typeof) && !ct(e[s], t[s]))
1662
+ return !1;
1663
+ }
1664
+ return !0;
1665
+ }
1666
+ return e !== e && t !== t;
1667
+ }
1668
+ function er(e) {
1669
+ return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1670
+ }
1671
+ function hn(e, t) {
1672
+ const n = er(e);
1673
+ return Math.round(t * n) / n;
1674
+ }
1675
+ function Tt(e) {
1676
+ const t = g.useRef(e);
1677
+ return tt(() => {
1678
+ t.current = e;
1679
+ }), t;
1680
+ }
1681
+ function ci(e) {
1682
+ e === void 0 && (e = {});
1683
+ const {
1684
+ placement: t = "bottom",
1685
+ strategy: n = "absolute",
1686
+ middleware: r = [],
1687
+ platform: o,
1688
+ elements: {
1689
+ reference: s,
1690
+ floating: i
1691
+ } = {},
1692
+ transform: l = !0,
1693
+ whileElementsMounted: a,
1694
+ open: c
1695
+ } = e, [f, d] = g.useState({
1696
+ x: 0,
1697
+ y: 0,
1698
+ strategy: n,
1699
+ placement: t,
1700
+ middlewareData: {},
1701
+ isPositioned: !1
1702
+ }), [p, u] = g.useState(r);
1703
+ ct(p, r) || u(r);
1704
+ const [v, m] = g.useState(null), [y, h] = g.useState(null), x = g.useCallback((b) => {
1705
+ b !== A.current && (A.current = b, m(b));
1706
+ }, []), E = g.useCallback((b) => {
1707
+ b !== N.current && (N.current = b, h(b));
1708
+ }, []), S = s || v, D = i || y, A = g.useRef(null), N = g.useRef(null), R = g.useRef(f), C = a != null, I = Tt(a), $ = Tt(o), _ = Tt(c), M = g.useCallback(() => {
1709
+ if (!A.current || !N.current)
1710
+ return;
1711
+ const b = {
1712
+ placement: t,
1713
+ strategy: n,
1714
+ middleware: p
1715
+ };
1716
+ $.current && (b.platform = $.current), ii(A.current, N.current, b).then((k) => {
1717
+ const P = {
1718
+ ...k,
1719
+ // The floating element's position may be recomputed while it's closed
1720
+ // but still mounted (such as when transitioning out). To ensure
1721
+ // `isPositioned` will be `false` initially on the next open, avoid
1722
+ // setting it to `true` when `open === false` (must be specified).
1723
+ isPositioned: _.current !== !1
1724
+ };
1725
+ w.current && !ct(R.current, P) && (R.current = P, Ln.flushSync(() => {
1726
+ d(P);
1727
+ }));
1728
+ });
1729
+ }, [p, t, n, $, _]);
1730
+ tt(() => {
1731
+ c === !1 && R.current.isPositioned && (R.current.isPositioned = !1, d((b) => ({
1732
+ ...b,
1733
+ isPositioned: !1
1734
+ })));
1735
+ }, [c]);
1736
+ const w = g.useRef(!1);
1737
+ tt(() => (w.current = !0, () => {
1738
+ w.current = !1;
1739
+ }), []), tt(() => {
1740
+ if (S && (A.current = S), D && (N.current = D), S && D) {
1741
+ if (I.current)
1742
+ return I.current(S, D, M);
1743
+ M();
1744
+ }
1745
+ }, [S, D, M, I, C]);
1746
+ const O = g.useMemo(() => ({
1747
+ reference: A,
1748
+ floating: N,
1749
+ setReference: x,
1750
+ setFloating: E
1751
+ }), [x, E]), F = g.useMemo(() => ({
1752
+ reference: S,
1753
+ floating: D
1754
+ }), [S, D]), L = g.useMemo(() => {
1755
+ const b = {
1756
+ position: n,
1757
+ left: 0,
1758
+ top: 0
1759
+ };
1760
+ if (!F.floating)
1761
+ return b;
1762
+ const k = hn(F.floating, f.x), P = hn(F.floating, f.y);
1763
+ return l ? {
1764
+ ...b,
1765
+ transform: "translate(" + k + "px, " + P + "px)",
1766
+ ...er(F.floating) >= 1.5 && {
1767
+ willChange: "transform"
1768
+ }
1769
+ } : {
1770
+ position: n,
1771
+ left: k,
1772
+ top: P
1773
+ };
1774
+ }, [n, l, F.floating, f.x, f.y]);
1775
+ return g.useMemo(() => ({
1776
+ ...f,
1777
+ update: M,
1778
+ refs: O,
1779
+ elements: F,
1780
+ floatingStyles: L
1781
+ }), [f, M, O, F, L]);
1782
+ }
1783
+ const ai = (e) => {
1784
+ function t(n) {
1785
+ return {}.hasOwnProperty.call(n, "current");
1786
+ }
1787
+ return {
1788
+ name: "arrow",
1789
+ options: e,
1790
+ fn(n) {
1791
+ const {
1792
+ element: r,
1793
+ padding: o
1794
+ } = typeof e == "function" ? e(n) : e;
1795
+ return r && t(r) ? r.current != null ? vn({
1796
+ element: r.current,
1797
+ padding: o
1798
+ }).fn(n) : {} : r ? vn({
1799
+ element: r,
1800
+ padding: o
1801
+ }).fn(n) : {};
1802
+ }
1803
+ };
1804
+ }, ui = (e, t) => {
1805
+ const n = ni(e);
1806
+ return {
1807
+ name: n.name,
1808
+ fn: n.fn,
1809
+ options: [e, t]
1810
+ };
1811
+ }, fi = (e, t) => {
1812
+ const n = ri(e);
1813
+ return {
1814
+ name: n.name,
1815
+ fn: n.fn,
1816
+ options: [e, t]
1817
+ };
1818
+ }, di = (e, t) => {
1819
+ const n = oi(e);
1820
+ return {
1821
+ name: n.name,
1822
+ fn: n.fn,
1823
+ options: [e, t]
1824
+ };
1825
+ }, pi = (e, t) => {
1826
+ const n = ai(e);
1827
+ return {
1828
+ name: n.name,
1829
+ fn: n.fn,
1830
+ options: [e, t]
1831
+ };
1832
+ };
1833
+ function mi(e) {
1834
+ const t = g.useRef(void 0), n = g.useCallback((r) => {
1835
+ const o = e.map((s) => {
1836
+ if (s != null) {
1837
+ if (typeof s == "function") {
1838
+ const i = s, l = i(r);
1839
+ return typeof l == "function" ? l : () => {
1840
+ i(null);
1841
+ };
1842
+ }
1843
+ return s.current = r, () => {
1844
+ s.current = null;
1845
+ };
1846
+ }
1847
+ });
1848
+ return () => {
1849
+ o.forEach((s) => s == null ? void 0 : s());
1850
+ };
1851
+ }, e);
1852
+ return g.useMemo(() => e.every((r) => r == null) ? null : (r) => {
1853
+ t.current && (t.current(), t.current = void 0), r != null && (t.current = n(r));
1854
+ }, e);
1855
+ }
1856
+ const vi = "data-floating-ui-focusable", gn = "active", yn = "selected", hi = {
1857
+ ...g
1858
+ };
1859
+ let bn = !1, gi = 0;
1860
+ const wn = () => (
1861
+ // Ensure the id is unique with multiple independent versions of Floating UI
1862
+ // on <React 18
1863
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + gi++
1864
+ );
1865
+ function yi() {
1866
+ const [e, t] = g.useState(() => bn ? wn() : void 0);
1867
+ return le(() => {
1868
+ e == null && t(wn());
1869
+ }, []), g.useEffect(() => {
1870
+ bn = !0;
1871
+ }, []), e;
1872
+ }
1873
+ const bi = hi.useId, mt = bi || yi;
1874
+ let je;
1875
+ process.env.NODE_ENV !== "production" && (je = /* @__PURE__ */ new Set());
1876
+ function wi() {
1877
+ for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1878
+ n[r] = arguments[r];
1879
+ const o = "Floating UI: " + n.join(" ");
1880
+ if (!((e = je) != null && e.has(o))) {
1881
+ var s;
1882
+ (s = je) == null || s.add(o), console.warn(o);
1883
+ }
1884
+ }
1885
+ function xi() {
1886
+ for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)
1887
+ n[r] = arguments[r];
1888
+ const o = "Floating UI: " + n.join(" ");
1889
+ if (!((e = je) != null && e.has(o))) {
1890
+ var s;
1891
+ (s = je) == null || s.add(o), console.error(o);
1892
+ }
1893
+ }
1894
+ const Ei = /* @__PURE__ */ g.forwardRef(function(t, n) {
1895
+ const {
1896
+ context: {
1897
+ placement: r,
1898
+ elements: {
1899
+ floating: o
1900
+ },
1901
+ middlewareData: {
1902
+ arrow: s,
1903
+ shift: i
1904
+ }
1905
+ },
1906
+ width: l = 14,
1907
+ height: a = 7,
1908
+ tipRadius: c = 0,
1909
+ strokeWidth: f = 0,
1910
+ staticOffset: d,
1911
+ stroke: p,
1912
+ d: u,
1913
+ style: {
1914
+ transform: v,
1915
+ ...m
1916
+ } = {},
1917
+ ...y
1918
+ } = t;
1919
+ process.env.NODE_ENV !== "production" && (n || wi("The `ref` prop is required for `FloatingArrow`."));
1920
+ const h = mt(), [x, E] = g.useState(!1);
1921
+ if (le(() => {
1922
+ if (!o) return;
1923
+ ne(o).direction === "rtl" && E(!0);
1924
+ }, [o]), !o)
1925
+ return null;
1926
+ const [S, D] = r.split("-"), A = S === "top" || S === "bottom";
1927
+ let N = d;
1928
+ (A && i != null && i.x || !A && i != null && i.y) && (N = null);
1929
+ const R = f * 2, C = R / 2, I = l / 2 * (c / -8 + 1), $ = a / 2 * c / 4, _ = !!u, M = N && D === "end" ? "bottom" : "top";
1930
+ let w = N && D === "end" ? "right" : "left";
1931
+ N && x && (w = D === "end" ? "left" : "right");
1932
+ const O = (s == null ? void 0 : s.x) != null ? N || s.x : "", F = (s == null ? void 0 : s.y) != null ? N || s.y : "", L = u || "M0,0" + (" H" + l) + (" L" + (l - I) + "," + (a - $)) + (" Q" + l / 2 + "," + a + " " + I + "," + (a - $)) + " Z", b = {
1933
+ top: _ ? "rotate(180deg)" : "",
1934
+ left: _ ? "rotate(90deg)" : "rotate(-90deg)",
1935
+ bottom: _ ? "" : "rotate(180deg)",
1936
+ right: _ ? "rotate(-90deg)" : "rotate(90deg)"
1937
+ }[S];
1938
+ return /* @__PURE__ */ z("svg", {
1939
+ ...y,
1940
+ "aria-hidden": !0,
1941
+ ref: n,
1942
+ width: _ ? l : l + R,
1943
+ height: l,
1944
+ viewBox: "0 0 " + l + " " + (a > l ? a : l),
1945
+ style: {
1946
+ position: "absolute",
1947
+ pointerEvents: "none",
1948
+ [w]: O,
1949
+ [M]: F,
1950
+ [S]: A || _ ? "100%" : "calc(100% - " + R / 2 + "px)",
1951
+ transform: [b, v].filter((k) => !!k).join(" "),
1952
+ ...m
1953
+ },
1954
+ children: [R > 0 && /* @__PURE__ */ T("path", {
1955
+ clipPath: "url(#" + h + ")",
1956
+ fill: "none",
1957
+ stroke: p,
1958
+ strokeWidth: R + (u ? 0 : 1),
1959
+ d: L
1960
+ }), /* @__PURE__ */ T("path", {
1961
+ stroke: R && !u ? y.fill : "none",
1962
+ d: L
1963
+ }), /* @__PURE__ */ T("clipPath", {
1964
+ id: h,
1965
+ children: /* @__PURE__ */ T("rect", {
1966
+ x: -C,
1967
+ y: C * (_ ? -1 : 1),
1968
+ width: l + R,
1969
+ height: l
1970
+ })
1971
+ })]
1972
+ });
1973
+ });
1974
+ function Ri() {
1975
+ const e = /* @__PURE__ */ new Map();
1976
+ return {
1977
+ emit(t, n) {
1978
+ var r;
1979
+ (r = e.get(t)) == null || r.forEach((o) => o(n));
1980
+ },
1981
+ on(t, n) {
1982
+ e.has(t) || e.set(t, /* @__PURE__ */ new Set()), e.get(t).add(n);
1983
+ },
1984
+ off(t, n) {
1985
+ var r;
1986
+ (r = e.get(t)) == null || r.delete(n);
1987
+ }
1988
+ };
1989
+ }
1990
+ const Si = /* @__PURE__ */ g.createContext(null), Mi = /* @__PURE__ */ g.createContext(null), qt = () => {
1991
+ var e;
1992
+ return ((e = g.useContext(Si)) == null ? void 0 : e.id) || null;
1993
+ }, Gt = () => g.useContext(Mi);
1994
+ function qe(e) {
1995
+ return "data-floating-ui-" + e;
1996
+ }
1997
+ function re(e) {
1998
+ e.current !== -1 && (clearTimeout(e.current), e.current = -1);
1999
+ }
2000
+ const xn = /* @__PURE__ */ qe("safe-polygon");
2001
+ function Dt(e, t, n) {
2002
+ if (n && !$t(n))
2003
+ return 0;
2004
+ if (typeof e == "number")
2005
+ return e;
2006
+ if (typeof e == "function") {
2007
+ const r = e();
2008
+ return typeof r == "number" ? r : r == null ? void 0 : r[t];
2009
+ }
2010
+ return e == null ? void 0 : e[t];
2011
+ }
2012
+ function At(e) {
2013
+ return typeof e == "function" ? e() : e;
2014
+ }
2015
+ function Li(e, t) {
2016
+ t === void 0 && (t = {});
2017
+ const {
2018
+ open: n,
2019
+ onOpenChange: r,
2020
+ dataRef: o,
2021
+ events: s,
2022
+ elements: i
2023
+ } = e, {
2024
+ enabled: l = !0,
2025
+ delay: a = 0,
2026
+ handleClose: c = null,
2027
+ mouseOnly: f = !1,
2028
+ restMs: d = 0,
2029
+ move: p = !0
2030
+ } = t, u = Gt(), v = qt(), m = Qe(c), y = Qe(a), h = Qe(n), x = Qe(d), E = g.useRef(), S = g.useRef(-1), D = g.useRef(), A = g.useRef(-1), N = g.useRef(!0), R = g.useRef(!1), C = g.useRef(() => {
2031
+ }), I = g.useRef(!1), $ = ue(() => {
2032
+ var L;
2033
+ const b = (L = o.current.openEvent) == null ? void 0 : L.type;
2034
+ return (b == null ? void 0 : b.includes("mouse")) && b !== "mousedown";
2035
+ });
2036
+ g.useEffect(() => {
2037
+ if (!l) return;
2038
+ function L(b) {
2039
+ let {
2040
+ open: k
2041
+ } = b;
2042
+ k || (re(S), re(A), N.current = !0, I.current = !1);
2043
+ }
2044
+ return s.on("openchange", L), () => {
2045
+ s.off("openchange", L);
2046
+ };
2047
+ }, [l, s]), g.useEffect(() => {
2048
+ if (!l || !m.current || !n) return;
2049
+ function L(k) {
2050
+ $() && r(!1, k, "hover");
2051
+ }
2052
+ const b = fe(i.floating).documentElement;
2053
+ return b.addEventListener("mouseleave", L), () => {
2054
+ b.removeEventListener("mouseleave", L);
2055
+ };
2056
+ }, [i.floating, n, r, l, m, $]);
2057
+ const _ = g.useCallback(function(L, b, k) {
2058
+ b === void 0 && (b = !0), k === void 0 && (k = "hover");
2059
+ const P = Dt(y.current, "close", E.current);
2060
+ P && !D.current ? (re(S), S.current = window.setTimeout(() => r(!1, L, k), P)) : b && (re(S), r(!1, L, k));
2061
+ }, [y, r]), M = ue(() => {
2062
+ C.current(), D.current = void 0;
2063
+ }), w = ue(() => {
2064
+ if (R.current) {
2065
+ const L = fe(i.floating).body;
2066
+ L.style.pointerEvents = "", L.removeAttribute(xn), R.current = !1;
2067
+ }
2068
+ }), O = ue(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1);
2069
+ g.useEffect(() => {
2070
+ if (!l) return;
2071
+ function L(B) {
2072
+ if (re(S), N.current = !1, f && !$t(E.current) || At(x.current) > 0 && !Dt(y.current, "open"))
2073
+ return;
2074
+ const X = Dt(y.current, "open", E.current);
2075
+ X ? S.current = window.setTimeout(() => {
2076
+ h.current || r(!0, B, "hover");
2077
+ }, X) : n || r(!0, B, "hover");
2078
+ }
2079
+ function b(B) {
2080
+ if (O()) {
2081
+ w();
2082
+ return;
2083
+ }
2084
+ C.current();
2085
+ const X = fe(i.floating);
2086
+ if (re(A), I.current = !1, m.current && o.current.floatingContext) {
2087
+ n || re(S), D.current = m.current({
2088
+ ...o.current.floatingContext,
2089
+ tree: u,
2090
+ x: B.clientX,
2091
+ y: B.clientY,
2092
+ onClose() {
2093
+ w(), M(), O() || _(B, !0, "safe-polygon");
2094
+ }
2095
+ });
2096
+ const K = D.current;
2097
+ X.addEventListener("mousemove", K), C.current = () => {
2098
+ X.removeEventListener("mousemove", K);
2099
+ };
2100
+ return;
2101
+ }
2102
+ (E.current === "touch" ? !Ce(i.floating, B.relatedTarget) : !0) && _(B);
2103
+ }
2104
+ function k(B) {
2105
+ O() || o.current.floatingContext && (m.current == null || m.current({
2106
+ ...o.current.floatingContext,
2107
+ tree: u,
2108
+ x: B.clientX,
2109
+ y: B.clientY,
2110
+ onClose() {
2111
+ w(), M(), O() || _(B);
2112
+ }
2113
+ })(B));
2114
+ }
2115
+ function P() {
2116
+ re(S);
2117
+ }
2118
+ function V(B) {
2119
+ O() || _(B, !1);
2120
+ }
2121
+ if (U(i.domReference)) {
2122
+ const B = i.domReference, X = i.floating;
2123
+ return n && B.addEventListener("mouseleave", k), p && B.addEventListener("mousemove", L, {
2124
+ once: !0
2125
+ }), B.addEventListener("mouseenter", L), B.addEventListener("mouseleave", b), X && (X.addEventListener("mouseleave", k), X.addEventListener("mouseenter", P), X.addEventListener("mouseleave", V)), () => {
2126
+ n && B.removeEventListener("mouseleave", k), p && B.removeEventListener("mousemove", L), B.removeEventListener("mouseenter", L), B.removeEventListener("mouseleave", b), X && (X.removeEventListener("mouseleave", k), X.removeEventListener("mouseenter", P), X.removeEventListener("mouseleave", V));
2127
+ };
2128
+ }
2129
+ }, [i, l, e, f, p, _, M, w, r, n, h, u, y, m, o, O, x]), le(() => {
2130
+ var L;
2131
+ if (l && n && (L = m.current) != null && (L = L.__options) != null && L.blockPointerEvents && $()) {
2132
+ R.current = !0;
2133
+ const k = i.floating;
2134
+ if (U(i.domReference) && k) {
2135
+ var b;
2136
+ const P = fe(i.floating).body;
2137
+ P.setAttribute(xn, "");
2138
+ const V = i.domReference, B = u == null || (b = u.nodesRef.current.find((X) => X.id === v)) == null || (b = b.context) == null ? void 0 : b.elements.floating;
2139
+ return B && (B.style.pointerEvents = ""), P.style.pointerEvents = "none", V.style.pointerEvents = "auto", k.style.pointerEvents = "auto", () => {
2140
+ P.style.pointerEvents = "", V.style.pointerEvents = "", k.style.pointerEvents = "";
2141
+ };
2142
+ }
2143
+ }
2144
+ }, [l, n, v, i, u, m, $]), le(() => {
2145
+ n || (E.current = void 0, I.current = !1, M(), w());
2146
+ }, [n, M, w]), g.useEffect(() => () => {
2147
+ M(), re(S), re(A), w();
2148
+ }, [l, i.domReference, M, w]);
2149
+ const F = g.useMemo(() => {
2150
+ function L(b) {
2151
+ E.current = b.pointerType;
2152
+ }
2153
+ return {
2154
+ onPointerDown: L,
2155
+ onPointerEnter: L,
2156
+ onMouseMove(b) {
2157
+ const {
2158
+ nativeEvent: k
2159
+ } = b;
2160
+ function P() {
2161
+ !N.current && !h.current && r(!0, k, "hover");
2162
+ }
2163
+ f && !$t(E.current) || n || At(x.current) === 0 || I.current && b.movementX ** 2 + b.movementY ** 2 < 2 || (re(A), E.current === "touch" ? P() : (I.current = !0, A.current = window.setTimeout(P, At(x.current))));
2164
+ }
2165
+ };
2166
+ }, [f, r, n, h, x]);
2167
+ return g.useMemo(() => l ? {
2168
+ reference: F
2169
+ } : {}, [l, F]);
2170
+ }
2171
+ const Ti = {
2172
+ border: 0,
2173
+ clip: "rect(0 0 0 0)",
2174
+ height: "1px",
2175
+ margin: "-1px",
2176
+ overflow: "hidden",
2177
+ padding: 0,
2178
+ position: "fixed",
2179
+ whiteSpace: "nowrap",
2180
+ width: "1px",
2181
+ top: 0,
2182
+ left: 0
2183
+ }, En = /* @__PURE__ */ g.forwardRef(function(t, n) {
2184
+ const [r, o] = g.useState();
2185
+ le(() => {
2186
+ jn() && o("button");
2187
+ }, []);
2188
+ const s = {
2189
+ ref: n,
2190
+ tabIndex: 0,
2191
+ // Role is only for VoiceOver
2192
+ role: r,
2193
+ "aria-hidden": r ? void 0 : !0,
2194
+ [qe("focus-guard")]: "",
2195
+ style: Ti
2196
+ };
2197
+ return /* @__PURE__ */ T("span", {
2198
+ ...t,
2199
+ ...s
2200
+ });
2201
+ }), Di = {
2202
+ clipPath: "inset(50%)",
2203
+ position: "fixed",
2204
+ top: 0,
2205
+ left: 0
2206
+ }, tr = /* @__PURE__ */ g.createContext(null), Rn = /* @__PURE__ */ qe("portal");
2207
+ function Ai(e) {
2208
+ e === void 0 && (e = {});
2209
+ const {
2210
+ id: t,
2211
+ root: n
2212
+ } = e, r = mt(), o = ki(), [s, i] = g.useState(null), l = g.useRef(null);
2213
+ return le(() => () => {
2214
+ s == null || s.remove(), queueMicrotask(() => {
2215
+ l.current = null;
2216
+ });
2217
+ }, [s]), le(() => {
2218
+ if (!r || l.current) return;
2219
+ const a = t ? document.getElementById(t) : null;
2220
+ if (!a) return;
2221
+ const c = document.createElement("div");
2222
+ c.id = r, c.setAttribute(Rn, ""), a.appendChild(c), l.current = c, i(c);
2223
+ }, [t, r]), le(() => {
2224
+ if (n === null || !r || l.current) return;
2225
+ let a = n || (o == null ? void 0 : o.portalNode);
2226
+ a && !Kt(a) && (a = a.current), a = a || document.body;
2227
+ let c = null;
2228
+ t && (c = document.createElement("div"), c.id = t, a.appendChild(c));
2229
+ const f = document.createElement("div");
2230
+ f.id = r, f.setAttribute(Rn, ""), a = c || a, a.appendChild(f), l.current = f, i(f);
2231
+ }, [t, n, r, o]), s;
2232
+ }
2233
+ function Pi(e) {
2234
+ const {
2235
+ children: t,
2236
+ id: n,
2237
+ root: r,
2238
+ preserveTabOrder: o = !0
2239
+ } = e, s = Ai({
2240
+ id: n,
2241
+ root: r
2242
+ }), [i, l] = g.useState(null), a = g.useRef(null), c = g.useRef(null), f = g.useRef(null), d = g.useRef(null), p = i == null ? void 0 : i.modal, u = i == null ? void 0 : i.open, v = (
2243
+ // The FocusManager and therefore floating element are currently open/
2244
+ // rendered.
2245
+ !!i && // Guards are only for non-modal focus management.
2246
+ !i.modal && // Don't render if unmount is transitioning.
2247
+ i.open && o && !!(r || s)
2248
+ );
2249
+ return g.useEffect(() => {
2250
+ if (!s || !o || p)
2251
+ return;
2252
+ function m(y) {
2253
+ s && Mt(y) && (y.type === "focusin" ? un : Po)(s);
2254
+ }
2255
+ return s.addEventListener("focusin", m, !0), s.addEventListener("focusout", m, !0), () => {
2256
+ s.removeEventListener("focusin", m, !0), s.removeEventListener("focusout", m, !0);
2257
+ };
2258
+ }, [s, o, p]), g.useEffect(() => {
2259
+ s && (u || un(s));
2260
+ }, [u, s]), /* @__PURE__ */ z(tr.Provider, {
2261
+ value: g.useMemo(() => ({
2262
+ preserveTabOrder: o,
2263
+ beforeOutsideRef: a,
2264
+ afterOutsideRef: c,
2265
+ beforeInsideRef: f,
2266
+ afterInsideRef: d,
2267
+ portalNode: s,
2268
+ setFocusManagerState: l
2269
+ }), [o, s]),
2270
+ children: [v && s && /* @__PURE__ */ T(En, {
2271
+ "data-type": "outside",
2272
+ ref: a,
2273
+ onFocus: (m) => {
2274
+ if (Mt(m, s)) {
2275
+ var y;
2276
+ (y = f.current) == null || y.focus();
2277
+ } else {
2278
+ const h = i ? i.domReference : null, x = Ao(h);
2279
+ x == null || x.focus();
2280
+ }
2281
+ }
2282
+ }), v && s && /* @__PURE__ */ T("span", {
2283
+ "aria-owns": s.id,
2284
+ style: Di
2285
+ }), s && /* @__PURE__ */ Ln.createPortal(t, s), v && s && /* @__PURE__ */ T(En, {
2286
+ "data-type": "outside",
2287
+ ref: c,
2288
+ onFocus: (m) => {
2289
+ if (Mt(m, s)) {
2290
+ var y;
2291
+ (y = d.current) == null || y.focus();
2292
+ } else {
2293
+ const h = i ? i.domReference : null, x = Do(h);
2294
+ x == null || x.focus(), i != null && i.closeOnFocusOut && (i == null || i.onOpenChange(!1, m.nativeEvent, "focus-out"));
2295
+ }
2296
+ }
2297
+ })]
2298
+ });
2299
+ }
2300
+ const ki = () => g.useContext(tr), Ni = {
2301
+ pointerdown: "onPointerDown",
2302
+ mousedown: "onMouseDown",
2303
+ click: "onClick"
2304
+ }, Oi = {
2305
+ pointerdown: "onPointerDownCapture",
2306
+ mousedown: "onMouseDownCapture",
2307
+ click: "onClickCapture"
2308
+ }, Sn = (e) => {
2309
+ var t, n;
2310
+ return {
2311
+ escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1,
2312
+ outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0
2313
+ };
2314
+ };
2315
+ function Ii(e, t) {
2316
+ t === void 0 && (t = {});
2317
+ const {
2318
+ open: n,
2319
+ onOpenChange: r,
2320
+ elements: o,
2321
+ dataRef: s
2322
+ } = e, {
2323
+ enabled: i = !0,
2324
+ escapeKey: l = !0,
2325
+ outsidePress: a = !0,
2326
+ outsidePressEvent: c = "pointerdown",
2327
+ referencePress: f = !1,
2328
+ referencePressEvent: d = "pointerdown",
2329
+ ancestorScroll: p = !1,
2330
+ bubbles: u,
2331
+ capture: v
2332
+ } = t, m = Gt(), y = ue(typeof a == "function" ? a : () => !1), h = typeof a == "function" ? y : a, x = g.useRef(!1), {
2333
+ escapeKey: E,
2334
+ outsidePress: S
2335
+ } = Sn(u), {
2336
+ escapeKey: D,
2337
+ outsidePress: A
2338
+ } = Sn(v), N = g.useRef(!1), R = ue((w) => {
2339
+ var O;
2340
+ if (!n || !i || !l || w.key !== "Escape" || N.current)
2341
+ return;
2342
+ const F = (O = s.current.floatingContext) == null ? void 0 : O.nodeId, L = m ? et(m.nodesRef.current, F) : [];
2343
+ if (!E && (w.stopPropagation(), L.length > 0)) {
2344
+ let b = !0;
2345
+ if (L.forEach((k) => {
2346
+ var P;
2347
+ if ((P = k.context) != null && P.open && !k.context.dataRef.current.__escapeKeyBubbles) {
2348
+ b = !1;
2349
+ return;
2350
+ }
2351
+ }), !b)
2352
+ return;
2353
+ }
2354
+ r(!1, Eo(w) ? w.nativeEvent : w, "escape-key");
2355
+ }), C = ue((w) => {
2356
+ var O;
2357
+ const F = () => {
2358
+ var L;
2359
+ R(w), (L = ke(w)) == null || L.removeEventListener("keydown", F);
2360
+ };
2361
+ (O = ke(w)) == null || O.addEventListener("keydown", F);
2362
+ }), I = ue((w) => {
2363
+ var O;
2364
+ const F = s.current.insideReactTree;
2365
+ s.current.insideReactTree = !1;
2366
+ const L = x.current;
2367
+ if (x.current = !1, c === "click" && L || F || typeof h == "function" && !h(w))
2368
+ return;
2369
+ const b = ke(w), k = "[" + qe("inert") + "]", P = fe(o.floating).querySelectorAll(k);
2370
+ let V = U(b) ? b : null;
2371
+ for (; V && !he(V); ) {
2372
+ const K = ge(V);
2373
+ if (he(K) || !U(K))
2374
+ break;
2375
+ V = K;
2376
+ }
2377
+ if (P.length && U(b) && !yo(b) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
2378
+ !Ce(b, o.floating) && // If the target root element contains none of the markers, then the
2379
+ // element was injected after the floating element rendered.
2380
+ Array.from(P).every((K) => !Ce(V, K)))
2381
+ return;
2382
+ if (ie(b) && M) {
2383
+ const K = he(b), j = ne(b), J = /auto|scroll/, vt = K || J.test(j.overflowX), Te = K || J.test(j.overflowY), ht = vt && b.clientWidth > 0 && b.scrollWidth > b.clientWidth, xe = Te && b.clientHeight > 0 && b.scrollHeight > b.clientHeight, Ee = j.direction === "rtl", De = xe && (Ee ? w.offsetX <= b.offsetWidth - b.clientWidth : w.offsetX > b.clientWidth), Ae = ht && w.offsetY > b.clientHeight;
2384
+ if (De || Ae)
2385
+ return;
2386
+ }
2387
+ const B = (O = s.current.floatingContext) == null ? void 0 : O.nodeId, X = m && et(m.nodesRef.current, B).some((K) => {
2388
+ var j;
2389
+ return St(w, (j = K.context) == null ? void 0 : j.elements.floating);
2390
+ });
2391
+ if (St(w, o.floating) || St(w, o.domReference) || X)
2392
+ return;
2393
+ const Ye = m ? et(m.nodesRef.current, B) : [];
2394
+ if (Ye.length > 0) {
2395
+ let K = !0;
2396
+ if (Ye.forEach((j) => {
2397
+ var J;
2398
+ if ((J = j.context) != null && J.open && !j.context.dataRef.current.__outsidePressBubbles) {
2399
+ K = !1;
2400
+ return;
2401
+ }
2402
+ }), !K)
2403
+ return;
2404
+ }
2405
+ r(!1, w, "outside-press");
2406
+ }), $ = ue((w) => {
2407
+ var O;
2408
+ const F = () => {
2409
+ var L;
2410
+ I(w), (L = ke(w)) == null || L.removeEventListener(c, F);
2411
+ };
2412
+ (O = ke(w)) == null || O.addEventListener(c, F);
2413
+ });
2414
+ g.useEffect(() => {
2415
+ if (!n || !i)
2416
+ return;
2417
+ s.current.__escapeKeyBubbles = E, s.current.__outsidePressBubbles = S;
2418
+ let w = -1;
2419
+ function O(P) {
2420
+ r(!1, P, "ancestor-scroll");
2421
+ }
2422
+ function F() {
2423
+ window.clearTimeout(w), N.current = !0;
2424
+ }
2425
+ function L() {
2426
+ w = window.setTimeout(
2427
+ () => {
2428
+ N.current = !1;
2429
+ },
2430
+ // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
2431
+ // Only apply to WebKit for the test to remain 0ms.
2432
+ ft() ? 5 : 0
2433
+ );
2434
+ }
2435
+ const b = fe(o.floating);
2436
+ l && (b.addEventListener("keydown", D ? C : R, D), b.addEventListener("compositionstart", F), b.addEventListener("compositionend", L)), h && b.addEventListener(c, A ? $ : I, A);
2437
+ let k = [];
2438
+ return p && (U(o.domReference) && (k = we(o.domReference)), U(o.floating) && (k = k.concat(we(o.floating))), !U(o.reference) && o.reference && o.reference.contextElement && (k = k.concat(we(o.reference.contextElement)))), k = k.filter((P) => {
2439
+ var V;
2440
+ return P !== ((V = b.defaultView) == null ? void 0 : V.visualViewport);
2441
+ }), k.forEach((P) => {
2442
+ P.addEventListener("scroll", O, {
2443
+ passive: !0
2444
+ });
2445
+ }), () => {
2446
+ l && (b.removeEventListener("keydown", D ? C : R, D), b.removeEventListener("compositionstart", F), b.removeEventListener("compositionend", L)), h && b.removeEventListener(c, A ? $ : I, A), k.forEach((P) => {
2447
+ P.removeEventListener("scroll", O);
2448
+ }), window.clearTimeout(w);
2449
+ };
2450
+ }, [s, o, l, h, c, n, r, p, i, E, S, R, D, C, I, A, $]), g.useEffect(() => {
2451
+ s.current.insideReactTree = !1;
2452
+ }, [s, h, c]);
2453
+ const _ = g.useMemo(() => ({
2454
+ onKeyDown: R,
2455
+ ...f && {
2456
+ [Ni[d]]: (w) => {
2457
+ r(!1, w.nativeEvent, "reference-press");
2458
+ },
2459
+ ...d !== "click" && {
2460
+ onClick(w) {
2461
+ r(!1, w.nativeEvent, "reference-press");
2462
+ }
2463
+ }
2464
+ }
2465
+ }), [R, r, f, d]), M = g.useMemo(() => {
2466
+ function w(O) {
2467
+ O.button === 0 && (x.current = !0);
2468
+ }
2469
+ return {
2470
+ onKeyDown: R,
2471
+ onMouseDown: w,
2472
+ onMouseUp: w,
2473
+ [Oi[c]]: () => {
2474
+ s.current.insideReactTree = !0;
2475
+ }
2476
+ };
2477
+ }, [R, c, s]);
2478
+ return g.useMemo(() => i ? {
2479
+ reference: _,
2480
+ floating: M
2481
+ } : {}, [i, _, M]);
2482
+ }
2483
+ function Ci(e) {
2484
+ const {
2485
+ open: t = !1,
2486
+ onOpenChange: n,
2487
+ elements: r
2488
+ } = e, o = mt(), s = g.useRef({}), [i] = g.useState(() => Ri()), l = qt() != null;
2489
+ if (process.env.NODE_ENV !== "production") {
2490
+ const u = r.reference;
2491
+ u && !U(u) && xi("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
2492
+ }
2493
+ const [a, c] = g.useState(r.reference), f = ue((u, v, m) => {
2494
+ s.current.openEvent = u ? v : void 0, i.emit("openchange", {
2495
+ open: u,
2496
+ event: v,
2497
+ reason: m,
2498
+ nested: l
2499
+ }), n == null || n(u, v, m);
2500
+ }), d = g.useMemo(() => ({
2501
+ setPositionReference: c
2502
+ }), []), p = g.useMemo(() => ({
2503
+ reference: a || r.reference || null,
2504
+ floating: r.floating || null,
2505
+ domReference: r.reference
2506
+ }), [a, r.reference, r.floating]);
2507
+ return g.useMemo(() => ({
2508
+ dataRef: s,
2509
+ open: t,
2510
+ onOpenChange: f,
2511
+ elements: p,
2512
+ events: i,
2513
+ floatingId: o,
2514
+ refs: d
2515
+ }), [t, f, p, i, o, d]);
2516
+ }
2517
+ function Fi(e) {
2518
+ e === void 0 && (e = {});
2519
+ const {
2520
+ nodeId: t
2521
+ } = e, n = Ci({
2522
+ ...e,
2523
+ elements: {
2524
+ reference: null,
2525
+ floating: null,
2526
+ ...e.elements
2527
+ }
2528
+ }), r = e.rootContext || n, o = r.elements, [s, i] = g.useState(null), [l, a] = g.useState(null), f = (o == null ? void 0 : o.domReference) || s, d = g.useRef(null), p = Gt();
2529
+ le(() => {
2530
+ f && (d.current = f);
2531
+ }, [f]);
2532
+ const u = ci({
2533
+ ...e,
2534
+ elements: {
2535
+ ...o,
2536
+ ...l && {
2537
+ reference: l
2538
+ }
2539
+ }
2540
+ }), v = g.useCallback((E) => {
2541
+ const S = U(E) ? {
2542
+ getBoundingClientRect: () => E.getBoundingClientRect(),
2543
+ getClientRects: () => E.getClientRects(),
2544
+ contextElement: E
2545
+ } : E;
2546
+ a(S), u.refs.setReference(S);
2547
+ }, [u.refs]), m = g.useCallback((E) => {
2548
+ (U(E) || E === null) && (d.current = E, i(E)), (U(u.refs.reference.current) || u.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
2549
+ // `null` to support `positionReference` + an unstable `reference`
2550
+ // callback ref.
2551
+ E !== null && !U(E)) && u.refs.setReference(E);
2552
+ }, [u.refs]), y = g.useMemo(() => ({
2553
+ ...u.refs,
2554
+ setReference: m,
2555
+ setPositionReference: v,
2556
+ domReference: d
2557
+ }), [u.refs, m, v]), h = g.useMemo(() => ({
2558
+ ...u.elements,
2559
+ domReference: f
2560
+ }), [u.elements, f]), x = g.useMemo(() => ({
2561
+ ...u,
2562
+ ...r,
2563
+ refs: y,
2564
+ elements: h,
2565
+ nodeId: t
2566
+ }), [u, y, h, t, r]);
2567
+ return le(() => {
2568
+ r.dataRef.current.floatingContext = x;
2569
+ const E = p == null ? void 0 : p.nodesRef.current.find((S) => S.id === t);
2570
+ E && (E.context = x);
2571
+ }), g.useMemo(() => ({
2572
+ ...u,
2573
+ context: x,
2574
+ refs: y,
2575
+ elements: h
2576
+ }), [u, y, h, x]);
2577
+ }
2578
+ function Pt() {
2579
+ return vo() && jn();
2580
+ }
2581
+ function Yi(e, t) {
2582
+ t === void 0 && (t = {});
2583
+ const {
2584
+ open: n,
2585
+ onOpenChange: r,
2586
+ events: o,
2587
+ dataRef: s,
2588
+ elements: i
2589
+ } = e, {
2590
+ enabled: l = !0,
2591
+ visibleOnly: a = !0
2592
+ } = t, c = g.useRef(!1), f = g.useRef(-1), d = g.useRef(!0);
2593
+ g.useEffect(() => {
2594
+ if (!l) return;
2595
+ const u = te(i.domReference);
2596
+ function v() {
2597
+ !n && ie(i.domReference) && i.domReference === Bt(fe(i.domReference)) && (c.current = !0);
2598
+ }
2599
+ function m() {
2600
+ d.current = !0;
2601
+ }
2602
+ function y() {
2603
+ d.current = !1;
2604
+ }
2605
+ return u.addEventListener("blur", v), Pt() && (u.addEventListener("keydown", m, !0), u.addEventListener("pointerdown", y, !0)), () => {
2606
+ u.removeEventListener("blur", v), Pt() && (u.removeEventListener("keydown", m, !0), u.removeEventListener("pointerdown", y, !0));
2607
+ };
2608
+ }, [i.domReference, n, l]), g.useEffect(() => {
2609
+ if (!l) return;
2610
+ function u(v) {
2611
+ let {
2612
+ reason: m
2613
+ } = v;
2614
+ (m === "reference-press" || m === "escape-key") && (c.current = !0);
2615
+ }
2616
+ return o.on("openchange", u), () => {
2617
+ o.off("openchange", u);
2618
+ };
2619
+ }, [o, l]), g.useEffect(() => () => {
2620
+ re(f);
2621
+ }, []);
2622
+ const p = g.useMemo(() => ({
2623
+ onMouseLeave() {
2624
+ c.current = !1;
2625
+ },
2626
+ onFocus(u) {
2627
+ if (c.current) return;
2628
+ const v = ke(u.nativeEvent);
2629
+ if (a && U(v)) {
2630
+ if (Pt() && !u.relatedTarget) {
2631
+ if (!d.current && !bo(v))
2632
+ return;
2633
+ } else if (!wo(v))
2634
+ return;
2635
+ }
2636
+ r(!0, u.nativeEvent, "focus");
2637
+ },
2638
+ onBlur(u) {
2639
+ c.current = !1;
2640
+ const v = u.relatedTarget, m = u.nativeEvent, y = U(v) && v.hasAttribute(qe("focus-guard")) && v.getAttribute("data-type") === "outside";
2641
+ f.current = window.setTimeout(() => {
2642
+ var h;
2643
+ const x = Bt(i.domReference ? i.domReference.ownerDocument : document);
2644
+ !v && x === i.domReference || Ce((h = s.current.floatingContext) == null ? void 0 : h.refs.floating.current, x) || Ce(i.domReference, x) || y || r(!1, m, "focus");
2645
+ });
2646
+ }
2647
+ }), [s, i.domReference, r, a]);
2648
+ return g.useMemo(() => l ? {
2649
+ reference: p
2650
+ } : {}, [l, p]);
2651
+ }
2652
+ function kt(e, t, n) {
2653
+ const r = /* @__PURE__ */ new Map(), o = n === "item";
2654
+ let s = e;
2655
+ if (o && e) {
2656
+ const {
2657
+ [gn]: i,
2658
+ [yn]: l,
2659
+ ...a
2660
+ } = e;
2661
+ s = a;
2662
+ }
2663
+ return {
2664
+ ...n === "floating" && {
2665
+ tabIndex: -1,
2666
+ [vi]: ""
2667
+ },
2668
+ ...s,
2669
+ ...t.map((i) => {
2670
+ const l = i ? i[n] : null;
2671
+ return typeof l == "function" ? e ? l(e) : null : l;
2672
+ }).concat(e).reduce((i, l) => (l && Object.entries(l).forEach((a) => {
2673
+ let [c, f] = a;
2674
+ if (!(o && [gn, yn].includes(c)))
2675
+ if (c.indexOf("on") === 0) {
2676
+ if (r.has(c) || r.set(c, []), typeof f == "function") {
2677
+ var d;
2678
+ (d = r.get(c)) == null || d.push(f), i[c] = function() {
2679
+ for (var p, u = arguments.length, v = new Array(u), m = 0; m < u; m++)
2680
+ v[m] = arguments[m];
2681
+ return (p = r.get(c)) == null ? void 0 : p.map((y) => y(...v)).find((y) => y !== void 0);
2682
+ };
2683
+ }
2684
+ } else
2685
+ i[c] = f;
2686
+ }), i), {})
2687
+ };
2688
+ }
2689
+ function _i(e) {
2690
+ e === void 0 && (e = []);
2691
+ const t = e.map((l) => l == null ? void 0 : l.reference), n = e.map((l) => l == null ? void 0 : l.floating), r = e.map((l) => l == null ? void 0 : l.item), o = g.useCallback(
2692
+ (l) => kt(l, e, "reference"),
2693
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2694
+ t
2695
+ ), s = g.useCallback(
2696
+ (l) => kt(l, e, "floating"),
2697
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2698
+ n
2699
+ ), i = g.useCallback(
2700
+ (l) => kt(l, e, "item"),
2701
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2702
+ r
2703
+ );
2704
+ return g.useMemo(() => ({
2705
+ getReferenceProps: o,
2706
+ getFloatingProps: s,
2707
+ getItemProps: i
2708
+ }), [o, s, i]);
2709
+ }
2710
+ const Bi = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
2711
+ function $i(e, t) {
2712
+ var n, r;
2713
+ t === void 0 && (t = {});
2714
+ const {
2715
+ open: o,
2716
+ elements: s,
2717
+ floatingId: i
2718
+ } = e, {
2719
+ enabled: l = !0,
2720
+ role: a = "dialog"
2721
+ } = t, c = mt(), f = ((n = s.domReference) == null ? void 0 : n.id) || c, d = g.useMemo(() => {
2722
+ var x;
2723
+ return ((x = xo(s.floating)) == null ? void 0 : x.id) || i;
2724
+ }, [s.floating, i]), p = (r = Bi.get(a)) != null ? r : a, v = qt() != null, m = g.useMemo(() => p === "tooltip" || a === "label" ? {
2725
+ ["aria-" + (a === "label" ? "labelledby" : "describedby")]: o ? d : void 0
2726
+ } : {
2727
+ "aria-expanded": o ? "true" : "false",
2728
+ "aria-haspopup": p === "alertdialog" ? "dialog" : p,
2729
+ "aria-controls": o ? d : void 0,
2730
+ ...p === "listbox" && {
2731
+ role: "combobox"
2732
+ },
2733
+ ...p === "menu" && {
2734
+ id: f
2735
+ },
2736
+ ...p === "menu" && v && {
2737
+ role: "menuitem"
2738
+ },
2739
+ ...a === "select" && {
2740
+ "aria-autocomplete": "none"
2741
+ },
2742
+ ...a === "combobox" && {
2743
+ "aria-autocomplete": "list"
2744
+ }
2745
+ }, [p, d, v, o, f, a]), y = g.useMemo(() => {
2746
+ const x = {
2747
+ id: d,
2748
+ ...p && {
2749
+ role: p
2750
+ }
2751
+ };
2752
+ return p === "tooltip" || a === "label" ? x : {
2753
+ ...x,
2754
+ ...p === "menu" && {
2755
+ "aria-labelledby": f
2756
+ }
2757
+ };
2758
+ }, [p, d, f, a]), h = g.useCallback((x) => {
2759
+ let {
2760
+ active: E,
2761
+ selected: S
2762
+ } = x;
2763
+ const D = {
2764
+ role: "option",
2765
+ ...E && {
2766
+ id: d + "-fui-option"
2767
+ }
2768
+ };
2769
+ switch (a) {
2770
+ case "select":
2771
+ case "combobox":
2772
+ return {
2773
+ ...D,
2774
+ "aria-selected": S
2775
+ };
2776
+ }
2777
+ return {};
2778
+ }, [d, a]);
2779
+ return g.useMemo(() => l ? {
2780
+ reference: m,
2781
+ floating: y,
2782
+ item: h
2783
+ } : {}, [l, m, y, h]);
2784
+ }
2785
+ function Vi({
2786
+ content: e,
2787
+ renderProps: t,
2788
+ delay: n = 300,
2789
+ placement: r = "top",
2790
+ classNames: o = {},
2791
+ styles: s = {},
2792
+ children: i
2793
+ }) {
2794
+ const [l, a] = oe(!1), [c, f] = oe(null), d = typeof e == "function" ? e(t) : e, p = d != null, { refs: u, floatingStyles: v, context: m } = Fi({
2795
+ open: l && p,
2796
+ onOpenChange: a,
2797
+ placement: r,
2798
+ strategy: "fixed",
2799
+ transform: !1,
2800
+ whileElementsMounted: ti,
2801
+ middleware: [
2802
+ ui(8),
2803
+ di({ padding: 8 }),
2804
+ fi({ padding: 8 }),
2805
+ pi({ element: c })
2806
+ ]
2807
+ }), y = Li(m, { move: !1, delay: { open: n, close: 0 } }), h = Yi(m), x = Ii(m), E = $i(m, { role: "tooltip" }), { getReferenceProps: S, getFloatingProps: D } = _i([y, h, x, E]), A = i.ref, N = mi([u.setReference, A ?? null]), R = Er.cloneElement(
2808
+ i,
2809
+ S({ ...i.props, ref: N })
2810
+ ), C = u.reference.current, I = (C instanceof HTMLElement ? C.closest(".fldp-root") : null) ?? void 0;
2811
+ return /* @__PURE__ */ z(nt, { children: [
2812
+ R,
2813
+ l && p && /* @__PURE__ */ T(Pi, { root: I, children: /* @__PURE__ */ z(
2814
+ "div",
2815
+ {
2816
+ ref: u.setFloating,
2817
+ className: H("fldp-tooltip", o.tooltip),
2818
+ style: { ...v, ...s.tooltip },
2819
+ ...D(),
2820
+ children: [
2821
+ d,
2822
+ /* @__PURE__ */ T(
2823
+ Ei,
2824
+ {
2825
+ ref: f,
2826
+ context: m,
2827
+ style: { fill: "var(--fldp-foreground)" },
2828
+ width: 10,
2829
+ height: 5
2830
+ }
2831
+ )
2832
+ ]
2833
+ }
2834
+ ) })
2835
+ ] });
2836
+ }
2837
+ function Wi({ date: e, isOutside: t }) {
2838
+ var B;
2839
+ const {
2840
+ mode: n,
2841
+ singleValue: r,
2842
+ rangeValue: o,
2843
+ hoveredDate: s,
2844
+ selectDate: i,
2845
+ setHoveredDate: l,
2846
+ disabled: a,
2847
+ isDisabled: c,
2848
+ readOnly: f,
2849
+ highlightToday: d,
2850
+ showAdjacentMonthDays: p,
2851
+ locale: u,
2852
+ tooltip: v,
2853
+ tooltipDelay: m,
2854
+ classNames: y,
2855
+ styles: h,
2856
+ renderDay: x,
2857
+ onDayHover: E
2858
+ } = Wt(), S = ((B = e.isToday) == null ? void 0 : B.call(e)) ?? e.isSame(/* @__PURE__ */ new Date(), "day"), D = c || Pr(e, a), A = n === "single" ? ve(e, r) : ve(e, o.start) && ve(e, o.end), N = n === "range" ? Nn(e, o) : !1, R = n === "range" ? On(e, o) : !1, C = n === "range" ? Nt(e, o.start, o.end) : !1, I = n === "range" && o.start && !o.end && s ? { start: o.start, end: s } : null, $ = I ? Nt(e, I.start, I.end) || ve(e, I.end) : !1, _ = I ? ve(e, I.start) : !1, M = I ? ve(e, I.end) : !1, w = n === "range" ? o.end ?? (I == null ? void 0 : I.end) ?? null : null, O = n === "range" && o.start && w && w.diff(o.start, "day") || null, F = {
2859
+ date: e,
2860
+ isToday: S,
2861
+ isSelected: A || N || R,
2862
+ isDisabled: D,
2863
+ isRangeStart: N,
2864
+ isRangeEnd: R,
2865
+ isInRange: C || $,
2866
+ isRangeSelecting: n === "range" && !!o.start && !o.end,
2867
+ isInPreviewRange: $,
2868
+ isPreviewRangeEnd: M,
2869
+ rangeStart: n === "range" ? o.start ?? null : null,
2870
+ rangeEnd: w,
2871
+ nights: O
2872
+ };
2873
+ if (t && !p)
2874
+ return /* @__PURE__ */ T("div", { className: "fldp-day fldp-day--outside", "aria-hidden": "true" });
2875
+ function L() {
2876
+ D || f || i(e);
2877
+ }
2878
+ function b() {
2879
+ l(e), E == null || E(e);
2880
+ }
2881
+ function k() {
2882
+ l(null), E == null || E(null);
2883
+ }
2884
+ function P(X) {
2885
+ (X.key === "Enter" || X.key === " ") && (X.preventDefault(), L());
2886
+ }
2887
+ const V = /* @__PURE__ */ T(
2888
+ "div",
2889
+ {
2890
+ onClick: L,
2891
+ onMouseEnter: b,
2892
+ onMouseLeave: k,
2893
+ onKeyDown: P,
2894
+ "aria-pressed": A || N || R,
2895
+ "aria-disabled": D,
2896
+ "aria-label": e.locale(u ?? "en").format("MMMM D, YYYY"),
2897
+ role: "button",
2898
+ tabIndex: D ? -1 : 0,
2899
+ className: H(
2900
+ "fldp-day",
2901
+ S && d && "fldp-day--today",
2902
+ A && "fldp-day--selected",
2903
+ N && !R && "fldp-day--range-start",
2904
+ R && !N && "fldp-day--range-end",
2905
+ N && R && "fldp-day--selected",
2906
+ C && "fldp-day--in-range",
2907
+ ($ || _) && !C && !N && !R && "fldp-day--hovered-range",
2908
+ D && "fldp-day--disabled",
2909
+ t && "fldp-day--outside",
2910
+ ($ || _) && y.dayHovered,
2911
+ y.day,
2912
+ S && y.dayToday,
2913
+ A && y.daySelected,
2914
+ N && y.dayRangeStart,
2915
+ R && y.dayRangeEnd,
2916
+ C && y.dayInRange,
2917
+ D && y.dayDisabled,
2918
+ t && y.dayOutside
2919
+ ),
2920
+ style: {
2921
+ ...h.day,
2922
+ ...S && h.dayToday,
2923
+ ...A && h.daySelected,
2924
+ ...N && h.dayRangeStart,
2925
+ ...R && h.dayRangeEnd,
2926
+ ...C && h.dayInRange,
2927
+ ...D && h.dayDisabled,
2928
+ ...t && h.dayOutside,
2929
+ ...($ || _) && h.dayHovered
2930
+ },
2931
+ children: x ? x(e, F) : /* @__PURE__ */ T("span", { className: "fldp-day-number", children: e.date() })
2932
+ }
2933
+ );
2934
+ return v ? /* @__PURE__ */ T(
2935
+ Vi,
2936
+ {
2937
+ content: v,
2938
+ renderProps: F,
2939
+ delay: m,
2940
+ classNames: y,
2941
+ styles: h,
2942
+ children: V
2943
+ }
2944
+ ) : V;
2945
+ }
2946
+ function Hi({ panelIndex: e = 0, totalPanels: t = 1 }) {
2947
+ const { currentYear: n, currentMonth: r, weekStartsOn: o, locale: s, classNames: i, styles: l } = Wt(), a = r + e, c = n + Math.floor(a / 12), f = a % 12, d = kr(c, f, o), p = Nr(o, s);
2948
+ return /* @__PURE__ */ z(
2949
+ "div",
2950
+ {
2951
+ role: "grid",
2952
+ "aria-label": `${ee(new Date(c, f)).locale(s ?? "en").format("MMMM YYYY")}`,
2953
+ className: H("fldp-calendar", i.calendar),
2954
+ style: l.calendar,
2955
+ children: [
2956
+ /* @__PURE__ */ T(Yr, { panelIndex: e, totalPanels: t }),
2957
+ /* @__PURE__ */ T(
2958
+ "div",
2959
+ {
2960
+ role: "row",
2961
+ className: H("fldp-weekdays", i.weekdays),
2962
+ style: l.weekdays,
2963
+ children: p.map((u) => /* @__PURE__ */ T(
2964
+ "div",
2965
+ {
2966
+ role: "columnheader",
2967
+ "aria-label": u,
2968
+ className: H("fldp-weekday", i.weekday),
2969
+ style: l.weekday,
2970
+ children: u
2971
+ },
2972
+ u
2973
+ ))
2974
+ }
2975
+ ),
2976
+ /* @__PURE__ */ T(
2977
+ "div",
2978
+ {
2979
+ role: "rowgroup",
2980
+ className: H("fldp-days-grid", i.daysGrid),
2981
+ style: l.daysGrid,
2982
+ children: d.map((u) => {
2983
+ const v = u.month() !== f || u.year() !== c;
2984
+ return /* @__PURE__ */ T(
2985
+ Wi,
2986
+ {
2987
+ date: u,
2988
+ isOutside: v
2989
+ },
2990
+ u.format("YYYY-MM-DD")
2991
+ );
2992
+ })
2993
+ }
2994
+ )
2995
+ ]
2996
+ }
2997
+ );
2998
+ }
2999
+ function Ki() {
3000
+ return /* @__PURE__ */ z(
3001
+ "svg",
3002
+ {
3003
+ className: "fldp-calendar-icon",
3004
+ width: "16",
3005
+ height: "16",
3006
+ viewBox: "0 0 24 24",
3007
+ fill: "none",
3008
+ stroke: "currentColor",
3009
+ strokeWidth: "2",
3010
+ strokeLinecap: "round",
3011
+ strokeLinejoin: "round",
3012
+ "aria-hidden": "true",
3013
+ children: [
3014
+ /* @__PURE__ */ T("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
3015
+ /* @__PURE__ */ T("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
3016
+ /* @__PURE__ */ T("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
3017
+ /* @__PURE__ */ T("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
3018
+ ]
3019
+ }
3020
+ );
3021
+ }
3022
+ function ji() {
3023
+ return /* @__PURE__ */ z("svg", { width: "10", height: "10", viewBox: "0 0 10 10", fill: "currentColor", "aria-hidden": "true", children: [
3024
+ /* @__PURE__ */ T("line", { x1: "1", y1: "1", x2: "9", y2: "9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
3025
+ /* @__PURE__ */ T("line", { x1: "9", y1: "1", x2: "1", y2: "9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })
3026
+ ] });
3027
+ }
3028
+ function Ui({
3029
+ mode: e,
3030
+ singleValue: t,
3031
+ rangeValue: n,
3032
+ format: r,
3033
+ locale: o,
3034
+ placeholder: s,
3035
+ isOpen: i,
3036
+ isDisabled: l,
3037
+ readOnly: a,
3038
+ clearable: c,
3039
+ classNames: f,
3040
+ styles: d,
3041
+ onOpen: p,
3042
+ onClear: u,
3043
+ renderInput: v
3044
+ }) {
3045
+ const m = e === "single" ? t != null : n.start != null, y = (R) => R ? R.locale(o ?? "en").format(r) : "", h = y(t), x = y(n.start), E = y(n.end), S = Array.isArray(s) ? s[0] : s, D = Array.isArray(s) ? s[1] : s;
3046
+ if (v) {
3047
+ const R = e === "single" ? h : [x, E].filter(Boolean).join(" → ");
3048
+ return /* @__PURE__ */ T(nt, { children: v({
3049
+ value: R,
3050
+ onClick: p,
3051
+ onClear: u,
3052
+ isOpen: i,
3053
+ placeholder: S,
3054
+ isDisabled: l,
3055
+ readOnly: a
3056
+ }) });
3057
+ }
3058
+ const A = d.inputWrapper ?? {};
3059
+ function N(R) {
3060
+ (R.key === "Enter" || R.key === " ") && (R.preventDefault(), p());
3061
+ }
3062
+ return /* @__PURE__ */ z(
3063
+ "div",
3064
+ {
3065
+ className: H(
3066
+ "fldp-input-wrapper",
3067
+ i && "fldp-input-wrapper--open",
3068
+ l && "fldp-input-wrapper--disabled",
3069
+ f.inputWrapper
3070
+ ),
3071
+ style: A,
3072
+ onClick: p,
3073
+ role: "button",
3074
+ "aria-haspopup": "dialog",
3075
+ "aria-expanded": i,
3076
+ "aria-disabled": l,
3077
+ tabIndex: l ? -1 : 0,
3078
+ onKeyDown: N,
3079
+ children: [
3080
+ /* @__PURE__ */ T(Ki, {}),
3081
+ /* @__PURE__ */ T("span", { className: "fldp-input-content", "aria-hidden": "true", children: e === "single" ? /* @__PURE__ */ T(
3082
+ "span",
3083
+ {
3084
+ className: H(
3085
+ "fldp-input-value",
3086
+ !h && "fldp-input-value--placeholder",
3087
+ f.input
3088
+ ),
3089
+ style: d.input,
3090
+ children: h || S
3091
+ }
3092
+ ) : /* @__PURE__ */ z(nt, { children: [
3093
+ /* @__PURE__ */ T(
3094
+ "span",
3095
+ {
3096
+ className: H(
3097
+ "fldp-input-value",
3098
+ !x && "fldp-input-value--placeholder",
3099
+ f.input
3100
+ ),
3101
+ style: d.input,
3102
+ children: x || S
3103
+ }
3104
+ ),
3105
+ /* @__PURE__ */ T(
3106
+ "span",
3107
+ {
3108
+ className: H("fldp-separator", f.separator),
3109
+ style: d.separator,
3110
+ children: "→"
3111
+ }
3112
+ ),
3113
+ /* @__PURE__ */ T(
3114
+ "span",
3115
+ {
3116
+ className: H(
3117
+ "fldp-input-value",
3118
+ !E && "fldp-input-value--placeholder",
3119
+ f.input
3120
+ ),
3121
+ style: d.input,
3122
+ children: E || D
3123
+ }
3124
+ )
3125
+ ] }) }),
3126
+ c && m && !a && /* @__PURE__ */ T(
3127
+ "span",
3128
+ {
3129
+ className: H("fldp-clear-button", f.clearButton),
3130
+ style: d.clearButton,
3131
+ role: "button",
3132
+ tabIndex: 0,
3133
+ "aria-label": "Clear date",
3134
+ onClick: (R) => {
3135
+ R.stopPropagation(), u();
3136
+ },
3137
+ onKeyDown: (R) => {
3138
+ (R.key === "Enter" || R.key === " ") && (R.preventDefault(), R.stopPropagation(), u());
3139
+ },
3140
+ children: /* @__PURE__ */ T(ji, {})
3141
+ }
3142
+ )
3143
+ ]
3144
+ }
3145
+ );
3146
+ }
3147
+ function Xi(e) {
3148
+ if (!e) return {};
3149
+ const t = {
3150
+ "--fldp-primary": e.primary,
3151
+ "--fldp-primary-hover": e.primaryHover,
3152
+ "--fldp-primary-foreground": e.primaryForeground,
3153
+ "--fldp-background": e.background,
3154
+ "--fldp-surface": e.surface,
3155
+ "--fldp-surface-strong": e.surfaceStrong,
3156
+ "--fldp-foreground": e.foreground,
3157
+ "--fldp-muted": e.muted,
3158
+ "--fldp-accent-soft": e.accentSoft,
3159
+ "--fldp-muted-foreground": e.mutedForeground,
3160
+ "--fldp-border": e.border,
3161
+ "--fldp-input-background": e.inputBackground,
3162
+ "--fldp-border-radius": e.borderRadius,
3163
+ "--fldp-day-border-radius": e.dayBorderRadius,
3164
+ "--fldp-shadow": e.shadow,
3165
+ "--fldp-font-family": e.fontFamily,
3166
+ "--fldp-font-size": e.fontSize,
3167
+ "--fldp-today-color": e.todayColor,
3168
+ "--fldp-disabled-opacity": e.disabledOpacity,
3169
+ "--fldp-transition-duration": e.transitionDuration,
3170
+ "--fldp-z-index": e.zIndex,
3171
+ "--fldp-gold": e.primary,
3172
+ "--fldp-gold-light": e.primaryHover ?? e.primary
3173
+ }, n = {};
3174
+ for (const [r, o] of Object.entries(t))
3175
+ o !== void 0 && (n[r] = o);
3176
+ return n;
3177
+ }
3178
+ function nr({
3179
+ timeSlots: e,
3180
+ selectedTime: t,
3181
+ onSelectTime: n,
3182
+ timeFormat: r,
3183
+ locale: o,
3184
+ targetDate: s,
3185
+ disabledTime: i,
3186
+ isDisabled: l,
3187
+ readOnly: a,
3188
+ classNames: c = {},
3189
+ styles: f = {}
3190
+ }) {
3191
+ return /* @__PURE__ */ z(
3192
+ "div",
3193
+ {
3194
+ className: H("fldp-time-picker", c.timePicker),
3195
+ style: f.timePicker,
3196
+ children: [
3197
+ /* @__PURE__ */ T(
3198
+ "div",
3199
+ {
3200
+ className: H("fldp-time-title", c.timeTitle),
3201
+ style: f.timeTitle,
3202
+ children: "Time"
3203
+ }
3204
+ ),
3205
+ /* @__PURE__ */ z(
3206
+ "div",
3207
+ {
3208
+ className: H("fldp-time-slot-list", c.timeSlotList),
3209
+ style: f.timeSlotList,
3210
+ children: [
3211
+ e.length === 0 && /* @__PURE__ */ T("span", { className: "fldp-time-empty", children: "No availability" }),
3212
+ e.map((d) => {
3213
+ const p = d === t, u = Cn(s, d, i), v = ee(`2000-01-01T${d}`).locale(o ?? "en").format(r);
3214
+ return /* @__PURE__ */ T(
3215
+ "span",
3216
+ {
3217
+ role: "button",
3218
+ tabIndex: u || l || a ? -1 : 0,
3219
+ "aria-disabled": u || l || a,
3220
+ className: H(
3221
+ "fldp-time-slot",
3222
+ p && "fldp-time-slot--selected",
3223
+ u && "fldp-time-slot--disabled",
3224
+ c.timeSlot,
3225
+ p && c.timeSlotSelected,
3226
+ u && c.timeSlotDisabled
3227
+ ),
3228
+ style: {
3229
+ ...f.timeSlot,
3230
+ ...p && f.timeSlotSelected,
3231
+ ...u && f.timeSlotDisabled
3232
+ },
3233
+ onClick: () => {
3234
+ !u && !l && !a && n(d);
3235
+ },
3236
+ onKeyDown: (m) => {
3237
+ (m.key === "Enter" || m.key === " ") && !u && !l && !a && (m.preventDefault(), n(d));
3238
+ },
3239
+ children: v
3240
+ },
3241
+ d
3242
+ );
3243
+ })
3244
+ ]
3245
+ }
3246
+ )
3247
+ ]
3248
+ }
3249
+ );
3250
+ }
3251
+ ee.extend(Tr);
3252
+ ee.extend(Ar);
3253
+ const zi = "MMM D, YYYY", qi = "Select date", Gi = ["Start date", "End date"], Zi = 15, Ji = "HH:mm", Qi = "00:00", es = "23:59";
3254
+ function cs({
3255
+ mode: e = "single",
3256
+ // Controlled single
3257
+ value: t,
3258
+ defaultValue: n,
3259
+ // Controlled range
3260
+ rangeValue: r,
3261
+ defaultRangeValue: o,
3262
+ format: s = zi,
3263
+ locale: i,
3264
+ lang: l,
3265
+ weekStartsOn: a = 0,
3266
+ enableTime: c = !1,
3267
+ timeStep: f = Zi,
3268
+ timeFormat: d = Ji,
3269
+ minTime: p = Qi,
3270
+ maxTime: u = es,
3271
+ disabledTime: v,
3272
+ timeSchedule: m,
3273
+ defaultTimeSchedule: y,
3274
+ minDate: h,
3275
+ maxDate: x,
3276
+ placeholder: E,
3277
+ disabled: S,
3278
+ isDisabled: D = !1,
3279
+ readOnly: A = !1,
3280
+ clearable: N = !0,
3281
+ highlightToday: R = !0,
3282
+ showAdjacentMonthDays: C = !1,
3283
+ showOutsideDays: I,
3284
+ tooltip: $,
3285
+ tooltipDelay: _ = 300,
3286
+ theme: M,
3287
+ classNames: w = {},
3288
+ styles: O = {},
3289
+ className: F,
3290
+ style: L,
3291
+ numberOfMonths: b = 1,
3292
+ showMonthYearSelectors: k = !0,
3293
+ inline: P = !1,
3294
+ placement: V = "auto",
3295
+ renderDay: B,
3296
+ renderNavButton: X,
3297
+ renderInput: Ye,
3298
+ // Events
3299
+ onDateChange: K,
3300
+ onRangeChange: j,
3301
+ onTimeChange: J,
3302
+ onMonthChange: vt,
3303
+ onYearChange: Te,
3304
+ onDayHover: ht,
3305
+ onOpen: xe,
3306
+ onClose: Ee,
3307
+ onClear: De,
3308
+ onBeforeSelect: Ae,
3309
+ onAfterSelect: Ge
3310
+ }) {
3311
+ const _e = t !== void 0, [rr, gt] = oe(
3312
+ n ?? null
3313
+ ), ce = _e ? t ?? null : rr, ye = r !== void 0, [Zt, Be] = oe(
3314
+ o ?? { start: null, end: null }
3315
+ ), q = Mr(
3316
+ () => ye ? r ?? { start: null, end: null } : Zt,
3317
+ [ye, r, Zt]
3318
+ ), [or, ir] = oe(null), [se, Jt] = oe(!1), $e = Vt(null), [sr, Qt] = oe("bottom"), Pe = me(() => {
3319
+ if (P || V !== "auto") {
3320
+ Qt(V === "top" ? "top" : "bottom");
3321
+ return;
3322
+ }
3323
+ if (!$e.current) return;
3324
+ const Y = $e.current.getBoundingClientRect(), W = window.innerHeight - Y.bottom, Z = Y.top;
3325
+ Qt(W >= Z ? "bottom" : "top");
3326
+ }, [P, V]);
3327
+ Ne(() => {
3328
+ if (!se) return;
3329
+ const Y = window.requestAnimationFrame(Pe);
3330
+ return window.addEventListener("resize", Pe), window.addEventListener("scroll", Pe, !0), () => {
3331
+ window.cancelAnimationFrame(Y), window.removeEventListener("resize", Pe), window.removeEventListener("scroll", Pe, !0);
3332
+ };
3333
+ }, [se, Pe]);
3334
+ const en = e === "single" ? ce ?? ee() : q.start ?? ee(), [yt, lr] = oe(en.month()), [bt, cr] = oe(en.year()), tn = me(() => {
3335
+ P || D || A || (Jt(!0), xe == null || xe());
3336
+ }, [P, D, A, xe]), ae = me(() => {
3337
+ P || (Jt(!1), Ee == null || Ee());
3338
+ }, [P, Ee]), ar = me(() => {
3339
+ P || (se ? ae() : tn());
3340
+ }, [P, se, ae, tn]), nn = me(
3341
+ (Y, W) => ({
3342
+ mode: e,
3343
+ phase: Y,
3344
+ currentValue: ce,
3345
+ currentRange: q,
3346
+ nextValue: W
3347
+ }),
3348
+ [e, ce, q]
3349
+ );
3350
+ Ne(() => {
3351
+ if (P) return;
3352
+ function Y(W) {
3353
+ $e.current && !$e.current.contains(W.target) && ae();
3354
+ }
3355
+ return se && document.addEventListener("mousedown", Y), () => document.removeEventListener("mousedown", Y);
3356
+ }, [se, P, ae]), Ne(() => {
3357
+ if (P) return;
3358
+ function Y(W) {
3359
+ W.key === "Escape" && ae();
3360
+ }
3361
+ return se && document.addEventListener("keydown", Y), () => document.removeEventListener("keydown", Y);
3362
+ }, [se, P, ae]);
3363
+ function wt(Y, W) {
3364
+ const [Z, He] = W.split(":").map(Number), Q = Number.isFinite(Z) ? Z : 0, Et = Number.isFinite(He) ? He : 0;
3365
+ return Y.hour(Q).minute(Et).second(0).millisecond(0);
3366
+ }
3367
+ const ur = me(
3368
+ (Y) => {
3369
+ let W, Z;
3370
+ if (e === "single")
3371
+ Z = "single", W = c && ce ? Y.hour(ce.hour()).minute(ce.minute()) : Y;
3372
+ else if (!q.start || q.start && q.end)
3373
+ Z = "range-start", W = { start: c && q.start ? Y.hour(q.start.hour()).minute(q.start.minute()) : Y, end: null };
3374
+ else {
3375
+ Z = "range-end";
3376
+ const Q = Y, [Et, xr] = Q.isBefore(q.start) ? [Q, q.start] : [q.start, Q];
3377
+ W = { start: Et, end: xr };
3378
+ }
3379
+ const He = nn(Z, W);
3380
+ if ((Ae == null ? void 0 : Ae(Y, He)) !== !1) {
3381
+ if (e === "single") {
3382
+ const Q = W;
3383
+ _e || gt(Q), K == null || K(Q);
3384
+ } else if (Z === "range-start") {
3385
+ const Q = W;
3386
+ ye || Be(Q), j == null || j(Q);
3387
+ } else {
3388
+ const Q = W;
3389
+ ye || Be(Q), j == null || j(Q);
3390
+ }
3391
+ Ge == null || Ge(Y, He), !c && (e === "single" || Z === "range-end") && ae();
3392
+ }
3393
+ },
3394
+ [
3395
+ e,
3396
+ q,
3397
+ ce,
3398
+ _e,
3399
+ ye,
3400
+ Ae,
3401
+ Ge,
3402
+ K,
3403
+ j,
3404
+ c,
3405
+ nn,
3406
+ ae
3407
+ ]
3408
+ );
3409
+ function fr() {
3410
+ if (e === "single")
3411
+ _e || gt(null), K == null || K(null);
3412
+ else {
3413
+ const Y = { start: null, end: null };
3414
+ ye || Be(Y), j == null || j(Y);
3415
+ }
3416
+ De == null || De();
3417
+ }
3418
+ const Ve = w, We = O, dr = Xi(M), pr = I ?? C, xt = l ?? i, G = S && typeof S == "object" ? S : void 0, mr = S === !0 ? !0 : {
3419
+ ...G,
3420
+ before: h ? G != null && G.before && G.before.isAfter(h, "day") ? G.before : h : G == null ? void 0 : G.before,
3421
+ after: x ? G != null && G.after && G.after.isBefore(x, "day") ? G.after : x : G == null ? void 0 : G.after
3422
+ }, vr = {
3423
+ mode: e,
3424
+ singleValue: ce,
3425
+ rangeValue: q,
3426
+ hoveredDate: or,
3427
+ currentYear: bt,
3428
+ currentMonth: yt,
3429
+ setCurrentYear: (Y) => {
3430
+ cr(Y), Te == null || Te(Y);
3431
+ },
3432
+ setCurrentMonth: (Y) => {
3433
+ lr(Y);
3434
+ },
3435
+ selectDate: ur,
3436
+ setHoveredDate: ir,
3437
+ weekStartsOn: a,
3438
+ locale: xt,
3439
+ showMonthYearSelectors: k,
3440
+ disabled: mr,
3441
+ isDisabled: D,
3442
+ readOnly: A,
3443
+ highlightToday: R,
3444
+ showAdjacentMonthDays: pr,
3445
+ tooltip: $,
3446
+ tooltipDelay: _,
3447
+ format: s,
3448
+ classNames: Ve,
3449
+ styles: We,
3450
+ renderDay: B,
3451
+ renderNavButton: X,
3452
+ onDateChange: K,
3453
+ onRangeChange: j,
3454
+ onTimeChange: J,
3455
+ onMonthChange: vt,
3456
+ onYearChange: Te,
3457
+ onDayHover: ht,
3458
+ onOpen: xe,
3459
+ onClose: Ee,
3460
+ onClear: De
3461
+ }, hr = E ?? (e === "single" ? qi : Gi), Ze = e === "single" ? ce ?? ee(new Date(bt, yt, 1)) : q.end ?? q.start ?? ee(new Date(bt, yt, 1)), gr = (() => {
3462
+ const Y = Ze.format("YYYY-MM-DD"), W = (m == null ? void 0 : m[Y]) ?? y;
3463
+ return W ? In(W) : Ht(f, p, u);
3464
+ })(), yr = Ze.format("HH:mm");
3465
+ function br(Y) {
3466
+ if (!(D || A)) {
3467
+ if (e === "single") {
3468
+ const W = wt(Ze, Y);
3469
+ _e || gt(W), K == null || K(W), J == null || J(W, Y), P || ae();
3470
+ return;
3471
+ }
3472
+ if (q.end) {
3473
+ const W = wt(q.end, Y), Z = { ...q, end: W };
3474
+ ye || Be(Z), j == null || j(Z), J == null || J(W, Y), P || ae();
3475
+ return;
3476
+ }
3477
+ if (q.start) {
3478
+ const W = wt(q.start, Y), Z = { ...q, start: W };
3479
+ ye || Be(Z), j == null || j(Z), J == null || J(W, Y);
3480
+ }
3481
+ }
3482
+ }
3483
+ const wr = { ...dr, ...L };
3484
+ return /* @__PURE__ */ T(kn.Provider, { value: vr, children: /* @__PURE__ */ z(
3485
+ "div",
3486
+ {
3487
+ ref: $e,
3488
+ className: H("fldp-root", F, Ve.root),
3489
+ style: { ...wr, ...We.root },
3490
+ "data-mode": e,
3491
+ "data-open": se,
3492
+ "data-inline": P,
3493
+ children: [
3494
+ !P && /* @__PURE__ */ T(
3495
+ Ui,
3496
+ {
3497
+ mode: e,
3498
+ singleValue: ce,
3499
+ rangeValue: q,
3500
+ format: s,
3501
+ locale: xt,
3502
+ placeholder: hr,
3503
+ isOpen: se,
3504
+ isDisabled: D,
3505
+ readOnly: A,
3506
+ clearable: N,
3507
+ classNames: Ve,
3508
+ styles: We,
3509
+ onOpen: ar,
3510
+ onClear: fr,
3511
+ renderInput: Ye
3512
+ }
3513
+ ),
3514
+ (P || se) && /* @__PURE__ */ z(
3515
+ "div",
3516
+ {
3517
+ role: "dialog",
3518
+ "aria-label": "Date picker",
3519
+ "aria-modal": "false",
3520
+ className: H(
3521
+ "fldp-popover",
3522
+ P && "fldp-popover--inline",
3523
+ !P && `fldp-popover--${sr}`,
3524
+ Ve.popover
3525
+ ),
3526
+ style: We.popover,
3527
+ children: [
3528
+ Array.from({ length: b }, (Y, W) => /* @__PURE__ */ T(Hi, { panelIndex: W, totalPanels: b }, W)),
3529
+ c && /* @__PURE__ */ T(
3530
+ nr,
3531
+ {
3532
+ timeSlots: gr,
3533
+ selectedTime: yr,
3534
+ onSelectTime: br,
3535
+ timeFormat: d,
3536
+ locale: xt,
3537
+ targetDate: Ze,
3538
+ disabledTime: v,
3539
+ isDisabled: D,
3540
+ readOnly: A,
3541
+ classNames: Ve,
3542
+ styles: We
3543
+ }
3544
+ )
3545
+ ]
3546
+ }
3547
+ )
3548
+ ]
3549
+ }
3550
+ ) });
3551
+ }
3552
+ const ts = [
3553
+ { label: "Dates Sélectionnées", className: "fldp-legend-box--selected" },
3554
+ { label: "Disponibilité", className: "fldp-legend-box--available" },
3555
+ { label: "Pas De Disponibilité", className: "fldp-legend-box--unavailable" },
3556
+ { label: "Séjour Minimal", className: "fldp-legend-box--minimal-stay" },
3557
+ { label: "Pas D'Arrivée", className: "fldp-legend-box--no-arrival" }
3558
+ ];
3559
+ function as({
3560
+ items: e = ts,
3561
+ className: t,
3562
+ style: n
3563
+ }) {
3564
+ return /* @__PURE__ */ T("div", { className: `fldp-calendar-legend ${t || ""}`, style: n, children: e.map((r, o) => /* @__PURE__ */ z("div", { className: "fldp-legend-item", children: [
3565
+ /* @__PURE__ */ T("div", { className: `fldp-legend-box ${r.className}` }),
3566
+ /* @__PURE__ */ T("span", { className: "fldp-legend-label", children: r.label })
3567
+ ] }, o)) });
3568
+ }
3569
+ const ns = "HH:mm", rs = "Select time";
3570
+ function us({
3571
+ value: e,
3572
+ defaultValue: t,
3573
+ onChange: n,
3574
+ timeStep: r = 15,
3575
+ minTime: o = "00:00",
3576
+ maxTime: s = "23:59",
3577
+ schedule: i,
3578
+ timeFormat: l = ns,
3579
+ placeholder: a = rs,
3580
+ locale: c,
3581
+ date: f,
3582
+ disabledTime: d,
3583
+ inline: p = !1,
3584
+ isDisabled: u = !1,
3585
+ readOnly: v = !1,
3586
+ clearable: m = !0,
3587
+ onOpen: y,
3588
+ onClose: h,
3589
+ onClear: x,
3590
+ className: E,
3591
+ style: S
3592
+ }) {
3593
+ const D = e !== void 0, [A, N] = oe(t ?? ""), R = D ? e : A, [C, I] = oe(!1), $ = Vt(null), _ = me(() => {
3594
+ p || u || v || (I(!0), y == null || y());
3595
+ }, [p, u, v, y]), M = me(() => {
3596
+ I(!1), h == null || h();
3597
+ }, [h]), w = me(() => {
3598
+ C ? M() : _();
3599
+ }, [C, M, _]), O = f ?? ee(), F = i ? In(i) : Ht(r, o, s);
3600
+ Ne(() => {
3601
+ if (p) return;
3602
+ function V(B) {
3603
+ $.current && !$.current.contains(B.target) && M();
3604
+ }
3605
+ return C && document.addEventListener("mousedown", V), () => document.removeEventListener("mousedown", V);
3606
+ }, [C, p, M]), Ne(() => {
3607
+ if (p) return;
3608
+ function V(B) {
3609
+ B.key === "Escape" && M();
3610
+ }
3611
+ return C && document.addEventListener("keydown", V), () => document.removeEventListener("keydown", V);
3612
+ }, [C, p, M]);
3613
+ function L(V) {
3614
+ D || N(V), n == null || n(V), p || M();
3615
+ }
3616
+ function b(V) {
3617
+ V.stopPropagation(), D || N(""), n == null || n(""), x == null || x();
3618
+ }
3619
+ const k = R && !Cn(O, R, d) ? ee(`2000-01-01T${R}`).locale(c ?? "en").format(l) : R ? ee(`2000-01-01T${R}`).locale(c ?? "en").format(l) : "", P = /* @__PURE__ */ T(
3620
+ nr,
3621
+ {
3622
+ timeSlots: F,
3623
+ selectedTime: R,
3624
+ onSelectTime: L,
3625
+ timeFormat: l,
3626
+ locale: c,
3627
+ targetDate: O,
3628
+ disabledTime: d,
3629
+ isDisabled: u,
3630
+ readOnly: v
3631
+ }
3632
+ );
3633
+ return p ? /* @__PURE__ */ T(
3634
+ "div",
3635
+ {
3636
+ ref: $,
3637
+ className: H("fldp-root fldp-root--time-only", E),
3638
+ style: S,
3639
+ "data-inline": "true",
3640
+ children: /* @__PURE__ */ T(
3641
+ "div",
3642
+ {
3643
+ role: "region",
3644
+ "aria-label": "Time picker",
3645
+ className: "fldp-popover fldp-popover--inline fldp-popover--time-only",
3646
+ children: P
3647
+ }
3648
+ )
3649
+ }
3650
+ ) : /* @__PURE__ */ z(
3651
+ "div",
3652
+ {
3653
+ ref: $,
3654
+ className: H("fldp-root fldp-root--time-only", E),
3655
+ style: S,
3656
+ "data-open": C,
3657
+ children: [
3658
+ /* @__PURE__ */ z(
3659
+ "div",
3660
+ {
3661
+ role: "button",
3662
+ tabIndex: u ? -1 : 0,
3663
+ "aria-label": k || a,
3664
+ "aria-haspopup": "dialog",
3665
+ "aria-expanded": C,
3666
+ className: H(
3667
+ "fldp-input-wrapper",
3668
+ u && "fldp-input-wrapper--disabled",
3669
+ v && "fldp-input-wrapper--readonly",
3670
+ C && "fldp-input-wrapper--open"
3671
+ ),
3672
+ onClick: w,
3673
+ onKeyDown: (V) => {
3674
+ (V.key === "Enter" || V.key === " ") && (V.preventDefault(), w());
3675
+ },
3676
+ children: [
3677
+ /* @__PURE__ */ z(
3678
+ "svg",
3679
+ {
3680
+ className: "fldp-clock-icon",
3681
+ "aria-hidden": "true",
3682
+ width: "16",
3683
+ height: "16",
3684
+ viewBox: "0 0 24 24",
3685
+ fill: "none",
3686
+ stroke: "currentColor",
3687
+ strokeWidth: "2",
3688
+ strokeLinecap: "round",
3689
+ strokeLinejoin: "round",
3690
+ children: [
3691
+ /* @__PURE__ */ T("circle", { cx: "12", cy: "12", r: "10" }),
3692
+ /* @__PURE__ */ T("polyline", { points: "12 6 12 12 16 14" })
3693
+ ]
3694
+ }
3695
+ ),
3696
+ /* @__PURE__ */ T("span", { className: H("fldp-input-value", !k && "fldp-input-value--placeholder"), children: k || a }),
3697
+ m && R && !u && !v && /* @__PURE__ */ T(
3698
+ "button",
3699
+ {
3700
+ type: "button",
3701
+ "aria-label": "Clear time",
3702
+ className: "fldp-clear-button",
3703
+ tabIndex: -1,
3704
+ onClick: b,
3705
+ children: "×"
3706
+ }
3707
+ ),
3708
+ /* @__PURE__ */ T(
3709
+ "svg",
3710
+ {
3711
+ className: H("fldp-input-chevron", C && "fldp-input-chevron--open"),
3712
+ "aria-hidden": "true",
3713
+ width: "14",
3714
+ height: "14",
3715
+ viewBox: "0 0 24 24",
3716
+ fill: "none",
3717
+ stroke: "currentColor",
3718
+ strokeWidth: "2.5",
3719
+ strokeLinecap: "round",
3720
+ strokeLinejoin: "round",
3721
+ children: /* @__PURE__ */ T("polyline", { points: "6 9 12 15 18 9" })
3722
+ }
3723
+ )
3724
+ ]
3725
+ }
3726
+ ),
3727
+ C && /* @__PURE__ */ T(
3728
+ "div",
3729
+ {
3730
+ role: "dialog",
3731
+ "aria-label": "Time picker",
3732
+ "aria-modal": "false",
3733
+ className: "fldp-popover fldp-popover--time-only",
3734
+ children: P
3735
+ }
3736
+ )
3737
+ ]
3738
+ }
3739
+ );
3740
+ }
3741
+ export {
3742
+ Hi as Calendar,
3743
+ Wi as CalendarDay,
3744
+ Yr as CalendarHeader,
3745
+ as as CalendarLegend,
3746
+ cs as DatePicker,
3747
+ kn as DatePickerContext,
3748
+ us as TimePicker,
3749
+ nr as TimeSlotList,
3750
+ Vi as Tooltip,
3751
+ kr as generateCalendarDays,
3752
+ Ht as generateTimeSlots,
3753
+ Or as getMonthNames,
3754
+ Nr as getWeekdayLabels,
3755
+ Nt as isBetween,
3756
+ Pr as isDateDisabled,
3757
+ ls as isInRange,
3758
+ On as isRangeEnd,
3759
+ Nn as isRangeStart,
3760
+ ve as isSameDay,
3761
+ Cn as isTimeDisabled,
3762
+ Wt as useDatePickerContext
3763
+ };
3764
+ //# sourceMappingURL=flexy-date-picker.js.map