@odynn/awayz-core 0.2.32 → 0.3.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.
Files changed (64) hide show
  1. package/dist/AccountService-Ct4hShV-.js +2037 -0
  2. package/dist/DateFormats-DZD30Nea.js +4 -0
  3. package/dist/{_commonjsHelpers-B52_cu2H.js → _commonjsHelpers-MdHo5S7N.js} +2 -2
  4. package/dist/{AccountService-8OR0UkZ6.js → arrayExtensions-DlcBOj5a.js} +1338 -3360
  5. package/dist/assets/FlightBooking.css +1 -0
  6. package/dist/assets/HotelBooking.css +1 -0
  7. package/dist/assets/Menu.css +1 -0
  8. package/dist/components/Bookings/FlightBooking/FlightBooking.js +88 -0
  9. package/dist/components/Bookings/HotelBooking/HotelBooking.js +75 -0
  10. package/dist/components/CashValue/CashValue.js +519 -2173
  11. package/dist/components/CashValue/CashValue.stories.js +18 -17
  12. package/dist/components/Menu/Menu.js +2491 -0
  13. package/dist/configs/endpoints.js +4 -2
  14. package/dist/hooks/useAwayzAuth/useAwayzAuth.js +12 -11
  15. package/dist/hooks/useBookingManagement/useBookingManagement.js +79 -0
  16. package/dist/hooks/useBookingManagement/useBookingManagement.test.js +79 -0
  17. package/dist/hooks/useBookingManagement/useBookingManagement.types.js +1 -0
  18. package/dist/hooks/useSearchLimit.js +2 -1
  19. package/dist/hooks/useTripManagement/mocks/index.js +19 -0
  20. package/dist/hooks/useTripManagement/useTripManagement.js +190 -0
  21. package/dist/hooks/useTripManagement/useTripManagement.test.js +205 -0
  22. package/dist/hooks/useTripManagement/useTripManagement.types.js +1 -0
  23. package/dist/hooks/useWallet/useWallet.js +7 -6
  24. package/dist/hooks/useWallet/useWallet.test.js +17 -12851
  25. package/dist/index-COgXcb6p.js +1696 -0
  26. package/dist/{index-B7QVGqcx.js → index-Cv-wvFlM.js} +1 -1
  27. package/dist/lib/components/Bookings/FlightBooking/FlightBooking.d.ts +59 -0
  28. package/dist/lib/components/Bookings/HotelBooking/HotelBooking.d.ts +52 -0
  29. package/dist/lib/components/Menu/Menu.d.ts +13 -0
  30. package/dist/lib/configs/endpoints.d.ts +12 -0
  31. package/dist/lib/hooks/useBookingManagement/mocks/FlightBooking200.json.d.ts +312 -0
  32. package/dist/lib/hooks/useBookingManagement/mocks/HotelBooking200.json.d.ts +92 -0
  33. package/dist/lib/hooks/useBookingManagement/useBookingManagement.d.ts +11 -0
  34. package/dist/lib/hooks/useBookingManagement/useBookingManagement.test.d.ts +1 -0
  35. package/dist/lib/hooks/useBookingManagement/useBookingManagement.types.d.ts +49 -0
  36. package/dist/lib/hooks/useTripManagement/mocks/PastTrip200.json.d.ts +20 -0
  37. package/dist/lib/hooks/useTripManagement/mocks/UncategorisedBookings200.json.d.ts +123 -0
  38. package/dist/lib/hooks/useTripManagement/mocks/UpcomingTrip200.json.d.ts +20 -0
  39. package/dist/lib/hooks/useTripManagement/mocks/UpdatedTrip200.json.d.ts +18 -0
  40. package/dist/lib/hooks/useTripManagement/mocks/index.d.ts +5 -0
  41. package/dist/lib/hooks/useTripManagement/useTripManagement.d.ts +9 -0
  42. package/dist/lib/hooks/useTripManagement/useTripManagement.test.d.ts +1 -0
  43. package/dist/lib/hooks/useTripManagement/useTripManagement.types.d.ts +109 -0
  44. package/dist/lib/main.d.ts +1 -0
  45. package/dist/lib/services/bookings/BookingService.d.ts +10 -0
  46. package/dist/lib/services/bookings/BookingService.types.d.ts +110 -0
  47. package/dist/lib/services/trips/TripService.types.d.ts +124 -0
  48. package/dist/lib/services/trips/TripsService.d.ts +19 -0
  49. package/dist/main.js +23 -20
  50. package/dist/providers/AwayzProvider.js +8 -7
  51. package/dist/services/account/AccountService.js +3 -2
  52. package/dist/services/bookings/BookingService.js +51 -0
  53. package/dist/services/bookings/BookingService.types.js +1 -0
  54. package/dist/services/currency/CurrencyService.js +11 -10
  55. package/dist/services/index.js +1 -1
  56. package/dist/services/instance.js +4 -3
  57. package/dist/services/instanceConfig.js +7 -6
  58. package/dist/services/noRetryInstance.js +1 -1
  59. package/dist/services/trips/TripService.types.js +9 -0
  60. package/dist/services/trips/TripsService.js +81 -0
  61. package/dist/services/wallet/WalletService.js +18 -23
  62. package/dist/tests/TestWrapper.js +2 -2
  63. package/dist/vi.ClIskdbk-k6t29WRA.js +12860 -0
  64. package/package.json +2 -1
@@ -1,162 +1,84 @@
1
- import { jsx as x, Fragment as yn, jsxs as K } from "react/jsx-runtime";
2
- import * as f from "react";
3
- import ne, { useLayoutEffect as vn, useEffect as wn, useMemo as xn } from "react";
4
- import { r as bt, R as bn } from "../../index-B7QVGqcx.js";
5
- import { E as Cn } from "../../AccountService-8OR0UkZ6.js";
6
- import { useQuery as En } from "@tanstack/react-query";
7
- import { CurrencyService as Pn } from "../../services/currency/CurrencyService.js";
1
+ import { jsx as d, Fragment as tt, jsxs as R } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { useMemo as rt } from "react";
4
+ import { u as N, a as nt, c as A, b as Z, d as he, e as ot, f as st, g as G, o as it, s as at, h as lt, i as ct, j as dt, k as ut, l as pt, m as ft, n as ht, p as vt, P as ve, q as ue } from "../../index-COgXcb6p.js";
5
+ import { r as mt, R as yt } from "../../index-Cv-wvFlM.js";
6
+ import "../../arrayExtensions-DlcBOj5a.js";
7
+ import { E as gt } from "../../AccountService-Ct4hShV-.js";
8
+ import { useQuery as wt } from "@tanstack/react-query";
9
+ import { CurrencyService as Ct } from "../../services/currency/CurrencyService.js";
8
10
  import '../../assets/_styles.css';/* empty css */
9
11
  import "../../context/AwayzContext.js";
10
12
  import "../../configs/awayzClient.js";
11
- import { useAwayzContext as An } from "../../hooks/useAwayzContext.js";
13
+ import { useAwayzContext as Et } from "../../hooks/useAwayzContext.js";
12
14
  import "../../services/noRetryInstance.js";
13
- import { EInvalidAmountDisplayOption as fe, EToolTipPosition as On } from "./CashValueTypes.js";
14
- const Me = (e, t) => {
15
- var n = new Intl.NumberFormat("en-US", {
15
+ import { EInvalidAmountDisplayOption as M, EToolTipPosition as Pt } from "./CashValueTypes.js";
16
+ const j = (e, t) => {
17
+ var r = new Intl.NumberFormat("en-US", {
16
18
  style: "currency",
17
19
  currency: t ?? "USD"
18
20
  });
19
- if (!e) return n.format(0);
20
- const r = parseFloat(e.toString());
21
- return n.format(r);
22
- }, Rn = (e, t) => {
21
+ if (!e) return r.format(0);
22
+ const o = parseFloat(e.toString());
23
+ return r.format(o);
24
+ }, bt = (e, t) => {
23
25
  if (e <= 0) return "N/A";
24
- var n = new Intl.NumberFormat("en-US", {
26
+ var r = new Intl.NumberFormat("en-US", {
25
27
  style: "currency",
26
28
  currency: t ?? "USD"
27
29
  });
28
- return e ? n.format(Math.round(e)).toString().split(".")[0] : n.format(0);
30
+ return e ? r.format(Math.round(e)).toString().split(".")[0] : r.format(0);
29
31
  };
30
- function Y(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
31
- return function(o) {
32
- if (e == null || e(o), n === !1 || !o.defaultPrevented)
33
- return t == null ? void 0 : t(o);
34
- };
35
- }
36
- function ct(e, t) {
37
- if (typeof e == "function")
38
- return e(t);
39
- e != null && (e.current = t);
40
- }
41
- function Tn(...e) {
42
- return (t) => {
43
- let n = !1;
44
- const r = e.map((o) => {
45
- const i = ct(o, t);
46
- return !n && typeof i == "function" && (n = !0), i;
47
- });
48
- if (n)
49
- return () => {
50
- for (let o = 0; o < r.length; o++) {
51
- const i = r[o];
52
- typeof i == "function" ? i() : ct(e[o], null);
53
- }
54
- };
55
- };
56
- }
57
- function ee(...e) {
58
- return f.useCallback(Tn(...e), e);
59
- }
60
- function Ct(e, t = []) {
61
- let n = [];
62
- function r(i, s) {
63
- const c = f.createContext(s), l = n.length;
64
- n = [...n, s];
65
- const a = (d) => {
66
- var v;
67
- const { scope: m, children: p, ...h } = d, g = ((v = m == null ? void 0 : m[e]) == null ? void 0 : v[l]) || c, y = f.useMemo(() => h, Object.values(h));
68
- return /* @__PURE__ */ x(g.Provider, { value: y, children: p });
69
- };
70
- a.displayName = i + "Provider";
71
- function u(d, m) {
72
- var g;
73
- const p = ((g = m == null ? void 0 : m[e]) == null ? void 0 : g[l]) || c, h = f.useContext(p);
74
- if (h) return h;
75
- if (s !== void 0) return s;
76
- throw new Error(`\`${d}\` must be used within \`${i}\``);
77
- }
78
- return [a, u];
79
- }
80
- const o = () => {
81
- const i = n.map((s) => f.createContext(s));
82
- return function(c) {
83
- const l = (c == null ? void 0 : c[e]) || i;
84
- return f.useMemo(
85
- () => ({ [`__scope${e}`]: { ...c, [e]: l } }),
86
- [c, l]
87
- );
88
- };
89
- };
90
- return o.scopeName = e, [r, Sn(o, ...t)];
91
- }
92
- function Sn(...e) {
93
- const t = e[0];
94
- if (e.length === 1) return t;
95
- const n = () => {
96
- const r = e.map((o) => ({
97
- useScope: o(),
98
- scopeName: o.scopeName
99
- }));
100
- return function(i) {
101
- const s = r.reduce((c, { useScope: l, scopeName: a }) => {
102
- const d = l(i)[`__scope${a}`];
103
- return { ...c, ...d };
104
- }, {});
105
- return f.useMemo(() => ({ [`__scope${t.scopeName}`]: s }), [s]);
106
- };
107
- };
108
- return n.scopeName = t.scopeName, n;
109
- }
110
32
  // @__NO_SIDE_EFFECTS__
111
- function Nn(e) {
112
- const t = /* @__PURE__ */ Dn(e), n = f.forwardRef((r, o) => {
113
- const { children: i, ...s } = r, c = f.Children.toArray(i), l = c.find(Mn);
33
+ function xt(e) {
34
+ const t = /* @__PURE__ */ Tt(e), r = i.forwardRef((o, n) => {
35
+ const { children: s, ...a } = o, u = i.Children.toArray(s), l = u.find(Rt);
114
36
  if (l) {
115
- const a = l.props.children, u = c.map((d) => d === l ? f.Children.count(a) > 1 ? f.Children.only(null) : f.isValidElement(a) ? a.props.children : null : d);
116
- return /* @__PURE__ */ x(t, { ...s, ref: o, children: f.isValidElement(a) ? f.cloneElement(a, void 0, u) : null });
37
+ const p = l.props.children, c = u.map((f) => f === l ? i.Children.count(p) > 1 ? i.Children.only(null) : i.isValidElement(p) ? p.props.children : null : f);
38
+ return /* @__PURE__ */ d(t, { ...a, ref: n, children: i.isValidElement(p) ? i.cloneElement(p, void 0, c) : null });
117
39
  }
118
- return /* @__PURE__ */ x(t, { ...s, ref: o, children: i });
40
+ return /* @__PURE__ */ d(t, { ...a, ref: n, children: s });
119
41
  });
120
- return n.displayName = `${e}.Slot`, n;
42
+ return r.displayName = `${e}.Slot`, r;
121
43
  }
122
44
  // @__NO_SIDE_EFFECTS__
123
- function Dn(e) {
124
- const t = f.forwardRef((n, r) => {
125
- const { children: o, ...i } = n, s = f.isValidElement(o) ? In(o) : void 0, c = ee(s, r);
126
- if (f.isValidElement(o)) {
127
- const l = _n(i, o.props);
128
- return o.type !== f.Fragment && (l.ref = c), f.cloneElement(o, l);
45
+ function Tt(e) {
46
+ const t = i.forwardRef((r, o) => {
47
+ const { children: n, ...s } = r, a = i.isValidElement(n) ? St(n) : void 0, u = N(a, o);
48
+ if (i.isValidElement(n)) {
49
+ const l = Ot(s, n.props);
50
+ return n.type !== i.Fragment && (l.ref = u), i.cloneElement(n, l);
129
51
  }
130
- return f.Children.count(o) > 1 ? f.Children.only(null) : null;
52
+ return i.Children.count(n) > 1 ? i.Children.only(null) : null;
131
53
  });
132
54
  return t.displayName = `${e}.SlotClone`, t;
133
55
  }
134
- var Et = Symbol("radix.slottable");
56
+ var me = Symbol("radix.slottable");
135
57
  // @__NO_SIDE_EFFECTS__
136
- function Ln(e) {
137
- const t = ({ children: n }) => /* @__PURE__ */ x(yn, { children: n });
138
- return t.displayName = `${e}.Slottable`, t.__radixId = Et, t;
58
+ function At(e) {
59
+ const t = ({ children: r }) => /* @__PURE__ */ d(tt, { children: r });
60
+ return t.displayName = `${e}.Slottable`, t.__radixId = me, t;
139
61
  }
140
- function Mn(e) {
141
- return f.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === Et;
62
+ function Rt(e) {
63
+ return i.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === me;
142
64
  }
143
- function _n(e, t) {
144
- const n = { ...t };
145
- for (const r in t) {
146
- const o = e[r], i = t[r];
147
- /^on[A-Z]/.test(r) ? o && i ? n[r] = (...c) => {
148
- const l = i(...c);
149
- return o(...c), l;
150
- } : o && (n[r] = o) : r === "style" ? n[r] = { ...o, ...i } : r === "className" && (n[r] = [o, i].filter(Boolean).join(" "));
65
+ function Ot(e, t) {
66
+ const r = { ...t };
67
+ for (const o in t) {
68
+ const n = e[o], s = t[o];
69
+ /^on[A-Z]/.test(o) ? n && s ? r[o] = (...u) => {
70
+ const l = s(...u);
71
+ return n(...u), l;
72
+ } : n && (r[o] = n) : o === "style" ? r[o] = { ...n, ...s } : o === "className" && (r[o] = [n, s].filter(Boolean).join(" "));
151
73
  }
152
- return { ...e, ...n };
74
+ return { ...e, ...r };
153
75
  }
154
- function In(e) {
155
- var r, o;
156
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
157
- return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
76
+ function St(e) {
77
+ var o, n;
78
+ let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, r = t && "isReactWarning" in t && t.isReactWarning;
79
+ return r ? e.ref : (t = (n = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : n.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
158
80
  }
159
- var kn = [
81
+ var Nt = [
160
82
  "a",
161
83
  "button",
162
84
  "div",
@@ -174,1619 +96,267 @@ var kn = [
174
96
  "span",
175
97
  "svg",
176
98
  "ul"
177
- ], te = kn.reduce((e, t) => {
178
- const n = /* @__PURE__ */ Nn(`Primitive.${t}`), r = f.forwardRef((o, i) => {
179
- const { asChild: s, ...c } = o, l = s ? n : t;
180
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ x(l, { ...c, ref: i });
99
+ ], O = Nt.reduce((e, t) => {
100
+ const r = /* @__PURE__ */ xt(`Primitive.${t}`), o = i.forwardRef((n, s) => {
101
+ const { asChild: a, ...u } = n, l = a ? r : t;
102
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ d(l, { ...u, ref: s });
181
103
  });
182
- return r.displayName = `Primitive.${t}`, { ...e, [t]: r };
104
+ return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
183
105
  }, {});
184
- function Fn(e, t) {
185
- e && bt.flushSync(() => e.dispatchEvent(t));
106
+ function Dt(e, t) {
107
+ e && mt.flushSync(() => e.dispatchEvent(t));
186
108
  }
187
- function Re(e) {
188
- const t = f.useRef(e);
189
- return f.useEffect(() => {
190
- t.current = e;
191
- }), f.useMemo(() => (...n) => {
192
- var r;
193
- return (r = t.current) == null ? void 0 : r.call(t, ...n);
194
- }, []);
195
- }
196
- function $n(e, t = globalThis == null ? void 0 : globalThis.document) {
197
- const n = Re(e);
198
- f.useEffect(() => {
199
- const r = (o) => {
200
- o.key === "Escape" && n(o);
201
- };
202
- return t.addEventListener("keydown", r, { capture: !0 }), () => t.removeEventListener("keydown", r, { capture: !0 });
203
- }, [n, t]);
204
- }
205
- var Wn = "DismissableLayer", ke = "dismissableLayer.update", Hn = "dismissableLayer.pointerDownOutside", Bn = "dismissableLayer.focusOutside", lt, Pt = f.createContext({
109
+ var _t = "DismissableLayer", z = "dismissableLayer.update", Lt = "dismissableLayer.pointerDownOutside", It = "dismissableLayer.focusOutside", pe, ye = i.createContext({
206
110
  layers: /* @__PURE__ */ new Set(),
207
111
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
208
112
  branches: /* @__PURE__ */ new Set()
209
- }), At = f.forwardRef(
113
+ }), ge = i.forwardRef(
210
114
  (e, t) => {
211
115
  const {
212
- disableOutsidePointerEvents: n = !1,
213
- onEscapeKeyDown: r,
214
- onPointerDownOutside: o,
215
- onFocusOutside: i,
216
- onInteractOutside: s,
217
- onDismiss: c,
116
+ disableOutsidePointerEvents: r = !1,
117
+ onEscapeKeyDown: o,
118
+ onPointerDownOutside: n,
119
+ onFocusOutside: s,
120
+ onInteractOutside: a,
121
+ onDismiss: u,
218
122
  ...l
219
- } = e, a = f.useContext(Pt), [u, d] = f.useState(null), m = (u == null ? void 0 : u.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, p] = f.useState({}), h = ee(t, (C) => d(C)), g = Array.from(a.layers), [y] = [...a.layersWithOutsidePointerEventsDisabled].slice(-1), v = g.indexOf(y), w = u ? g.indexOf(u) : -1, P = a.layersWithOutsidePointerEventsDisabled.size > 0, b = w >= v, E = Vn((C) => {
220
- const R = C.target, D = [...a.branches].some((T) => T.contains(R));
221
- !b || D || (o == null || o(C), s == null || s(C), C.defaultPrevented || c == null || c());
222
- }, m), A = Un((C) => {
223
- const R = C.target;
224
- [...a.branches].some((T) => T.contains(R)) || (i == null || i(C), s == null || s(C), C.defaultPrevented || c == null || c());
225
- }, m);
226
- return $n((C) => {
227
- w === a.layers.size - 1 && (r == null || r(C), !C.defaultPrevented && c && (C.preventDefault(), c()));
228
- }, m), f.useEffect(() => {
229
- if (u)
230
- return n && (a.layersWithOutsidePointerEventsDisabled.size === 0 && (lt = m.body.style.pointerEvents, m.body.style.pointerEvents = "none"), a.layersWithOutsidePointerEventsDisabled.add(u)), a.layers.add(u), at(), () => {
231
- n && a.layersWithOutsidePointerEventsDisabled.size === 1 && (m.body.style.pointerEvents = lt);
123
+ } = e, p = i.useContext(ye), [c, f] = i.useState(null), h = (c == null ? void 0 : c.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = i.useState({}), m = N(t, (g) => f(g)), y = Array.from(p.layers), [w] = [...p.layersWithOutsidePointerEventsDisabled].slice(-1), E = y.indexOf(w), C = c ? y.indexOf(c) : -1, x = p.layersWithOutsidePointerEventsDisabled.size > 0, P = C >= E, T = kt((g) => {
124
+ const S = g.target, F = [...p.branches].some((L) => L.contains(S));
125
+ !P || F || (n == null || n(g), a == null || a(g), g.defaultPrevented || u == null || u());
126
+ }, h), b = Ft((g) => {
127
+ const S = g.target;
128
+ [...p.branches].some((L) => L.contains(S)) || (s == null || s(g), a == null || a(g), g.defaultPrevented || u == null || u());
129
+ }, h);
130
+ return nt((g) => {
131
+ C === p.layers.size - 1 && (o == null || o(g), !g.defaultPrevented && u && (g.preventDefault(), u()));
132
+ }, h), i.useEffect(() => {
133
+ if (c)
134
+ return r && (p.layersWithOutsidePointerEventsDisabled.size === 0 && (pe = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), p.layersWithOutsidePointerEventsDisabled.add(c)), p.layers.add(c), fe(), () => {
135
+ r && p.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = pe);
232
136
  };
233
- }, [u, m, n, a]), f.useEffect(() => () => {
234
- u && (a.layers.delete(u), a.layersWithOutsidePointerEventsDisabled.delete(u), at());
235
- }, [u, a]), f.useEffect(() => {
236
- const C = () => p({});
237
- return document.addEventListener(ke, C), () => document.removeEventListener(ke, C);
238
- }, []), /* @__PURE__ */ x(
239
- te.div,
137
+ }, [c, h, r, p]), i.useEffect(() => () => {
138
+ c && (p.layers.delete(c), p.layersWithOutsidePointerEventsDisabled.delete(c), fe());
139
+ }, [c, p]), i.useEffect(() => {
140
+ const g = () => v({});
141
+ return document.addEventListener(z, g), () => document.removeEventListener(z, g);
142
+ }, []), /* @__PURE__ */ d(
143
+ O.div,
240
144
  {
241
145
  ...l,
242
- ref: h,
146
+ ref: m,
243
147
  style: {
244
- pointerEvents: P ? b ? "auto" : "none" : void 0,
148
+ pointerEvents: x ? P ? "auto" : "none" : void 0,
245
149
  ...e.style
246
150
  },
247
- onFocusCapture: Y(e.onFocusCapture, A.onFocusCapture),
248
- onBlurCapture: Y(e.onBlurCapture, A.onBlurCapture),
249
- onPointerDownCapture: Y(
151
+ onFocusCapture: A(e.onFocusCapture, b.onFocusCapture),
152
+ onBlurCapture: A(e.onBlurCapture, b.onBlurCapture),
153
+ onPointerDownCapture: A(
250
154
  e.onPointerDownCapture,
251
- E.onPointerDownCapture
155
+ T.onPointerDownCapture
252
156
  )
253
157
  }
254
158
  );
255
159
  }
256
160
  );
257
- At.displayName = Wn;
258
- var jn = "DismissableLayerBranch", zn = f.forwardRef((e, t) => {
259
- const n = f.useContext(Pt), r = f.useRef(null), o = ee(t, r);
260
- return f.useEffect(() => {
261
- const i = r.current;
262
- if (i)
263
- return n.branches.add(i), () => {
264
- n.branches.delete(i);
161
+ ge.displayName = _t;
162
+ var Mt = "DismissableLayerBranch", Ht = i.forwardRef((e, t) => {
163
+ const r = i.useContext(ye), o = i.useRef(null), n = N(t, o);
164
+ return i.useEffect(() => {
165
+ const s = o.current;
166
+ if (s)
167
+ return r.branches.add(s), () => {
168
+ r.branches.delete(s);
265
169
  };
266
- }, [n.branches]), /* @__PURE__ */ x(te.div, { ...e, ref: o });
170
+ }, [r.branches]), /* @__PURE__ */ d(O.div, { ...e, ref: n });
267
171
  });
268
- zn.displayName = jn;
269
- function Vn(e, t = globalThis == null ? void 0 : globalThis.document) {
270
- const n = Re(e), r = f.useRef(!1), o = f.useRef(() => {
172
+ Ht.displayName = Mt;
173
+ function kt(e, t = globalThis == null ? void 0 : globalThis.document) {
174
+ const r = Z(e), o = i.useRef(!1), n = i.useRef(() => {
271
175
  });
272
- return f.useEffect(() => {
273
- const i = (c) => {
274
- if (c.target && !r.current) {
176
+ return i.useEffect(() => {
177
+ const s = (u) => {
178
+ if (u.target && !o.current) {
275
179
  let l = function() {
276
- Ot(
277
- Hn,
278
- n,
279
- a,
180
+ we(
181
+ Lt,
182
+ r,
183
+ p,
280
184
  { discrete: !0 }
281
185
  );
282
186
  };
283
- const a = { originalEvent: c };
284
- c.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = l, t.addEventListener("click", o.current, { once: !0 })) : l();
187
+ const p = { originalEvent: u };
188
+ u.pointerType === "touch" ? (t.removeEventListener("click", n.current), n.current = l, t.addEventListener("click", n.current, { once: !0 })) : l();
285
189
  } else
286
- t.removeEventListener("click", o.current);
287
- r.current = !1;
288
- }, s = window.setTimeout(() => {
289
- t.addEventListener("pointerdown", i);
190
+ t.removeEventListener("click", n.current);
191
+ o.current = !1;
192
+ }, a = window.setTimeout(() => {
193
+ t.addEventListener("pointerdown", s);
290
194
  }, 0);
291
195
  return () => {
292
- window.clearTimeout(s), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
196
+ window.clearTimeout(a), t.removeEventListener("pointerdown", s), t.removeEventListener("click", n.current);
293
197
  };
294
- }, [t, n]), {
198
+ }, [t, r]), {
295
199
  // ensures we check React component tree (not just DOM tree)
296
- onPointerDownCapture: () => r.current = !0
200
+ onPointerDownCapture: () => o.current = !0
297
201
  };
298
202
  }
299
- function Un(e, t = globalThis == null ? void 0 : globalThis.document) {
300
- const n = Re(e), r = f.useRef(!1);
301
- return f.useEffect(() => {
302
- const o = (i) => {
303
- i.target && !r.current && Ot(Bn, n, { originalEvent: i }, {
203
+ function Ft(e, t = globalThis == null ? void 0 : globalThis.document) {
204
+ const r = Z(e), o = i.useRef(!1);
205
+ return i.useEffect(() => {
206
+ const n = (s) => {
207
+ s.target && !o.current && we(It, r, { originalEvent: s }, {
304
208
  discrete: !1
305
209
  });
306
210
  };
307
- return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
308
- }, [t, n]), {
309
- onFocusCapture: () => r.current = !0,
310
- onBlurCapture: () => r.current = !1
211
+ return t.addEventListener("focusin", n), () => t.removeEventListener("focusin", n);
212
+ }, [t, r]), {
213
+ onFocusCapture: () => o.current = !0,
214
+ onBlurCapture: () => o.current = !1
311
215
  };
312
216
  }
313
- function at() {
314
- const e = new CustomEvent(ke);
217
+ function fe() {
218
+ const e = new CustomEvent(z);
315
219
  document.dispatchEvent(e);
316
220
  }
317
- function Ot(e, t, n, { discrete: r }) {
318
- const o = n.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: n });
319
- t && o.addEventListener(e, t, { once: !0 }), r ? Fn(o, i) : o.dispatchEvent(i);
320
- }
321
- var Z = globalThis != null && globalThis.document ? f.useLayoutEffect : () => {
322
- }, Yn = f[" useId ".trim().toString()] || (() => {
323
- }), Xn = 0;
324
- function Gn(e) {
325
- const [t, n] = f.useState(Yn());
326
- return Z(() => {
327
- n((r) => r ?? String(Xn++));
328
- }, [e]), t ? `radix-${t}` : "";
329
- }
330
- const qn = ["top", "right", "bottom", "left"], Q = Math.min, W = Math.max, be = Math.round, ve = Math.floor, z = (e) => ({
331
- x: e,
332
- y: e
333
- }), Kn = {
334
- left: "right",
335
- right: "left",
336
- bottom: "top",
337
- top: "bottom"
338
- }, Zn = {
339
- start: "end",
340
- end: "start"
341
- };
342
- function Fe(e, t, n) {
343
- return W(e, Q(t, n));
344
- }
345
- function G(e, t) {
346
- return typeof e == "function" ? e(t) : e;
347
- }
348
- function q(e) {
349
- return e.split("-")[0];
350
- }
351
- function le(e) {
352
- return e.split("-")[1];
353
- }
354
- function je(e) {
355
- return e === "x" ? "y" : "x";
356
- }
357
- function ze(e) {
358
- return e === "y" ? "height" : "width";
359
- }
360
- function X(e) {
361
- return ["top", "bottom"].includes(q(e)) ? "y" : "x";
362
- }
363
- function Ve(e) {
364
- return je(X(e));
365
- }
366
- function Qn(e, t, n) {
367
- n === void 0 && (n = !1);
368
- const r = le(e), o = Ve(e), i = ze(o);
369
- let s = o === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
370
- return t.reference[i] > t.floating[i] && (s = Ce(s)), [s, Ce(s)];
371
- }
372
- function Jn(e) {
373
- const t = Ce(e);
374
- return [$e(e), t, $e(t)];
375
- }
376
- function $e(e) {
377
- return e.replace(/start|end/g, (t) => Zn[t]);
378
- }
379
- function er(e, t, n) {
380
- const r = ["left", "right"], o = ["right", "left"], i = ["top", "bottom"], s = ["bottom", "top"];
381
- switch (e) {
382
- case "top":
383
- case "bottom":
384
- return n ? t ? o : r : t ? r : o;
385
- case "left":
386
- case "right":
387
- return t ? i : s;
388
- default:
389
- return [];
390
- }
391
- }
392
- function tr(e, t, n, r) {
393
- const o = le(e);
394
- let i = er(q(e), n === "start", r);
395
- return o && (i = i.map((s) => s + "-" + o), t && (i = i.concat(i.map($e)))), i;
396
- }
397
- function Ce(e) {
398
- return e.replace(/left|right|bottom|top/g, (t) => Kn[t]);
399
- }
400
- function nr(e) {
401
- return {
402
- top: 0,
403
- right: 0,
404
- bottom: 0,
405
- left: 0,
406
- ...e
407
- };
408
- }
409
- function Rt(e) {
410
- return typeof e != "number" ? nr(e) : {
411
- top: e,
412
- right: e,
413
- bottom: e,
414
- left: e
415
- };
416
- }
417
- function Ee(e) {
418
- const {
419
- x: t,
420
- y: n,
421
- width: r,
422
- height: o
423
- } = e;
424
- return {
425
- width: r,
426
- height: o,
427
- top: n,
428
- left: t,
429
- right: t + r,
430
- bottom: n + o,
431
- x: t,
432
- y: n
433
- };
434
- }
435
- function ut(e, t, n) {
436
- let {
437
- reference: r,
438
- floating: o
439
- } = e;
440
- const i = X(t), s = Ve(t), c = ze(s), l = q(t), a = i === "y", u = r.x + r.width / 2 - o.width / 2, d = r.y + r.height / 2 - o.height / 2, m = r[c] / 2 - o[c] / 2;
441
- let p;
442
- switch (l) {
443
- case "top":
444
- p = {
445
- x: u,
446
- y: r.y - o.height
447
- };
448
- break;
449
- case "bottom":
450
- p = {
451
- x: u,
452
- y: r.y + r.height
453
- };
454
- break;
455
- case "right":
456
- p = {
457
- x: r.x + r.width,
458
- y: d
459
- };
460
- break;
461
- case "left":
462
- p = {
463
- x: r.x - o.width,
464
- y: d
465
- };
466
- break;
467
- default:
468
- p = {
469
- x: r.x,
470
- y: r.y
471
- };
472
- }
473
- switch (le(t)) {
474
- case "start":
475
- p[s] -= m * (n && a ? -1 : 1);
476
- break;
477
- case "end":
478
- p[s] += m * (n && a ? -1 : 1);
479
- break;
480
- }
481
- return p;
482
- }
483
- const rr = async (e, t, n) => {
484
- const {
485
- placement: r = "bottom",
486
- strategy: o = "absolute",
487
- middleware: i = [],
488
- platform: s
489
- } = n, c = i.filter(Boolean), l = await (s.isRTL == null ? void 0 : s.isRTL(t));
490
- let a = await s.getElementRects({
491
- reference: e,
492
- floating: t,
493
- strategy: o
494
- }), {
495
- x: u,
496
- y: d
497
- } = ut(a, r, l), m = r, p = {}, h = 0;
498
- for (let g = 0; g < c.length; g++) {
499
- const {
500
- name: y,
501
- fn: v
502
- } = c[g], {
503
- x: w,
504
- y: P,
505
- data: b,
506
- reset: E
507
- } = await v({
508
- x: u,
509
- y: d,
510
- initialPlacement: r,
511
- placement: m,
512
- strategy: o,
513
- middlewareData: p,
514
- rects: a,
515
- platform: s,
516
- elements: {
517
- reference: e,
518
- floating: t
519
- }
520
- });
521
- u = w ?? u, d = P ?? d, p = {
522
- ...p,
523
- [y]: {
524
- ...p[y],
525
- ...b
526
- }
527
- }, E && h <= 50 && (h++, typeof E == "object" && (E.placement && (m = E.placement), E.rects && (a = E.rects === !0 ? await s.getElementRects({
528
- reference: e,
529
- floating: t,
530
- strategy: o
531
- }) : E.rects), {
532
- x: u,
533
- y: d
534
- } = ut(a, m, l)), g = -1);
535
- }
536
- return {
537
- x: u,
538
- y: d,
539
- placement: m,
540
- strategy: o,
541
- middlewareData: p
542
- };
543
- };
544
- async function de(e, t) {
545
- var n;
546
- t === void 0 && (t = {});
547
- const {
548
- x: r,
549
- y: o,
550
- platform: i,
551
- rects: s,
552
- elements: c,
553
- strategy: l
554
- } = e, {
555
- boundary: a = "clippingAncestors",
556
- rootBoundary: u = "viewport",
557
- elementContext: d = "floating",
558
- altBoundary: m = !1,
559
- padding: p = 0
560
- } = G(t, e), h = Rt(p), y = c[m ? d === "floating" ? "reference" : "floating" : d], v = Ee(await i.getClippingRect({
561
- element: (n = await (i.isElement == null ? void 0 : i.isElement(y))) == null || n ? y : y.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)),
562
- boundary: a,
563
- rootBoundary: u,
564
- strategy: l
565
- })), w = d === "floating" ? {
566
- x: r,
567
- y: o,
568
- width: s.floating.width,
569
- height: s.floating.height
570
- } : s.reference, P = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), b = await (i.isElement == null ? void 0 : i.isElement(P)) ? await (i.getScale == null ? void 0 : i.getScale(P)) || {
571
- x: 1,
572
- y: 1
573
- } : {
574
- x: 1,
575
- y: 1
576
- }, E = Ee(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
577
- elements: c,
578
- rect: w,
579
- offsetParent: P,
580
- strategy: l
581
- }) : w);
582
- return {
583
- top: (v.top - E.top + h.top) / b.y,
584
- bottom: (E.bottom - v.bottom + h.bottom) / b.y,
585
- left: (v.left - E.left + h.left) / b.x,
586
- right: (E.right - v.right + h.right) / b.x
587
- };
588
- }
589
- const or = (e) => ({
590
- name: "arrow",
591
- options: e,
592
- async fn(t) {
593
- const {
594
- x: n,
595
- y: r,
596
- placement: o,
597
- rects: i,
598
- platform: s,
599
- elements: c,
600
- middlewareData: l
601
- } = t, {
602
- element: a,
603
- padding: u = 0
604
- } = G(e, t) || {};
605
- if (a == null)
606
- return {};
607
- const d = Rt(u), m = {
608
- x: n,
609
- y: r
610
- }, p = Ve(o), h = ze(p), g = await s.getDimensions(a), y = p === "y", v = y ? "top" : "left", w = y ? "bottom" : "right", P = y ? "clientHeight" : "clientWidth", b = i.reference[h] + i.reference[p] - m[p] - i.floating[h], E = m[p] - i.reference[p], A = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a));
611
- let C = A ? A[P] : 0;
612
- (!C || !await (s.isElement == null ? void 0 : s.isElement(A))) && (C = c.floating[P] || i.floating[h]);
613
- const R = b / 2 - E / 2, D = C / 2 - g[h] / 2 - 1, T = Q(d[v], D), F = Q(d[w], D), $ = T, S = C - g[h] - F, k = C / 2 - g[h] / 2 + R, L = Fe($, k, S), M = !l.arrow && le(o) != null && k !== L && i.reference[h] / 2 - (k < $ ? T : F) - g[h] / 2 < 0, _ = M ? k < $ ? k - $ : k - S : 0;
614
- return {
615
- [p]: m[p] + _,
616
- data: {
617
- [p]: L,
618
- centerOffset: k - L - _,
619
- ...M && {
620
- alignmentOffset: _
621
- }
622
- },
623
- reset: M
624
- };
625
- }
626
- }), ir = function(e) {
627
- return e === void 0 && (e = {}), {
628
- name: "flip",
629
- options: e,
630
- async fn(t) {
631
- var n, r;
632
- const {
633
- placement: o,
634
- middlewareData: i,
635
- rects: s,
636
- initialPlacement: c,
637
- platform: l,
638
- elements: a
639
- } = t, {
640
- mainAxis: u = !0,
641
- crossAxis: d = !0,
642
- fallbackPlacements: m,
643
- fallbackStrategy: p = "bestFit",
644
- fallbackAxisSideDirection: h = "none",
645
- flipAlignment: g = !0,
646
- ...y
647
- } = G(e, t);
648
- if ((n = i.arrow) != null && n.alignmentOffset)
649
- return {};
650
- const v = q(o), w = X(c), P = q(c) === c, b = await (l.isRTL == null ? void 0 : l.isRTL(a.floating)), E = m || (P || !g ? [Ce(c)] : Jn(c)), A = h !== "none";
651
- !m && A && E.push(...tr(c, g, h, b));
652
- const C = [c, ...E], R = await de(t, y), D = [];
653
- let T = ((r = i.flip) == null ? void 0 : r.overflows) || [];
654
- if (u && D.push(R[v]), d) {
655
- const L = Qn(o, s, b);
656
- D.push(R[L[0]], R[L[1]]);
657
- }
658
- if (T = [...T, {
659
- placement: o,
660
- overflows: D
661
- }], !D.every((L) => L <= 0)) {
662
- var F, $;
663
- const L = (((F = i.flip) == null ? void 0 : F.index) || 0) + 1, M = C[L];
664
- if (M) {
665
- var S;
666
- const O = d === "alignment" ? w !== X(M) : !1, N = ((S = T[0]) == null ? void 0 : S.overflows[0]) > 0;
667
- if (!O || N)
668
- return {
669
- data: {
670
- index: L,
671
- overflows: T
672
- },
673
- reset: {
674
- placement: M
675
- }
676
- };
677
- }
678
- let _ = ($ = T.filter((O) => O.overflows[0] <= 0).sort((O, N) => O.overflows[1] - N.overflows[1])[0]) == null ? void 0 : $.placement;
679
- if (!_)
680
- switch (p) {
681
- case "bestFit": {
682
- var k;
683
- const O = (k = T.filter((N) => {
684
- if (A) {
685
- const I = X(N.placement);
686
- return I === w || // Create a bias to the `y` side axis due to horizontal
687
- // reading directions favoring greater width.
688
- I === "y";
689
- }
690
- return !0;
691
- }).map((N) => [N.placement, N.overflows.filter((I) => I > 0).reduce((I, oe) => I + oe, 0)]).sort((N, I) => N[1] - I[1])[0]) == null ? void 0 : k[0];
692
- O && (_ = O);
693
- break;
694
- }
695
- case "initialPlacement":
696
- _ = c;
697
- break;
698
- }
699
- if (o !== _)
700
- return {
701
- reset: {
702
- placement: _
703
- }
704
- };
705
- }
706
- return {};
707
- }
708
- };
709
- };
710
- function ft(e, t) {
711
- return {
712
- top: e.top - t.height,
713
- right: e.right - t.width,
714
- bottom: e.bottom - t.height,
715
- left: e.left - t.width
716
- };
717
- }
718
- function dt(e) {
719
- return qn.some((t) => e[t] >= 0);
720
- }
721
- const sr = function(e) {
722
- return e === void 0 && (e = {}), {
723
- name: "hide",
724
- options: e,
725
- async fn(t) {
726
- const {
727
- rects: n
728
- } = t, {
729
- strategy: r = "referenceHidden",
730
- ...o
731
- } = G(e, t);
732
- switch (r) {
733
- case "referenceHidden": {
734
- const i = await de(t, {
735
- ...o,
736
- elementContext: "reference"
737
- }), s = ft(i, n.reference);
738
- return {
739
- data: {
740
- referenceHiddenOffsets: s,
741
- referenceHidden: dt(s)
742
- }
743
- };
744
- }
745
- case "escaped": {
746
- const i = await de(t, {
747
- ...o,
748
- altBoundary: !0
749
- }), s = ft(i, n.floating);
750
- return {
751
- data: {
752
- escapedOffsets: s,
753
- escaped: dt(s)
754
- }
755
- };
756
- }
757
- default:
758
- return {};
759
- }
760
- }
761
- };
762
- };
763
- async function cr(e, t) {
764
- const {
765
- placement: n,
766
- platform: r,
767
- elements: o
768
- } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = q(n), c = le(n), l = X(n) === "y", a = ["left", "top"].includes(s) ? -1 : 1, u = i && l ? -1 : 1, d = G(t, e);
769
- let {
770
- mainAxis: m,
771
- crossAxis: p,
772
- alignmentAxis: h
773
- } = typeof d == "number" ? {
774
- mainAxis: d,
775
- crossAxis: 0,
776
- alignmentAxis: null
777
- } : {
778
- mainAxis: d.mainAxis || 0,
779
- crossAxis: d.crossAxis || 0,
780
- alignmentAxis: d.alignmentAxis
781
- };
782
- return c && typeof h == "number" && (p = c === "end" ? h * -1 : h), l ? {
783
- x: p * u,
784
- y: m * a
785
- } : {
786
- x: m * a,
787
- y: p * u
788
- };
789
- }
790
- const lr = function(e) {
791
- return e === void 0 && (e = 0), {
792
- name: "offset",
793
- options: e,
794
- async fn(t) {
795
- var n, r;
796
- const {
797
- x: o,
798
- y: i,
799
- placement: s,
800
- middlewareData: c
801
- } = t, l = await cr(t, e);
802
- return s === ((n = c.offset) == null ? void 0 : n.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : {
803
- x: o + l.x,
804
- y: i + l.y,
805
- data: {
806
- ...l,
807
- placement: s
808
- }
809
- };
810
- }
811
- };
812
- }, ar = function(e) {
813
- return e === void 0 && (e = {}), {
814
- name: "shift",
815
- options: e,
816
- async fn(t) {
817
- const {
818
- x: n,
819
- y: r,
820
- placement: o
821
- } = t, {
822
- mainAxis: i = !0,
823
- crossAxis: s = !1,
824
- limiter: c = {
825
- fn: (y) => {
826
- let {
827
- x: v,
828
- y: w
829
- } = y;
830
- return {
831
- x: v,
832
- y: w
833
- };
834
- }
835
- },
836
- ...l
837
- } = G(e, t), a = {
838
- x: n,
839
- y: r
840
- }, u = await de(t, l), d = X(q(o)), m = je(d);
841
- let p = a[m], h = a[d];
842
- if (i) {
843
- const y = m === "y" ? "top" : "left", v = m === "y" ? "bottom" : "right", w = p + u[y], P = p - u[v];
844
- p = Fe(w, p, P);
845
- }
846
- if (s) {
847
- const y = d === "y" ? "top" : "left", v = d === "y" ? "bottom" : "right", w = h + u[y], P = h - u[v];
848
- h = Fe(w, h, P);
849
- }
850
- const g = c.fn({
851
- ...t,
852
- [m]: p,
853
- [d]: h
854
- });
855
- return {
856
- ...g,
857
- data: {
858
- x: g.x - n,
859
- y: g.y - r,
860
- enabled: {
861
- [m]: i,
862
- [d]: s
863
- }
864
- }
865
- };
866
- }
867
- };
868
- }, ur = function(e) {
869
- return e === void 0 && (e = {}), {
870
- options: e,
871
- fn(t) {
872
- const {
873
- x: n,
874
- y: r,
875
- placement: o,
876
- rects: i,
877
- middlewareData: s
878
- } = t, {
879
- offset: c = 0,
880
- mainAxis: l = !0,
881
- crossAxis: a = !0
882
- } = G(e, t), u = {
883
- x: n,
884
- y: r
885
- }, d = X(o), m = je(d);
886
- let p = u[m], h = u[d];
887
- const g = G(c, t), y = typeof g == "number" ? {
888
- mainAxis: g,
889
- crossAxis: 0
890
- } : {
891
- mainAxis: 0,
892
- crossAxis: 0,
893
- ...g
894
- };
895
- if (l) {
896
- const P = m === "y" ? "height" : "width", b = i.reference[m] - i.floating[P] + y.mainAxis, E = i.reference[m] + i.reference[P] - y.mainAxis;
897
- p < b ? p = b : p > E && (p = E);
898
- }
899
- if (a) {
900
- var v, w;
901
- const P = m === "y" ? "width" : "height", b = ["top", "left"].includes(q(o)), E = i.reference[d] - i.floating[P] + (b && ((v = s.offset) == null ? void 0 : v[d]) || 0) + (b ? 0 : y.crossAxis), A = i.reference[d] + i.reference[P] + (b ? 0 : ((w = s.offset) == null ? void 0 : w[d]) || 0) - (b ? y.crossAxis : 0);
902
- h < E ? h = E : h > A && (h = A);
903
- }
904
- return {
905
- [m]: p,
906
- [d]: h
907
- };
908
- }
909
- };
910
- }, fr = function(e) {
911
- return e === void 0 && (e = {}), {
912
- name: "size",
913
- options: e,
914
- async fn(t) {
915
- var n, r;
916
- const {
917
- placement: o,
918
- rects: i,
919
- platform: s,
920
- elements: c
921
- } = t, {
922
- apply: l = () => {
923
- },
924
- ...a
925
- } = G(e, t), u = await de(t, a), d = q(o), m = le(o), p = X(o) === "y", {
926
- width: h,
927
- height: g
928
- } = i.floating;
929
- let y, v;
930
- d === "top" || d === "bottom" ? (y = d, v = m === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (v = d, y = m === "end" ? "top" : "bottom");
931
- const w = g - u.top - u.bottom, P = h - u.left - u.right, b = Q(g - u[y], w), E = Q(h - u[v], P), A = !t.middlewareData.shift;
932
- let C = b, R = E;
933
- if ((n = t.middlewareData.shift) != null && n.enabled.x && (R = P), (r = t.middlewareData.shift) != null && r.enabled.y && (C = w), A && !m) {
934
- const T = W(u.left, 0), F = W(u.right, 0), $ = W(u.top, 0), S = W(u.bottom, 0);
935
- p ? R = h - 2 * (T !== 0 || F !== 0 ? T + F : W(u.left, u.right)) : C = g - 2 * ($ !== 0 || S !== 0 ? $ + S : W(u.top, u.bottom));
936
- }
937
- await l({
938
- ...t,
939
- availableWidth: R,
940
- availableHeight: C
941
- });
942
- const D = await s.getDimensions(c.floating);
943
- return h !== D.width || g !== D.height ? {
944
- reset: {
945
- rects: !0
946
- }
947
- } : {};
948
- }
949
- };
950
- };
951
- function Te() {
952
- return typeof window < "u";
953
- }
954
- function ae(e) {
955
- return Tt(e) ? (e.nodeName || "").toLowerCase() : "#document";
956
- }
957
- function H(e) {
958
- var t;
959
- return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
960
- }
961
- function U(e) {
962
- var t;
963
- return (t = (Tt(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement;
964
- }
965
- function Tt(e) {
966
- return Te() ? e instanceof Node || e instanceof H(e).Node : !1;
967
- }
968
- function B(e) {
969
- return Te() ? e instanceof Element || e instanceof H(e).Element : !1;
970
- }
971
- function V(e) {
972
- return Te() ? e instanceof HTMLElement || e instanceof H(e).HTMLElement : !1;
973
- }
974
- function pt(e) {
975
- return !Te() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof H(e).ShadowRoot;
976
- }
977
- function he(e) {
978
- const {
979
- overflow: t,
980
- overflowX: n,
981
- overflowY: r,
982
- display: o
983
- } = j(e);
984
- return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o);
985
- }
986
- function dr(e) {
987
- return ["table", "td", "th"].includes(ae(e));
988
- }
989
- function Se(e) {
990
- return [":popover-open", ":modal"].some((t) => {
991
- try {
992
- return e.matches(t);
993
- } catch {
994
- return !1;
995
- }
996
- });
997
- }
998
- function Ue(e) {
999
- const t = Ye(), n = B(e) ? j(e) : e;
1000
- return ["transform", "translate", "scale", "rotate", "perspective"].some((r) => n[r] ? n[r] !== "none" : !1) || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r));
1001
- }
1002
- function pr(e) {
1003
- let t = J(e);
1004
- for (; V(t) && !se(t); ) {
1005
- if (Ue(t))
1006
- return t;
1007
- if (Se(t))
1008
- return null;
1009
- t = J(t);
1010
- }
1011
- return null;
1012
- }
1013
- function Ye() {
1014
- return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
1015
- }
1016
- function se(e) {
1017
- return ["html", "body", "#document"].includes(ae(e));
1018
- }
1019
- function j(e) {
1020
- return H(e).getComputedStyle(e);
221
+ function we(e, t, r, { discrete: o }) {
222
+ const n = r.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: r });
223
+ t && n.addEventListener(e, t, { once: !0 }), o ? Dt(n, s) : n.dispatchEvent(s);
1021
224
  }
1022
- function Ne(e) {
1023
- return B(e) ? {
1024
- scrollLeft: e.scrollLeft,
1025
- scrollTop: e.scrollTop
1026
- } : {
1027
- scrollLeft: e.scrollX,
1028
- scrollTop: e.scrollY
1029
- };
1030
- }
1031
- function J(e) {
1032
- if (ae(e) === "html")
1033
- return e;
1034
- const t = (
1035
- // Step into the shadow DOM of the parent of a slotted node.
1036
- e.assignedSlot || // DOM Element detected.
1037
- e.parentNode || // ShadowRoot detected.
1038
- pt(e) && e.host || // Fallback.
1039
- U(e)
1040
- );
1041
- return pt(t) ? t.host : t;
1042
- }
1043
- function St(e) {
1044
- const t = J(e);
1045
- return se(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : V(t) && he(t) ? t : St(t);
1046
- }
1047
- function pe(e, t, n) {
1048
- var r;
1049
- t === void 0 && (t = []), n === void 0 && (n = !0);
1050
- const o = St(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = H(o);
1051
- if (i) {
1052
- const c = We(s);
1053
- return t.concat(s, s.visualViewport || [], he(o) ? o : [], c && n ? pe(c) : []);
1054
- }
1055
- return t.concat(o, pe(o, [], n));
1056
- }
1057
- function We(e) {
1058
- return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
1059
- }
1060
- function Nt(e) {
1061
- const t = j(e);
1062
- let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0;
1063
- const o = V(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, c = be(n) !== i || be(r) !== s;
1064
- return c && (n = i, r = s), {
1065
- width: n,
1066
- height: r,
1067
- $: c
1068
- };
1069
- }
1070
- function Xe(e) {
1071
- return B(e) ? e : e.contextElement;
1072
- }
1073
- function ie(e) {
1074
- const t = Xe(e);
1075
- if (!V(t))
1076
- return z(1);
1077
- const n = t.getBoundingClientRect(), {
1078
- width: r,
1079
- height: o,
1080
- $: i
1081
- } = Nt(t);
1082
- let s = (i ? be(n.width) : n.width) / r, c = (i ? be(n.height) : n.height) / o;
1083
- return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
1084
- x: s,
1085
- y: c
1086
- };
1087
- }
1088
- const mr = /* @__PURE__ */ z(0);
1089
- function Dt(e) {
1090
- const t = H(e);
1091
- return !Ye() || !t.visualViewport ? mr : {
1092
- x: t.visualViewport.offsetLeft,
1093
- y: t.visualViewport.offsetTop
1094
- };
1095
- }
1096
- function hr(e, t, n) {
1097
- return t === void 0 && (t = !1), !n || t && n !== H(e) ? !1 : t;
1098
- }
1099
- function re(e, t, n, r) {
1100
- t === void 0 && (t = !1), n === void 0 && (n = !1);
1101
- const o = e.getBoundingClientRect(), i = Xe(e);
1102
- let s = z(1);
1103
- t && (r ? B(r) && (s = ie(r)) : s = ie(e));
1104
- const c = hr(i, n, r) ? Dt(i) : z(0);
1105
- let l = (o.left + c.x) / s.x, a = (o.top + c.y) / s.y, u = o.width / s.x, d = o.height / s.y;
1106
- if (i) {
1107
- const m = H(i), p = r && B(r) ? H(r) : r;
1108
- let h = m, g = We(h);
1109
- for (; g && r && p !== h; ) {
1110
- const y = ie(g), v = g.getBoundingClientRect(), w = j(g), P = v.left + (g.clientLeft + parseFloat(w.paddingLeft)) * y.x, b = v.top + (g.clientTop + parseFloat(w.paddingTop)) * y.y;
1111
- l *= y.x, a *= y.y, u *= y.x, d *= y.y, l += P, a += b, h = H(g), g = We(h);
1112
- }
1113
- }
1114
- return Ee({
1115
- width: u,
1116
- height: d,
1117
- x: l,
1118
- y: a
1119
- });
1120
- }
1121
- function Ge(e, t) {
1122
- const n = Ne(e).scrollLeft;
1123
- return t ? t.left + n : re(U(e)).left + n;
1124
- }
1125
- function Lt(e, t, n) {
1126
- n === void 0 && (n = !1);
1127
- const r = e.getBoundingClientRect(), o = r.left + t.scrollLeft - (n ? 0 : (
1128
- // RTL <body> scrollbar.
1129
- Ge(e, r)
1130
- )), i = r.top + t.scrollTop;
1131
- return {
1132
- x: o,
1133
- y: i
1134
- };
1135
- }
1136
- function gr(e) {
1137
- let {
1138
- elements: t,
1139
- rect: n,
1140
- offsetParent: r,
1141
- strategy: o
1142
- } = e;
1143
- const i = o === "fixed", s = U(r), c = t ? Se(t.floating) : !1;
1144
- if (r === s || c && i)
1145
- return n;
1146
- let l = {
1147
- scrollLeft: 0,
1148
- scrollTop: 0
1149
- }, a = z(1);
1150
- const u = z(0), d = V(r);
1151
- if ((d || !d && !i) && ((ae(r) !== "body" || he(s)) && (l = Ne(r)), V(r))) {
1152
- const p = re(r);
1153
- a = ie(r), u.x = p.x + r.clientLeft, u.y = p.y + r.clientTop;
1154
- }
1155
- const m = s && !d && !i ? Lt(s, l, !0) : z(0);
1156
- return {
1157
- width: n.width * a.x,
1158
- height: n.height * a.y,
1159
- x: n.x * a.x - l.scrollLeft * a.x + u.x + m.x,
1160
- y: n.y * a.y - l.scrollTop * a.y + u.y + m.y
1161
- };
1162
- }
1163
- function yr(e) {
1164
- return Array.from(e.getClientRects());
1165
- }
1166
- function vr(e) {
1167
- const t = U(e), n = Ne(e), r = e.ownerDocument.body, o = W(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = W(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight);
1168
- let s = -n.scrollLeft + Ge(e);
1169
- const c = -n.scrollTop;
1170
- return j(r).direction === "rtl" && (s += W(t.clientWidth, r.clientWidth) - o), {
1171
- width: o,
1172
- height: i,
1173
- x: s,
1174
- y: c
1175
- };
1176
- }
1177
- function wr(e, t) {
1178
- const n = H(e), r = U(e), o = n.visualViewport;
1179
- let i = r.clientWidth, s = r.clientHeight, c = 0, l = 0;
1180
- if (o) {
1181
- i = o.width, s = o.height;
1182
- const a = Ye();
1183
- (!a || a && t === "fixed") && (c = o.offsetLeft, l = o.offsetTop);
1184
- }
1185
- return {
1186
- width: i,
1187
- height: s,
1188
- x: c,
1189
- y: l
1190
- };
1191
- }
1192
- function xr(e, t) {
1193
- const n = re(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = V(e) ? ie(e) : z(1), s = e.clientWidth * i.x, c = e.clientHeight * i.y, l = o * i.x, a = r * i.y;
1194
- return {
1195
- width: s,
1196
- height: c,
1197
- x: l,
1198
- y: a
1199
- };
1200
- }
1201
- function mt(e, t, n) {
1202
- let r;
1203
- if (t === "viewport")
1204
- r = wr(e, n);
1205
- else if (t === "document")
1206
- r = vr(U(e));
1207
- else if (B(t))
1208
- r = xr(t, n);
1209
- else {
1210
- const o = Dt(e);
1211
- r = {
1212
- x: t.x - o.x,
1213
- y: t.y - o.y,
1214
- width: t.width,
1215
- height: t.height
1216
- };
1217
- }
1218
- return Ee(r);
1219
- }
1220
- function Mt(e, t) {
1221
- const n = J(e);
1222
- return n === t || !B(n) || se(n) ? !1 : j(n).position === "fixed" || Mt(n, t);
1223
- }
1224
- function br(e, t) {
1225
- const n = t.get(e);
1226
- if (n)
1227
- return n;
1228
- let r = pe(e, [], !1).filter((c) => B(c) && ae(c) !== "body"), o = null;
1229
- const i = j(e).position === "fixed";
1230
- let s = i ? J(e) : e;
1231
- for (; B(s) && !se(s); ) {
1232
- const c = j(s), l = Ue(s);
1233
- !l && c.position === "fixed" && (o = null), (i ? !l && !o : !l && c.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || he(s) && !l && Mt(e, s)) ? r = r.filter((u) => u !== s) : o = c, s = J(s);
1234
- }
1235
- return t.set(e, r), r;
1236
- }
1237
- function Cr(e) {
1238
- let {
1239
- element: t,
1240
- boundary: n,
1241
- rootBoundary: r,
1242
- strategy: o
1243
- } = e;
1244
- const s = [...n === "clippingAncestors" ? Se(t) ? [] : br(t, this._c) : [].concat(n), r], c = s[0], l = s.reduce((a, u) => {
1245
- const d = mt(t, u, o);
1246
- return a.top = W(d.top, a.top), a.right = Q(d.right, a.right), a.bottom = Q(d.bottom, a.bottom), a.left = W(d.left, a.left), a;
1247
- }, mt(t, c, o));
1248
- return {
1249
- width: l.right - l.left,
1250
- height: l.bottom - l.top,
1251
- x: l.left,
1252
- y: l.top
1253
- };
1254
- }
1255
- function Er(e) {
1256
- const {
1257
- width: t,
1258
- height: n
1259
- } = Nt(e);
1260
- return {
1261
- width: t,
1262
- height: n
1263
- };
1264
- }
1265
- function Pr(e, t, n) {
1266
- const r = V(t), o = U(t), i = n === "fixed", s = re(e, !0, i, t);
1267
- let c = {
1268
- scrollLeft: 0,
1269
- scrollTop: 0
1270
- };
1271
- const l = z(0);
1272
- function a() {
1273
- l.x = Ge(o);
1274
- }
1275
- if (r || !r && !i)
1276
- if ((ae(t) !== "body" || he(o)) && (c = Ne(t)), r) {
1277
- const p = re(t, !0, i, t);
1278
- l.x = p.x + t.clientLeft, l.y = p.y + t.clientTop;
1279
- } else o && a();
1280
- i && !r && o && a();
1281
- const u = o && !r && !i ? Lt(o, c) : z(0), d = s.left + c.scrollLeft - l.x - u.x, m = s.top + c.scrollTop - l.y - u.y;
1282
- return {
1283
- x: d,
1284
- y: m,
1285
- width: s.width,
1286
- height: s.height
1287
- };
1288
- }
1289
- function _e(e) {
1290
- return j(e).position === "static";
1291
- }
1292
- function ht(e, t) {
1293
- if (!V(e) || j(e).position === "fixed")
1294
- return null;
1295
- if (t)
1296
- return t(e);
1297
- let n = e.offsetParent;
1298
- return U(e) === n && (n = n.ownerDocument.body), n;
1299
- }
1300
- function _t(e, t) {
1301
- const n = H(e);
1302
- if (Se(e))
1303
- return n;
1304
- if (!V(e)) {
1305
- let o = J(e);
1306
- for (; o && !se(o); ) {
1307
- if (B(o) && !_e(o))
1308
- return o;
1309
- o = J(o);
1310
- }
1311
- return n;
1312
- }
1313
- let r = ht(e, t);
1314
- for (; r && dr(r) && _e(r); )
1315
- r = ht(r, t);
1316
- return r && se(r) && _e(r) && !Ue(r) ? n : r || pr(e) || n;
1317
- }
1318
- const Ar = async function(e) {
1319
- const t = this.getOffsetParent || _t, n = this.getDimensions, r = await n(e.floating);
1320
- return {
1321
- reference: Pr(e.reference, await t(e.floating), e.strategy),
1322
- floating: {
1323
- x: 0,
1324
- y: 0,
1325
- width: r.width,
1326
- height: r.height
1327
- }
1328
- };
1329
- };
1330
- function Or(e) {
1331
- return j(e).direction === "rtl";
1332
- }
1333
- const Rr = {
1334
- convertOffsetParentRelativeRectToViewportRelativeRect: gr,
1335
- getDocumentElement: U,
1336
- getClippingRect: Cr,
1337
- getOffsetParent: _t,
1338
- getElementRects: Ar,
1339
- getClientRects: yr,
1340
- getDimensions: Er,
1341
- getScale: ie,
1342
- isElement: B,
1343
- isRTL: Or
1344
- };
1345
- function It(e, t) {
1346
- return e.x === t.x && e.y === t.y && e.width === t.width && e.height === t.height;
1347
- }
1348
- function Tr(e, t) {
1349
- let n = null, r;
1350
- const o = U(e);
1351
- function i() {
1352
- var c;
1353
- clearTimeout(r), (c = n) == null || c.disconnect(), n = null;
1354
- }
1355
- function s(c, l) {
1356
- c === void 0 && (c = !1), l === void 0 && (l = 1), i();
1357
- const a = e.getBoundingClientRect(), {
1358
- left: u,
1359
- top: d,
1360
- width: m,
1361
- height: p
1362
- } = a;
1363
- if (c || t(), !m || !p)
1364
- return;
1365
- const h = ve(d), g = ve(o.clientWidth - (u + m)), y = ve(o.clientHeight - (d + p)), v = ve(u), P = {
1366
- rootMargin: -h + "px " + -g + "px " + -y + "px " + -v + "px",
1367
- threshold: W(0, Q(1, l)) || 1
1368
- };
1369
- let b = !0;
1370
- function E(A) {
1371
- const C = A[0].intersectionRatio;
1372
- if (C !== l) {
1373
- if (!b)
1374
- return s();
1375
- C ? s(!1, C) : r = setTimeout(() => {
1376
- s(!1, 1e-7);
1377
- }, 1e3);
1378
- }
1379
- C === 1 && !It(a, e.getBoundingClientRect()) && s(), b = !1;
1380
- }
1381
- try {
1382
- n = new IntersectionObserver(E, {
1383
- ...P,
1384
- // Handle <iframe>s
1385
- root: o.ownerDocument
1386
- });
1387
- } catch {
1388
- n = new IntersectionObserver(E, P);
1389
- }
1390
- n.observe(e);
1391
- }
1392
- return s(!0), i;
1393
- }
1394
- function Sr(e, t, n, r) {
1395
- r === void 0 && (r = {});
1396
- const {
1397
- ancestorScroll: o = !0,
1398
- ancestorResize: i = !0,
1399
- elementResize: s = typeof ResizeObserver == "function",
1400
- layoutShift: c = typeof IntersectionObserver == "function",
1401
- animationFrame: l = !1
1402
- } = r, a = Xe(e), u = o || i ? [...a ? pe(a) : [], ...pe(t)] : [];
1403
- u.forEach((v) => {
1404
- o && v.addEventListener("scroll", n, {
1405
- passive: !0
1406
- }), i && v.addEventListener("resize", n);
1407
- });
1408
- const d = a && c ? Tr(a, n) : null;
1409
- let m = -1, p = null;
1410
- s && (p = new ResizeObserver((v) => {
1411
- let [w] = v;
1412
- w && w.target === a && p && (p.unobserve(t), cancelAnimationFrame(m), m = requestAnimationFrame(() => {
1413
- var P;
1414
- (P = p) == null || P.observe(t);
1415
- })), n();
1416
- }), a && !l && p.observe(a), p.observe(t));
1417
- let h, g = l ? re(e) : null;
1418
- l && y();
1419
- function y() {
1420
- const v = re(e);
1421
- g && !It(g, v) && n(), g = v, h = requestAnimationFrame(y);
1422
- }
1423
- return n(), () => {
1424
- var v;
1425
- u.forEach((w) => {
1426
- o && w.removeEventListener("scroll", n), i && w.removeEventListener("resize", n);
1427
- }), d == null || d(), (v = p) == null || v.disconnect(), p = null, l && cancelAnimationFrame(h);
1428
- };
1429
- }
1430
- const Nr = lr, Dr = ar, Lr = ir, Mr = fr, _r = sr, gt = or, Ir = ur, kr = (e, t, n) => {
1431
- const r = /* @__PURE__ */ new Map(), o = {
1432
- platform: Rr,
1433
- ...n
1434
- }, i = {
1435
- ...o.platform,
1436
- _c: r
1437
- };
1438
- return rr(e, t, {
1439
- ...o,
1440
- platform: i
1441
- });
1442
- };
1443
- var xe = typeof document < "u" ? vn : wn;
1444
- function Pe(e, t) {
1445
- if (e === t)
1446
- return !0;
1447
- if (typeof e != typeof t)
1448
- return !1;
1449
- if (typeof e == "function" && e.toString() === t.toString())
1450
- return !0;
1451
- let n, r, o;
1452
- if (e && t && typeof e == "object") {
1453
- if (Array.isArray(e)) {
1454
- if (n = e.length, n !== t.length) return !1;
1455
- for (r = n; r-- !== 0; )
1456
- if (!Pe(e[r], t[r]))
1457
- return !1;
1458
- return !0;
1459
- }
1460
- if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length)
1461
- return !1;
1462
- for (r = n; r-- !== 0; )
1463
- if (!{}.hasOwnProperty.call(t, o[r]))
1464
- return !1;
1465
- for (r = n; r-- !== 0; ) {
1466
- const i = o[r];
1467
- if (!(i === "_owner" && e.$$typeof) && !Pe(e[i], t[i]))
1468
- return !1;
1469
- }
1470
- return !0;
1471
- }
1472
- return e !== e && t !== t;
1473
- }
1474
- function kt(e) {
1475
- return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1;
1476
- }
1477
- function yt(e, t) {
1478
- const n = kt(e);
1479
- return Math.round(t * n) / n;
1480
- }
1481
- function Ie(e) {
1482
- const t = f.useRef(e);
1483
- return xe(() => {
1484
- t.current = e;
1485
- }), t;
1486
- }
1487
- function Fr(e) {
1488
- e === void 0 && (e = {});
1489
- const {
1490
- placement: t = "bottom",
1491
- strategy: n = "absolute",
1492
- middleware: r = [],
1493
- platform: o,
1494
- elements: {
1495
- reference: i,
1496
- floating: s
1497
- } = {},
1498
- transform: c = !0,
1499
- whileElementsMounted: l,
1500
- open: a
1501
- } = e, [u, d] = f.useState({
1502
- x: 0,
1503
- y: 0,
1504
- strategy: n,
1505
- placement: t,
1506
- middlewareData: {},
1507
- isPositioned: !1
1508
- }), [m, p] = f.useState(r);
1509
- Pe(m, r) || p(r);
1510
- const [h, g] = f.useState(null), [y, v] = f.useState(null), w = f.useCallback((O) => {
1511
- O !== A.current && (A.current = O, g(O));
1512
- }, []), P = f.useCallback((O) => {
1513
- O !== C.current && (C.current = O, v(O));
1514
- }, []), b = i || h, E = s || y, A = f.useRef(null), C = f.useRef(null), R = f.useRef(u), D = l != null, T = Ie(l), F = Ie(o), $ = Ie(a), S = f.useCallback(() => {
1515
- if (!A.current || !C.current)
1516
- return;
1517
- const O = {
1518
- placement: t,
1519
- strategy: n,
1520
- middleware: m
1521
- };
1522
- F.current && (O.platform = F.current), kr(A.current, C.current, O).then((N) => {
1523
- const I = {
1524
- ...N,
1525
- // The floating element's position may be recomputed while it's closed
1526
- // but still mounted (such as when transitioning out). To ensure
1527
- // `isPositioned` will be `false` initially on the next open, avoid
1528
- // setting it to `true` when `open === false` (must be specified).
1529
- isPositioned: $.current !== !1
1530
- };
1531
- k.current && !Pe(R.current, I) && (R.current = I, bt.flushSync(() => {
1532
- d(I);
1533
- }));
1534
- });
1535
- }, [m, t, n, F, $]);
1536
- xe(() => {
1537
- a === !1 && R.current.isPositioned && (R.current.isPositioned = !1, d((O) => ({
1538
- ...O,
1539
- isPositioned: !1
1540
- })));
1541
- }, [a]);
1542
- const k = f.useRef(!1);
1543
- xe(() => (k.current = !0, () => {
1544
- k.current = !1;
1545
- }), []), xe(() => {
1546
- if (b && (A.current = b), E && (C.current = E), b && E) {
1547
- if (T.current)
1548
- return T.current(b, E, S);
1549
- S();
1550
- }
1551
- }, [b, E, S, T, D]);
1552
- const L = f.useMemo(() => ({
1553
- reference: A,
1554
- floating: C,
1555
- setReference: w,
1556
- setFloating: P
1557
- }), [w, P]), M = f.useMemo(() => ({
1558
- reference: b,
1559
- floating: E
1560
- }), [b, E]), _ = f.useMemo(() => {
1561
- const O = {
1562
- position: n,
1563
- left: 0,
1564
- top: 0
1565
- };
1566
- if (!M.floating)
1567
- return O;
1568
- const N = yt(M.floating, u.x), I = yt(M.floating, u.y);
1569
- return c ? {
1570
- ...O,
1571
- transform: "translate(" + N + "px, " + I + "px)",
1572
- ...kt(M.floating) >= 1.5 && {
1573
- willChange: "transform"
1574
- }
1575
- } : {
1576
- position: n,
1577
- left: N,
1578
- top: I
1579
- };
1580
- }, [n, c, M.floating, u.x, u.y]);
1581
- return f.useMemo(() => ({
1582
- ...u,
1583
- update: S,
1584
- refs: L,
1585
- elements: M,
1586
- floatingStyles: _
1587
- }), [u, S, L, M, _]);
1588
- }
1589
- const $r = (e) => {
1590
- function t(n) {
1591
- return {}.hasOwnProperty.call(n, "current");
1592
- }
1593
- return {
1594
- name: "arrow",
1595
- options: e,
1596
- fn(n) {
1597
- const {
1598
- element: r,
1599
- padding: o
1600
- } = typeof e == "function" ? e(n) : e;
1601
- return r && t(r) ? r.current != null ? gt({
1602
- element: r.current,
1603
- padding: o
1604
- }).fn(n) : {} : r ? gt({
1605
- element: r,
1606
- padding: o
1607
- }).fn(n) : {};
1608
- }
1609
- };
1610
- }, Wr = (e, t) => ({
1611
- ...Nr(e),
1612
- options: [e, t]
1613
- }), Hr = (e, t) => ({
1614
- ...Dr(e),
1615
- options: [e, t]
1616
- }), Br = (e, t) => ({
1617
- ...Ir(e),
1618
- options: [e, t]
1619
- }), jr = (e, t) => ({
1620
- ...Lr(e),
1621
- options: [e, t]
1622
- }), zr = (e, t) => ({
1623
- ...Mr(e),
1624
- options: [e, t]
1625
- }), Vr = (e, t) => ({
1626
- ..._r(e),
1627
- options: [e, t]
1628
- }), Ur = (e, t) => ({
1629
- ...$r(e),
1630
- options: [e, t]
1631
- });
1632
- var Yr = "Arrow", Ft = f.forwardRef((e, t) => {
1633
- const { children: n, width: r = 10, height: o = 5, ...i } = e;
1634
- return /* @__PURE__ */ x(
1635
- te.svg,
225
+ var $t = "Arrow", Ce = i.forwardRef((e, t) => {
226
+ const { children: r, width: o = 10, height: n = 5, ...s } = e;
227
+ return /* @__PURE__ */ d(
228
+ O.svg,
1636
229
  {
1637
- ...i,
230
+ ...s,
1638
231
  ref: t,
1639
- width: r,
1640
- height: o,
232
+ width: o,
233
+ height: n,
1641
234
  viewBox: "0 0 30 10",
1642
235
  preserveAspectRatio: "none",
1643
- children: e.asChild ? n : /* @__PURE__ */ x("polygon", { points: "0,0 30,0 15,10" })
236
+ children: e.asChild ? r : /* @__PURE__ */ d("polygon", { points: "0,0 30,0 15,10" })
1644
237
  }
1645
238
  );
1646
239
  });
1647
- Ft.displayName = Yr;
1648
- var Xr = Ft;
1649
- function Gr(e) {
1650
- const [t, n] = f.useState(void 0);
1651
- return Z(() => {
1652
- if (e) {
1653
- n({ width: e.offsetWidth, height: e.offsetHeight });
1654
- const r = new ResizeObserver((o) => {
1655
- if (!Array.isArray(o) || !o.length)
1656
- return;
1657
- const i = o[0];
1658
- let s, c;
1659
- if ("borderBoxSize" in i) {
1660
- const l = i.borderBoxSize, a = Array.isArray(l) ? l[0] : l;
1661
- s = a.inlineSize, c = a.blockSize;
1662
- } else
1663
- s = e.offsetWidth, c = e.offsetHeight;
1664
- n({ width: s, height: c });
1665
- });
1666
- return r.observe(e, { box: "border-box" }), () => r.unobserve(e);
1667
- } else
1668
- n(void 0);
1669
- }, [e]), t;
1670
- }
1671
- var qe = "Popper", [$t, Wt] = Ct(qe), [qr, Ht] = $t(qe), Bt = (e) => {
1672
- const { __scopePopper: t, children: n } = e, [r, o] = f.useState(null);
1673
- return /* @__PURE__ */ x(qr, { scope: t, anchor: r, onAnchorChange: o, children: n });
240
+ Ce.displayName = $t;
241
+ var Wt = Ce, K = "Popper", [Ee, Pe] = he(K), [Bt, be] = Ee(K), xe = (e) => {
242
+ const { __scopePopper: t, children: r } = e, [o, n] = i.useState(null);
243
+ return /* @__PURE__ */ d(Bt, { scope: t, anchor: o, onAnchorChange: n, children: r });
1674
244
  };
1675
- Bt.displayName = qe;
1676
- var jt = "PopperAnchor", zt = f.forwardRef(
245
+ xe.displayName = K;
246
+ var Te = "PopperAnchor", Ae = i.forwardRef(
1677
247
  (e, t) => {
1678
- const { __scopePopper: n, virtualRef: r, ...o } = e, i = Ht(jt, n), s = f.useRef(null), c = ee(t, s);
1679
- return f.useEffect(() => {
1680
- i.onAnchorChange((r == null ? void 0 : r.current) || s.current);
1681
- }), r ? null : /* @__PURE__ */ x(te.div, { ...o, ref: c });
248
+ const { __scopePopper: r, virtualRef: o, ...n } = e, s = be(Te, r), a = i.useRef(null), u = N(t, a);
249
+ return i.useEffect(() => {
250
+ s.onAnchorChange((o == null ? void 0 : o.current) || a.current);
251
+ }), o ? null : /* @__PURE__ */ d(O.div, { ...n, ref: u });
1682
252
  }
1683
253
  );
1684
- zt.displayName = jt;
1685
- var Ke = "PopperContent", [Kr, Zr] = $t(Ke), Vt = f.forwardRef(
254
+ Ae.displayName = Te;
255
+ var Q = "PopperContent", [Ut, Vt] = Ee(Q), Re = i.forwardRef(
1686
256
  (e, t) => {
1687
- var et, tt, nt, rt, ot, it;
257
+ var oe, se, ie, ae, le, ce;
1688
258
  const {
1689
- __scopePopper: n,
1690
- side: r = "bottom",
1691
- sideOffset: o = 0,
1692
- align: i = "center",
1693
- alignOffset: s = 0,
1694
- arrowPadding: c = 0,
259
+ __scopePopper: r,
260
+ side: o = "bottom",
261
+ sideOffset: n = 0,
262
+ align: s = "center",
263
+ alignOffset: a = 0,
264
+ arrowPadding: u = 0,
1695
265
  avoidCollisions: l = !0,
1696
- collisionBoundary: a = [],
1697
- collisionPadding: u = 0,
1698
- sticky: d = "partial",
1699
- hideWhenDetached: m = !1,
1700
- updatePositionStrategy: p = "optimized",
1701
- onPlaced: h,
1702
- ...g
1703
- } = e, y = Ht(Ke, n), [v, w] = f.useState(null), P = ee(t, (ue) => w(ue)), [b, E] = f.useState(null), A = Gr(b), C = (A == null ? void 0 : A.width) ?? 0, R = (A == null ? void 0 : A.height) ?? 0, D = r + (i !== "center" ? "-" + i : ""), T = typeof u == "number" ? u : { top: 0, right: 0, bottom: 0, left: 0, ...u }, F = Array.isArray(a) ? a : [a], $ = F.length > 0, S = {
1704
- padding: T,
1705
- boundary: F.filter(Jr),
266
+ collisionBoundary: p = [],
267
+ collisionPadding: c = 0,
268
+ sticky: f = "partial",
269
+ hideWhenDetached: h = !1,
270
+ updatePositionStrategy: v = "optimized",
271
+ onPlaced: m,
272
+ ...y
273
+ } = e, w = be(Q, r), [E, C] = i.useState(null), x = N(t, (I) => C(I)), [P, T] = i.useState(null), b = ot(P), g = (b == null ? void 0 : b.width) ?? 0, S = (b == null ? void 0 : b.height) ?? 0, F = o + (s !== "center" ? "-" + s : ""), L = typeof c == "number" ? c : { top: 0, right: 0, bottom: 0, left: 0, ...c }, te = Array.isArray(p) ? p : [p], Ue = te.length > 0, $ = {
274
+ padding: L,
275
+ boundary: te.filter(jt),
1706
276
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
1707
- altBoundary: $
1708
- }, { refs: k, floatingStyles: L, placement: M, isPositioned: _, middlewareData: O } = Fr({
277
+ altBoundary: Ue
278
+ }, { refs: Ve, floatingStyles: re, placement: Ye, isPositioned: W, middlewareData: D } = st({
1709
279
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
1710
280
  strategy: "fixed",
1711
- placement: D,
1712
- whileElementsMounted: (...ue) => Sr(...ue, {
1713
- animationFrame: p === "always"
281
+ placement: F,
282
+ whileElementsMounted: (...I) => ft(...I, {
283
+ animationFrame: v === "always"
1714
284
  }),
1715
285
  elements: {
1716
- reference: y.anchor
286
+ reference: w.anchor
1717
287
  },
1718
288
  middleware: [
1719
- Wr({ mainAxis: o + R, alignmentAxis: s }),
1720
- l && Hr({
289
+ it({ mainAxis: n + S, alignmentAxis: a }),
290
+ l && at({
1721
291
  mainAxis: !0,
1722
292
  crossAxis: !1,
1723
- limiter: d === "partial" ? Br() : void 0,
1724
- ...S
293
+ limiter: f === "partial" ? pt() : void 0,
294
+ ...$
1725
295
  }),
1726
- l && jr({ ...S }),
1727
- zr({
1728
- ...S,
1729
- apply: ({ elements: ue, rects: st, availableWidth: pn, availableHeight: mn }) => {
1730
- const { width: hn, height: gn } = st.reference, ye = ue.floating.style;
1731
- ye.setProperty("--radix-popper-available-width", `${pn}px`), ye.setProperty("--radix-popper-available-height", `${mn}px`), ye.setProperty("--radix-popper-anchor-width", `${hn}px`), ye.setProperty("--radix-popper-anchor-height", `${gn}px`);
296
+ l && lt({ ...$ }),
297
+ ct({
298
+ ...$,
299
+ apply: ({ elements: I, rects: de, availableWidth: Ke, availableHeight: Qe }) => {
300
+ const { width: Je, height: et } = de.reference, U = I.floating.style;
301
+ U.setProperty("--radix-popper-available-width", `${Ke}px`), U.setProperty("--radix-popper-available-height", `${Qe}px`), U.setProperty("--radix-popper-anchor-width", `${Je}px`), U.setProperty("--radix-popper-anchor-height", `${et}px`);
1732
302
  }
1733
303
  }),
1734
- b && Ur({ element: b, padding: c }),
1735
- eo({ arrowWidth: C, arrowHeight: R }),
1736
- m && Vr({ strategy: "referenceHidden", ...S })
304
+ P && dt({ element: P, padding: u }),
305
+ Gt({ arrowWidth: g, arrowHeight: S }),
306
+ h && ut({ strategy: "referenceHidden", ...$ })
1737
307
  ]
1738
- }), [N, I] = Xt(M), oe = Re(h);
1739
- Z(() => {
1740
- _ && (oe == null || oe());
1741
- }, [_, oe]);
1742
- const ln = (et = O.arrow) == null ? void 0 : et.x, an = (tt = O.arrow) == null ? void 0 : tt.y, un = ((nt = O.arrow) == null ? void 0 : nt.centerOffset) !== 0, [fn, dn] = f.useState();
1743
- return Z(() => {
1744
- v && dn(window.getComputedStyle(v).zIndex);
1745
- }, [v]), /* @__PURE__ */ x(
308
+ }), [ne, je] = Ne(Ye), B = Z(m);
309
+ G(() => {
310
+ W && (B == null || B());
311
+ }, [W, B]);
312
+ const Ge = (oe = D.arrow) == null ? void 0 : oe.x, ze = (se = D.arrow) == null ? void 0 : se.y, Xe = ((ie = D.arrow) == null ? void 0 : ie.centerOffset) !== 0, [qe, Ze] = i.useState();
313
+ return G(() => {
314
+ E && Ze(window.getComputedStyle(E).zIndex);
315
+ }, [E]), /* @__PURE__ */ d(
1746
316
  "div",
1747
317
  {
1748
- ref: k.setFloating,
318
+ ref: Ve.setFloating,
1749
319
  "data-radix-popper-content-wrapper": "",
1750
320
  style: {
1751
- ...L,
1752
- transform: _ ? L.transform : "translate(0, -200%)",
321
+ ...re,
322
+ transform: W ? re.transform : "translate(0, -200%)",
1753
323
  // keep off the page when measuring
1754
324
  minWidth: "max-content",
1755
- zIndex: fn,
325
+ zIndex: qe,
1756
326
  "--radix-popper-transform-origin": [
1757
- (rt = O.transformOrigin) == null ? void 0 : rt.x,
1758
- (ot = O.transformOrigin) == null ? void 0 : ot.y
327
+ (ae = D.transformOrigin) == null ? void 0 : ae.x,
328
+ (le = D.transformOrigin) == null ? void 0 : le.y
1759
329
  ].join(" "),
1760
330
  // hide the content if using the hide middleware and should be hidden
1761
331
  // set visibility to hidden and disable pointer events so the UI behaves
1762
332
  // as if the PopperContent isn't there at all
1763
- ...((it = O.hide) == null ? void 0 : it.referenceHidden) && {
333
+ ...((ce = D.hide) == null ? void 0 : ce.referenceHidden) && {
1764
334
  visibility: "hidden",
1765
335
  pointerEvents: "none"
1766
336
  }
1767
337
  },
1768
338
  dir: e.dir,
1769
- children: /* @__PURE__ */ x(
1770
- Kr,
339
+ children: /* @__PURE__ */ d(
340
+ Ut,
1771
341
  {
1772
- scope: n,
1773
- placedSide: N,
1774
- onArrowChange: E,
1775
- arrowX: ln,
1776
- arrowY: an,
1777
- shouldHideArrow: un,
1778
- children: /* @__PURE__ */ x(
1779
- te.div,
342
+ scope: r,
343
+ placedSide: ne,
344
+ onArrowChange: T,
345
+ arrowX: Ge,
346
+ arrowY: ze,
347
+ shouldHideArrow: Xe,
348
+ children: /* @__PURE__ */ d(
349
+ O.div,
1780
350
  {
1781
- "data-side": N,
1782
- "data-align": I,
1783
- ...g,
1784
- ref: P,
351
+ "data-side": ne,
352
+ "data-align": je,
353
+ ...y,
354
+ ref: x,
1785
355
  style: {
1786
- ...g.style,
356
+ ...y.style,
1787
357
  // if the PopperContent hasn't been placed yet (not all measurements done)
1788
358
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
1789
- animation: _ ? void 0 : "none"
359
+ animation: W ? void 0 : "none"
1790
360
  }
1791
361
  }
1792
362
  )
@@ -1796,48 +366,48 @@ var Ke = "PopperContent", [Kr, Zr] = $t(Ke), Vt = f.forwardRef(
1796
366
  );
1797
367
  }
1798
368
  );
1799
- Vt.displayName = Ke;
1800
- var Ut = "PopperArrow", Qr = {
369
+ Re.displayName = Q;
370
+ var Oe = "PopperArrow", Yt = {
1801
371
  top: "bottom",
1802
372
  right: "left",
1803
373
  bottom: "top",
1804
374
  left: "right"
1805
- }, Yt = f.forwardRef(function(t, n) {
1806
- const { __scopePopper: r, ...o } = t, i = Zr(Ut, r), s = Qr[i.placedSide];
375
+ }, Se = i.forwardRef(function(t, r) {
376
+ const { __scopePopper: o, ...n } = t, s = Vt(Oe, o), a = Yt[s.placedSide];
1807
377
  return (
1808
378
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
1809
379
  // doesn't report size as we'd expect on SVG elements.
1810
380
  // it reports their bounding box which is effectively the largest path inside the SVG.
1811
- /* @__PURE__ */ x(
381
+ /* @__PURE__ */ d(
1812
382
  "span",
1813
383
  {
1814
- ref: i.onArrowChange,
384
+ ref: s.onArrowChange,
1815
385
  style: {
1816
386
  position: "absolute",
1817
- left: i.arrowX,
1818
- top: i.arrowY,
1819
- [s]: 0,
387
+ left: s.arrowX,
388
+ top: s.arrowY,
389
+ [a]: 0,
1820
390
  transformOrigin: {
1821
391
  top: "",
1822
392
  right: "0 0",
1823
393
  bottom: "center 0",
1824
394
  left: "100% 0"
1825
- }[i.placedSide],
395
+ }[s.placedSide],
1826
396
  transform: {
1827
397
  top: "translateY(100%)",
1828
398
  right: "translateY(50%) rotate(90deg) translateX(-50%)",
1829
399
  bottom: "rotate(180deg)",
1830
400
  left: "translateY(50%) rotate(-90deg) translateX(50%)"
1831
- }[i.placedSide],
1832
- visibility: i.shouldHideArrow ? "hidden" : void 0
401
+ }[s.placedSide],
402
+ visibility: s.shouldHideArrow ? "hidden" : void 0
1833
403
  },
1834
- children: /* @__PURE__ */ x(
1835
- Xr,
404
+ children: /* @__PURE__ */ d(
405
+ Wt,
1836
406
  {
1837
- ...o,
1838
- ref: n,
407
+ ...n,
408
+ ref: r,
1839
409
  style: {
1840
- ...o.style,
410
+ ...n.style,
1841
411
  // ensures the element can be measured correctly (mostly for if SVG)
1842
412
  display: "block"
1843
413
  }
@@ -1847,147 +417,33 @@ var Ut = "PopperArrow", Qr = {
1847
417
  )
1848
418
  );
1849
419
  });
1850
- Yt.displayName = Ut;
1851
- function Jr(e) {
420
+ Se.displayName = Oe;
421
+ function jt(e) {
1852
422
  return e !== null;
1853
423
  }
1854
- var eo = (e) => ({
424
+ var Gt = (e) => ({
1855
425
  name: "transformOrigin",
1856
426
  options: e,
1857
427
  fn(t) {
1858
- var y, v, w;
1859
- const { placement: n, rects: r, middlewareData: o } = t, s = ((y = o.arrow) == null ? void 0 : y.centerOffset) !== 0, c = s ? 0 : e.arrowWidth, l = s ? 0 : e.arrowHeight, [a, u] = Xt(n), d = { start: "0%", center: "50%", end: "100%" }[u], m = (((v = o.arrow) == null ? void 0 : v.x) ?? 0) + c / 2, p = (((w = o.arrow) == null ? void 0 : w.y) ?? 0) + l / 2;
1860
- let h = "", g = "";
1861
- return a === "bottom" ? (h = s ? d : `${m}px`, g = `${-l}px`) : a === "top" ? (h = s ? d : `${m}px`, g = `${r.floating.height + l}px`) : a === "right" ? (h = `${-l}px`, g = s ? d : `${p}px`) : a === "left" && (h = `${r.floating.width + l}px`, g = s ? d : `${p}px`), { data: { x: h, y: g } };
428
+ var w, E, C;
429
+ const { placement: r, rects: o, middlewareData: n } = t, a = ((w = n.arrow) == null ? void 0 : w.centerOffset) !== 0, u = a ? 0 : e.arrowWidth, l = a ? 0 : e.arrowHeight, [p, c] = Ne(r), f = { start: "0%", center: "50%", end: "100%" }[c], h = (((E = n.arrow) == null ? void 0 : E.x) ?? 0) + u / 2, v = (((C = n.arrow) == null ? void 0 : C.y) ?? 0) + l / 2;
430
+ let m = "", y = "";
431
+ return p === "bottom" ? (m = a ? f : `${h}px`, y = `${-l}px`) : p === "top" ? (m = a ? f : `${h}px`, y = `${o.floating.height + l}px`) : p === "right" ? (m = `${-l}px`, y = a ? f : `${v}px`) : p === "left" && (m = `${o.floating.width + l}px`, y = a ? f : `${v}px`), { data: { x: m, y } };
1862
432
  }
1863
433
  });
1864
- function Xt(e) {
1865
- const [t, n = "center"] = e.split("-");
1866
- return [t, n];
1867
- }
1868
- var to = Bt, no = zt, ro = Vt, oo = Yt, io = "Portal", Gt = f.forwardRef((e, t) => {
1869
- var c;
1870
- const { container: n, ...r } = e, [o, i] = f.useState(!1);
1871
- Z(() => i(!0), []);
1872
- const s = n || o && ((c = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : c.body);
1873
- return s ? bn.createPortal(/* @__PURE__ */ x(te.div, { ...r, ref: t }), s) : null;
434
+ function Ne(e) {
435
+ const [t, r = "center"] = e.split("-");
436
+ return [t, r];
437
+ }
438
+ var zt = xe, Xt = Ae, qt = Re, Zt = Se, Kt = "Portal", De = i.forwardRef((e, t) => {
439
+ var u;
440
+ const { container: r, ...o } = e, [n, s] = i.useState(!1);
441
+ G(() => s(!0), []);
442
+ const a = r || n && ((u = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : u.body);
443
+ return a ? yt.createPortal(/* @__PURE__ */ d(O.div, { ...o, ref: t }), a) : null;
1874
444
  });
1875
- Gt.displayName = io;
1876
- function so(e, t) {
1877
- return f.useReducer((n, r) => t[n][r] ?? n, e);
1878
- }
1879
- var Ze = (e) => {
1880
- const { present: t, children: n } = e, r = co(t), o = typeof n == "function" ? n({ present: r.isPresent }) : f.Children.only(n), i = ee(r.ref, lo(o));
1881
- return typeof n == "function" || r.isPresent ? f.cloneElement(o, { ref: i }) : null;
1882
- };
1883
- Ze.displayName = "Presence";
1884
- function co(e) {
1885
- const [t, n] = f.useState(), r = f.useRef(null), o = f.useRef(e), i = f.useRef("none"), s = e ? "mounted" : "unmounted", [c, l] = so(s, {
1886
- mounted: {
1887
- UNMOUNT: "unmounted",
1888
- ANIMATION_OUT: "unmountSuspended"
1889
- },
1890
- unmountSuspended: {
1891
- MOUNT: "mounted",
1892
- ANIMATION_END: "unmounted"
1893
- },
1894
- unmounted: {
1895
- MOUNT: "mounted"
1896
- }
1897
- });
1898
- return f.useEffect(() => {
1899
- const a = we(r.current);
1900
- i.current = c === "mounted" ? a : "none";
1901
- }, [c]), Z(() => {
1902
- const a = r.current, u = o.current;
1903
- if (u !== e) {
1904
- const m = i.current, p = we(a);
1905
- e ? l("MOUNT") : p === "none" || (a == null ? void 0 : a.display) === "none" ? l("UNMOUNT") : l(u && m !== p ? "ANIMATION_OUT" : "UNMOUNT"), o.current = e;
1906
- }
1907
- }, [e, l]), Z(() => {
1908
- if (t) {
1909
- let a;
1910
- const u = t.ownerDocument.defaultView ?? window, d = (p) => {
1911
- const g = we(r.current).includes(p.animationName);
1912
- if (p.target === t && g && (l("ANIMATION_END"), !o.current)) {
1913
- const y = t.style.animationFillMode;
1914
- t.style.animationFillMode = "forwards", a = u.setTimeout(() => {
1915
- t.style.animationFillMode === "forwards" && (t.style.animationFillMode = y);
1916
- });
1917
- }
1918
- }, m = (p) => {
1919
- p.target === t && (i.current = we(r.current));
1920
- };
1921
- return t.addEventListener("animationstart", m), t.addEventListener("animationcancel", d), t.addEventListener("animationend", d), () => {
1922
- u.clearTimeout(a), t.removeEventListener("animationstart", m), t.removeEventListener("animationcancel", d), t.removeEventListener("animationend", d);
1923
- };
1924
- } else
1925
- l("ANIMATION_END");
1926
- }, [t, l]), {
1927
- isPresent: ["mounted", "unmountSuspended"].includes(c),
1928
- ref: f.useCallback((a) => {
1929
- r.current = a ? getComputedStyle(a) : null, n(a);
1930
- }, [])
1931
- };
1932
- }
1933
- function we(e) {
1934
- return (e == null ? void 0 : e.animationName) || "none";
1935
- }
1936
- function lo(e) {
1937
- var r, o;
1938
- let t = (r = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : r.get, n = t && "isReactWarning" in t && t.isReactWarning;
1939
- return n ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, n = t && "isReactWarning" in t && t.isReactWarning, n ? e.props.ref : e.props.ref || e.ref);
1940
- }
1941
- var ao = f[" useInsertionEffect ".trim().toString()] || Z;
1942
- function uo({
1943
- prop: e,
1944
- defaultProp: t,
1945
- onChange: n = () => {
1946
- },
1947
- caller: r
1948
- }) {
1949
- const [o, i, s] = fo({
1950
- defaultProp: t,
1951
- onChange: n
1952
- }), c = e !== void 0, l = c ? e : o;
1953
- {
1954
- const u = f.useRef(e !== void 0);
1955
- f.useEffect(() => {
1956
- const d = u.current;
1957
- d !== c && console.warn(
1958
- `${r} is changing from ${d ? "controlled" : "uncontrolled"} to ${c ? "controlled" : "uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
1959
- ), u.current = c;
1960
- }, [c, r]);
1961
- }
1962
- const a = f.useCallback(
1963
- (u) => {
1964
- var d;
1965
- if (c) {
1966
- const m = po(u) ? u(e) : u;
1967
- m !== e && ((d = s.current) == null || d.call(s, m));
1968
- } else
1969
- i(u);
1970
- },
1971
- [c, e, i, s]
1972
- );
1973
- return [l, a];
1974
- }
1975
- function fo({
1976
- defaultProp: e,
1977
- onChange: t
1978
- }) {
1979
- const [n, r] = f.useState(e), o = f.useRef(n), i = f.useRef(t);
1980
- return ao(() => {
1981
- i.current = t;
1982
- }, [t]), f.useEffect(() => {
1983
- var s;
1984
- o.current !== n && ((s = i.current) == null || s.call(i, n), o.current = n);
1985
- }, [n, o]), [n, r, i];
1986
- }
1987
- function po(e) {
1988
- return typeof e == "function";
1989
- }
1990
- var mo = Object.freeze({
445
+ De.displayName = Kt;
446
+ var Qt = Object.freeze({
1991
447
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
1992
448
  position: "absolute",
1993
449
  border: 0,
@@ -1999,208 +455,208 @@ var mo = Object.freeze({
1999
455
  clip: "rect(0, 0, 0, 0)",
2000
456
  whiteSpace: "nowrap",
2001
457
  wordWrap: "normal"
2002
- }), ho = "VisuallyHidden", qt = f.forwardRef(
2003
- (e, t) => /* @__PURE__ */ x(
2004
- te.span,
458
+ }), Jt = "VisuallyHidden", _e = i.forwardRef(
459
+ (e, t) => /* @__PURE__ */ d(
460
+ O.span,
2005
461
  {
2006
462
  ...e,
2007
463
  ref: t,
2008
- style: { ...mo, ...e.style }
464
+ style: { ...Qt, ...e.style }
2009
465
  }
2010
466
  )
2011
467
  );
2012
- qt.displayName = ho;
2013
- var go = qt, [De, si] = Ct("Tooltip", [
2014
- Wt
2015
- ]), Le = Wt(), Kt = "TooltipProvider", yo = 700, He = "tooltip.open", [vo, Qe] = De(Kt), Zt = (e) => {
468
+ _e.displayName = Jt;
469
+ var er = _e, [V, Fr] = he("Tooltip", [
470
+ Pe
471
+ ]), Y = Pe(), Le = "TooltipProvider", tr = 700, X = "tooltip.open", [rr, J] = V(Le), Ie = (e) => {
2016
472
  const {
2017
473
  __scopeTooltip: t,
2018
- delayDuration: n = yo,
2019
- skipDelayDuration: r = 300,
2020
- disableHoverableContent: o = !1,
2021
- children: i
2022
- } = e, s = f.useRef(!0), c = f.useRef(!1), l = f.useRef(0);
2023
- return f.useEffect(() => {
2024
- const a = l.current;
2025
- return () => window.clearTimeout(a);
2026
- }, []), /* @__PURE__ */ x(
2027
- vo,
474
+ delayDuration: r = tr,
475
+ skipDelayDuration: o = 300,
476
+ disableHoverableContent: n = !1,
477
+ children: s
478
+ } = e, a = i.useRef(!0), u = i.useRef(!1), l = i.useRef(0);
479
+ return i.useEffect(() => {
480
+ const p = l.current;
481
+ return () => window.clearTimeout(p);
482
+ }, []), /* @__PURE__ */ d(
483
+ rr,
2028
484
  {
2029
485
  scope: t,
2030
- isOpenDelayedRef: s,
2031
- delayDuration: n,
2032
- onOpen: f.useCallback(() => {
2033
- window.clearTimeout(l.current), s.current = !1;
486
+ isOpenDelayedRef: a,
487
+ delayDuration: r,
488
+ onOpen: i.useCallback(() => {
489
+ window.clearTimeout(l.current), a.current = !1;
2034
490
  }, []),
2035
- onClose: f.useCallback(() => {
491
+ onClose: i.useCallback(() => {
2036
492
  window.clearTimeout(l.current), l.current = window.setTimeout(
2037
- () => s.current = !0,
2038
- r
493
+ () => a.current = !0,
494
+ o
2039
495
  );
2040
- }, [r]),
2041
- isPointerInTransitRef: c,
2042
- onPointerInTransitChange: f.useCallback((a) => {
2043
- c.current = a;
496
+ }, [o]),
497
+ isPointerInTransitRef: u,
498
+ onPointerInTransitChange: i.useCallback((p) => {
499
+ u.current = p;
2044
500
  }, []),
2045
- disableHoverableContent: o,
2046
- children: i
501
+ disableHoverableContent: n,
502
+ children: s
2047
503
  }
2048
504
  );
2049
505
  };
2050
- Zt.displayName = Kt;
2051
- var me = "Tooltip", [wo, ge] = De(me), Qt = (e) => {
506
+ Ie.displayName = Le;
507
+ var H = "Tooltip", [nr, k] = V(H), Me = (e) => {
2052
508
  const {
2053
509
  __scopeTooltip: t,
2054
- children: n,
2055
- open: r,
2056
- defaultOpen: o,
2057
- onOpenChange: i,
2058
- disableHoverableContent: s,
2059
- delayDuration: c
2060
- } = e, l = Qe(me, e.__scopeTooltip), a = Le(t), [u, d] = f.useState(null), m = Gn(), p = f.useRef(0), h = s ?? l.disableHoverableContent, g = c ?? l.delayDuration, y = f.useRef(!1), [v, w] = uo({
2061
- prop: r,
2062
- defaultProp: o ?? !1,
2063
- onChange: (C) => {
2064
- C ? (l.onOpen(), document.dispatchEvent(new CustomEvent(He))) : l.onClose(), i == null || i(C);
510
+ children: r,
511
+ open: o,
512
+ defaultOpen: n,
513
+ onOpenChange: s,
514
+ disableHoverableContent: a,
515
+ delayDuration: u
516
+ } = e, l = J(H, e.__scopeTooltip), p = Y(t), [c, f] = i.useState(null), h = ht(), v = i.useRef(0), m = a ?? l.disableHoverableContent, y = u ?? l.delayDuration, w = i.useRef(!1), [E, C] = vt({
517
+ prop: o,
518
+ defaultProp: n ?? !1,
519
+ onChange: (g) => {
520
+ g ? (l.onOpen(), document.dispatchEvent(new CustomEvent(X))) : l.onClose(), s == null || s(g);
2065
521
  },
2066
- caller: me
2067
- }), P = f.useMemo(() => v ? y.current ? "delayed-open" : "instant-open" : "closed", [v]), b = f.useCallback(() => {
2068
- window.clearTimeout(p.current), p.current = 0, y.current = !1, w(!0);
2069
- }, [w]), E = f.useCallback(() => {
2070
- window.clearTimeout(p.current), p.current = 0, w(!1);
2071
- }, [w]), A = f.useCallback(() => {
2072
- window.clearTimeout(p.current), p.current = window.setTimeout(() => {
2073
- y.current = !0, w(!0), p.current = 0;
2074
- }, g);
2075
- }, [g, w]);
2076
- return f.useEffect(() => () => {
2077
- p.current && (window.clearTimeout(p.current), p.current = 0);
2078
- }, []), /* @__PURE__ */ x(to, { ...a, children: /* @__PURE__ */ x(
2079
- wo,
522
+ caller: H
523
+ }), x = i.useMemo(() => E ? w.current ? "delayed-open" : "instant-open" : "closed", [E]), P = i.useCallback(() => {
524
+ window.clearTimeout(v.current), v.current = 0, w.current = !1, C(!0);
525
+ }, [C]), T = i.useCallback(() => {
526
+ window.clearTimeout(v.current), v.current = 0, C(!1);
527
+ }, [C]), b = i.useCallback(() => {
528
+ window.clearTimeout(v.current), v.current = window.setTimeout(() => {
529
+ w.current = !0, C(!0), v.current = 0;
530
+ }, y);
531
+ }, [y, C]);
532
+ return i.useEffect(() => () => {
533
+ v.current && (window.clearTimeout(v.current), v.current = 0);
534
+ }, []), /* @__PURE__ */ d(zt, { ...p, children: /* @__PURE__ */ d(
535
+ nr,
2080
536
  {
2081
537
  scope: t,
2082
- contentId: m,
2083
- open: v,
2084
- stateAttribute: P,
2085
- trigger: u,
2086
- onTriggerChange: d,
2087
- onTriggerEnter: f.useCallback(() => {
2088
- l.isOpenDelayedRef.current ? A() : b();
2089
- }, [l.isOpenDelayedRef, A, b]),
2090
- onTriggerLeave: f.useCallback(() => {
2091
- h ? E() : (window.clearTimeout(p.current), p.current = 0);
2092
- }, [E, h]),
2093
- onOpen: b,
2094
- onClose: E,
2095
- disableHoverableContent: h,
2096
- children: n
538
+ contentId: h,
539
+ open: E,
540
+ stateAttribute: x,
541
+ trigger: c,
542
+ onTriggerChange: f,
543
+ onTriggerEnter: i.useCallback(() => {
544
+ l.isOpenDelayedRef.current ? b() : P();
545
+ }, [l.isOpenDelayedRef, b, P]),
546
+ onTriggerLeave: i.useCallback(() => {
547
+ m ? T() : (window.clearTimeout(v.current), v.current = 0);
548
+ }, [T, m]),
549
+ onOpen: P,
550
+ onClose: T,
551
+ disableHoverableContent: m,
552
+ children: r
2097
553
  }
2098
554
  ) });
2099
555
  };
2100
- Qt.displayName = me;
2101
- var Be = "TooltipTrigger", Jt = f.forwardRef(
556
+ Me.displayName = H;
557
+ var q = "TooltipTrigger", He = i.forwardRef(
2102
558
  (e, t) => {
2103
- const { __scopeTooltip: n, ...r } = e, o = ge(Be, n), i = Qe(Be, n), s = Le(n), c = f.useRef(null), l = ee(t, c, o.onTriggerChange), a = f.useRef(!1), u = f.useRef(!1), d = f.useCallback(() => a.current = !1, []);
2104
- return f.useEffect(() => () => document.removeEventListener("pointerup", d), [d]), /* @__PURE__ */ x(no, { asChild: !0, ...s, children: /* @__PURE__ */ x(
2105
- te.button,
559
+ const { __scopeTooltip: r, ...o } = e, n = k(q, r), s = J(q, r), a = Y(r), u = i.useRef(null), l = N(t, u, n.onTriggerChange), p = i.useRef(!1), c = i.useRef(!1), f = i.useCallback(() => p.current = !1, []);
560
+ return i.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(Xt, { asChild: !0, ...a, children: /* @__PURE__ */ d(
561
+ O.button,
2106
562
  {
2107
- "aria-describedby": o.open ? o.contentId : void 0,
2108
- "data-state": o.stateAttribute,
2109
- ...r,
563
+ "aria-describedby": n.open ? n.contentId : void 0,
564
+ "data-state": n.stateAttribute,
565
+ ...o,
2110
566
  ref: l,
2111
- onPointerMove: Y(e.onPointerMove, (m) => {
2112
- m.pointerType !== "touch" && !u.current && !i.isPointerInTransitRef.current && (o.onTriggerEnter(), u.current = !0);
567
+ onPointerMove: A(e.onPointerMove, (h) => {
568
+ h.pointerType !== "touch" && !c.current && !s.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
2113
569
  }),
2114
- onPointerLeave: Y(e.onPointerLeave, () => {
2115
- o.onTriggerLeave(), u.current = !1;
570
+ onPointerLeave: A(e.onPointerLeave, () => {
571
+ n.onTriggerLeave(), c.current = !1;
2116
572
  }),
2117
- onPointerDown: Y(e.onPointerDown, () => {
2118
- o.open && o.onClose(), a.current = !0, document.addEventListener("pointerup", d, { once: !0 });
573
+ onPointerDown: A(e.onPointerDown, () => {
574
+ n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
2119
575
  }),
2120
- onFocus: Y(e.onFocus, () => {
2121
- a.current || o.onOpen();
576
+ onFocus: A(e.onFocus, () => {
577
+ p.current || n.onOpen();
2122
578
  }),
2123
- onBlur: Y(e.onBlur, o.onClose),
2124
- onClick: Y(e.onClick, o.onClose)
579
+ onBlur: A(e.onBlur, n.onClose),
580
+ onClick: A(e.onClick, n.onClose)
2125
581
  }
2126
582
  ) });
2127
583
  }
2128
584
  );
2129
- Jt.displayName = Be;
2130
- var Je = "TooltipPortal", [xo, bo] = De(Je, {
585
+ He.displayName = q;
586
+ var ee = "TooltipPortal", [or, sr] = V(ee, {
2131
587
  forceMount: void 0
2132
- }), en = (e) => {
2133
- const { __scopeTooltip: t, forceMount: n, children: r, container: o } = e, i = ge(Je, t);
2134
- return /* @__PURE__ */ x(xo, { scope: t, forceMount: n, children: /* @__PURE__ */ x(Ze, { present: n || i.open, children: /* @__PURE__ */ x(Gt, { asChild: !0, container: o, children: r }) }) });
588
+ }), ke = (e) => {
589
+ const { __scopeTooltip: t, forceMount: r, children: o, container: n } = e, s = k(ee, t);
590
+ return /* @__PURE__ */ d(or, { scope: t, forceMount: r, children: /* @__PURE__ */ d(ve, { present: r || s.open, children: /* @__PURE__ */ d(De, { asChild: !0, container: n, children: o }) }) });
2135
591
  };
2136
- en.displayName = Je;
2137
- var ce = "TooltipContent", tn = f.forwardRef(
592
+ ke.displayName = ee;
593
+ var _ = "TooltipContent", Fe = i.forwardRef(
2138
594
  (e, t) => {
2139
- const n = bo(ce, e.__scopeTooltip), { forceMount: r = n.forceMount, side: o = "top", ...i } = e, s = ge(ce, e.__scopeTooltip);
2140
- return /* @__PURE__ */ x(Ze, { present: r || s.open, children: s.disableHoverableContent ? /* @__PURE__ */ x(nn, { side: o, ...i, ref: t }) : /* @__PURE__ */ x(Co, { side: o, ...i, ref: t }) });
2141
- }
2142
- ), Co = f.forwardRef((e, t) => {
2143
- const n = ge(ce, e.__scopeTooltip), r = Qe(ce, e.__scopeTooltip), o = f.useRef(null), i = ee(t, o), [s, c] = f.useState(null), { trigger: l, onClose: a } = n, u = o.current, { onPointerInTransitChange: d } = r, m = f.useCallback(() => {
2144
- c(null), d(!1);
2145
- }, [d]), p = f.useCallback(
2146
- (h, g) => {
2147
- const y = h.currentTarget, v = { x: h.clientX, y: h.clientY }, w = Oo(v, y.getBoundingClientRect()), P = Ro(v, w), b = To(g.getBoundingClientRect()), E = No([...P, ...b]);
2148
- c(E), d(!0);
595
+ const r = sr(_, e.__scopeTooltip), { forceMount: o = r.forceMount, side: n = "top", ...s } = e, a = k(_, e.__scopeTooltip);
596
+ return /* @__PURE__ */ d(ve, { present: o || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ d($e, { side: n, ...s, ref: t }) : /* @__PURE__ */ d(ir, { side: n, ...s, ref: t }) });
597
+ }
598
+ ), ir = i.forwardRef((e, t) => {
599
+ const r = k(_, e.__scopeTooltip), o = J(_, e.__scopeTooltip), n = i.useRef(null), s = N(t, n), [a, u] = i.useState(null), { trigger: l, onClose: p } = r, c = n.current, { onPointerInTransitChange: f } = o, h = i.useCallback(() => {
600
+ u(null), f(!1);
601
+ }, [f]), v = i.useCallback(
602
+ (m, y) => {
603
+ const w = m.currentTarget, E = { x: m.clientX, y: m.clientY }, C = dr(E, w.getBoundingClientRect()), x = ur(E, C), P = pr(y.getBoundingClientRect()), T = hr([...x, ...P]);
604
+ u(T), f(!0);
2149
605
  },
2150
- [d]
606
+ [f]
2151
607
  );
2152
- return f.useEffect(() => () => m(), [m]), f.useEffect(() => {
2153
- if (l && u) {
2154
- const h = (y) => p(y, u), g = (y) => p(y, l);
2155
- return l.addEventListener("pointerleave", h), u.addEventListener("pointerleave", g), () => {
2156
- l.removeEventListener("pointerleave", h), u.removeEventListener("pointerleave", g);
608
+ return i.useEffect(() => () => h(), [h]), i.useEffect(() => {
609
+ if (l && c) {
610
+ const m = (w) => v(w, c), y = (w) => v(w, l);
611
+ return l.addEventListener("pointerleave", m), c.addEventListener("pointerleave", y), () => {
612
+ l.removeEventListener("pointerleave", m), c.removeEventListener("pointerleave", y);
2157
613
  };
2158
614
  }
2159
- }, [l, u, p, m]), f.useEffect(() => {
2160
- if (s) {
2161
- const h = (g) => {
2162
- const y = g.target, v = { x: g.clientX, y: g.clientY }, w = (l == null ? void 0 : l.contains(y)) || (u == null ? void 0 : u.contains(y)), P = !So(v, s);
2163
- w ? m() : P && (m(), a());
615
+ }, [l, c, v, h]), i.useEffect(() => {
616
+ if (a) {
617
+ const m = (y) => {
618
+ const w = y.target, E = { x: y.clientX, y: y.clientY }, C = (l == null ? void 0 : l.contains(w)) || (c == null ? void 0 : c.contains(w)), x = !fr(E, a);
619
+ C ? h() : x && (h(), p());
2164
620
  };
2165
- return document.addEventListener("pointermove", h), () => document.removeEventListener("pointermove", h);
621
+ return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
2166
622
  }
2167
- }, [l, u, s, a, m]), /* @__PURE__ */ x(nn, { ...e, ref: i });
2168
- }), [Eo, Po] = De(me, { isInside: !1 }), Ao = /* @__PURE__ */ Ln("TooltipContent"), nn = f.forwardRef(
623
+ }, [l, c, a, p, h]), /* @__PURE__ */ d($e, { ...e, ref: s });
624
+ }), [ar, lr] = V(H, { isInside: !1 }), cr = /* @__PURE__ */ At("TooltipContent"), $e = i.forwardRef(
2169
625
  (e, t) => {
2170
626
  const {
2171
- __scopeTooltip: n,
2172
- children: r,
2173
- "aria-label": o,
2174
- onEscapeKeyDown: i,
2175
- onPointerDownOutside: s,
2176
- ...c
2177
- } = e, l = ge(ce, n), a = Le(n), { onClose: u } = l;
2178
- return f.useEffect(() => (document.addEventListener(He, u), () => document.removeEventListener(He, u)), [u]), f.useEffect(() => {
627
+ __scopeTooltip: r,
628
+ children: o,
629
+ "aria-label": n,
630
+ onEscapeKeyDown: s,
631
+ onPointerDownOutside: a,
632
+ ...u
633
+ } = e, l = k(_, r), p = Y(r), { onClose: c } = l;
634
+ return i.useEffect(() => (document.addEventListener(X, c), () => document.removeEventListener(X, c)), [c]), i.useEffect(() => {
2179
635
  if (l.trigger) {
2180
- const d = (m) => {
2181
- const p = m.target;
2182
- p != null && p.contains(l.trigger) && u();
636
+ const f = (h) => {
637
+ const v = h.target;
638
+ v != null && v.contains(l.trigger) && c();
2183
639
  };
2184
- return window.addEventListener("scroll", d, { capture: !0 }), () => window.removeEventListener("scroll", d, { capture: !0 });
640
+ return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
2185
641
  }
2186
- }, [l.trigger, u]), /* @__PURE__ */ x(
2187
- At,
642
+ }, [l.trigger, c]), /* @__PURE__ */ d(
643
+ ge,
2188
644
  {
2189
645
  asChild: !0,
2190
646
  disableOutsidePointerEvents: !1,
2191
- onEscapeKeyDown: i,
2192
- onPointerDownOutside: s,
2193
- onFocusOutside: (d) => d.preventDefault(),
2194
- onDismiss: u,
2195
- children: /* @__PURE__ */ K(
2196
- ro,
647
+ onEscapeKeyDown: s,
648
+ onPointerDownOutside: a,
649
+ onFocusOutside: (f) => f.preventDefault(),
650
+ onDismiss: c,
651
+ children: /* @__PURE__ */ R(
652
+ qt,
2197
653
  {
2198
654
  "data-state": l.stateAttribute,
2199
- ...a,
2200
- ...c,
655
+ ...p,
656
+ ...u,
2201
657
  ref: t,
2202
658
  style: {
2203
- ...c.style,
659
+ ...u.style,
2204
660
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
2205
661
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
2206
662
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -2208,8 +664,8 @@ var ce = "TooltipContent", tn = f.forwardRef(
2208
664
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
2209
665
  },
2210
666
  children: [
2211
- /* @__PURE__ */ x(Ao, { children: r }),
2212
- /* @__PURE__ */ x(Eo, { scope: n, isInside: !0, children: /* @__PURE__ */ x(go, { id: l.contentId, role: "tooltip", children: o || r }) })
667
+ /* @__PURE__ */ d(cr, { children: o }),
668
+ /* @__PURE__ */ d(ar, { scope: r, isInside: !0, children: /* @__PURE__ */ d(er, { id: l.contentId, role: "tooltip", children: n || o }) })
2213
669
  ]
2214
670
  }
2215
671
  )
@@ -2217,276 +673,166 @@ var ce = "TooltipContent", tn = f.forwardRef(
2217
673
  );
2218
674
  }
2219
675
  );
2220
- tn.displayName = ce;
2221
- var rn = "TooltipArrow", on = f.forwardRef(
676
+ Fe.displayName = _;
677
+ var We = "TooltipArrow", Be = i.forwardRef(
2222
678
  (e, t) => {
2223
- const { __scopeTooltip: n, ...r } = e, o = Le(n);
2224
- return Po(
2225
- rn,
2226
- n
2227
- ).isInside ? null : /* @__PURE__ */ x(oo, { ...o, ...r, ref: t });
679
+ const { __scopeTooltip: r, ...o } = e, n = Y(r);
680
+ return lr(
681
+ We,
682
+ r
683
+ ).isInside ? null : /* @__PURE__ */ d(Zt, { ...n, ...o, ref: t });
2228
684
  }
2229
685
  );
2230
- on.displayName = rn;
2231
- function Oo(e, t) {
2232
- const n = Math.abs(t.top - e.y), r = Math.abs(t.bottom - e.y), o = Math.abs(t.right - e.x), i = Math.abs(t.left - e.x);
2233
- switch (Math.min(n, r, o, i)) {
2234
- case i:
686
+ Be.displayName = We;
687
+ function dr(e, t) {
688
+ const r = Math.abs(t.top - e.y), o = Math.abs(t.bottom - e.y), n = Math.abs(t.right - e.x), s = Math.abs(t.left - e.x);
689
+ switch (Math.min(r, o, n, s)) {
690
+ case s:
2235
691
  return "left";
2236
- case o:
2237
- return "right";
2238
692
  case n:
2239
- return "top";
693
+ return "right";
2240
694
  case r:
695
+ return "top";
696
+ case o:
2241
697
  return "bottom";
2242
698
  default:
2243
699
  throw new Error("unreachable");
2244
700
  }
2245
701
  }
2246
- function Ro(e, t, n = 5) {
2247
- const r = [];
702
+ function ur(e, t, r = 5) {
703
+ const o = [];
2248
704
  switch (t) {
2249
705
  case "top":
2250
- r.push(
2251
- { x: e.x - n, y: e.y + n },
2252
- { x: e.x + n, y: e.y + n }
706
+ o.push(
707
+ { x: e.x - r, y: e.y + r },
708
+ { x: e.x + r, y: e.y + r }
2253
709
  );
2254
710
  break;
2255
711
  case "bottom":
2256
- r.push(
2257
- { x: e.x - n, y: e.y - n },
2258
- { x: e.x + n, y: e.y - n }
712
+ o.push(
713
+ { x: e.x - r, y: e.y - r },
714
+ { x: e.x + r, y: e.y - r }
2259
715
  );
2260
716
  break;
2261
717
  case "left":
2262
- r.push(
2263
- { x: e.x + n, y: e.y - n },
2264
- { x: e.x + n, y: e.y + n }
718
+ o.push(
719
+ { x: e.x + r, y: e.y - r },
720
+ { x: e.x + r, y: e.y + r }
2265
721
  );
2266
722
  break;
2267
723
  case "right":
2268
- r.push(
2269
- { x: e.x - n, y: e.y - n },
2270
- { x: e.x - n, y: e.y + n }
724
+ o.push(
725
+ { x: e.x - r, y: e.y - r },
726
+ { x: e.x - r, y: e.y + r }
2271
727
  );
2272
728
  break;
2273
729
  }
2274
- return r;
730
+ return o;
2275
731
  }
2276
- function To(e) {
2277
- const { top: t, right: n, bottom: r, left: o } = e;
732
+ function pr(e) {
733
+ const { top: t, right: r, bottom: o, left: n } = e;
2278
734
  return [
2279
- { x: o, y: t },
2280
735
  { x: n, y: t },
2281
- { x: n, y: r },
2282
- { x: o, y: r }
736
+ { x: r, y: t },
737
+ { x: r, y: o },
738
+ { x: n, y: o }
2283
739
  ];
2284
740
  }
2285
- function So(e, t) {
2286
- const { x: n, y: r } = e;
2287
- let o = !1;
2288
- for (let i = 0, s = t.length - 1; i < t.length; s = i++) {
2289
- const c = t[i], l = t[s], a = c.x, u = c.y, d = l.x, m = l.y;
2290
- u > r != m > r && n < (d - a) * (r - u) / (m - u) + a && (o = !o);
741
+ function fr(e, t) {
742
+ const { x: r, y: o } = e;
743
+ let n = !1;
744
+ for (let s = 0, a = t.length - 1; s < t.length; a = s++) {
745
+ const u = t[s], l = t[a], p = u.x, c = u.y, f = l.x, h = l.y;
746
+ c > o != h > o && r < (f - p) * (o - c) / (h - c) + p && (n = !n);
2291
747
  }
2292
- return o;
748
+ return n;
2293
749
  }
2294
- function No(e) {
750
+ function hr(e) {
2295
751
  const t = e.slice();
2296
- return t.sort((n, r) => n.x < r.x ? -1 : n.x > r.x ? 1 : n.y < r.y ? -1 : n.y > r.y ? 1 : 0), Do(t);
752
+ return t.sort((r, o) => r.x < o.x ? -1 : r.x > o.x ? 1 : r.y < o.y ? -1 : r.y > o.y ? 1 : 0), vr(t);
2297
753
  }
2298
- function Do(e) {
754
+ function vr(e) {
2299
755
  if (e.length <= 1) return e.slice();
2300
756
  const t = [];
2301
- for (let r = 0; r < e.length; r++) {
2302
- const o = e[r];
757
+ for (let o = 0; o < e.length; o++) {
758
+ const n = e[o];
2303
759
  for (; t.length >= 2; ) {
2304
- const i = t[t.length - 1], s = t[t.length - 2];
2305
- if ((i.x - s.x) * (o.y - s.y) >= (i.y - s.y) * (o.x - s.x)) t.pop();
760
+ const s = t[t.length - 1], a = t[t.length - 2];
761
+ if ((s.x - a.x) * (n.y - a.y) >= (s.y - a.y) * (n.x - a.x)) t.pop();
2306
762
  else break;
2307
763
  }
2308
- t.push(o);
764
+ t.push(n);
2309
765
  }
2310
766
  t.pop();
2311
- const n = [];
2312
- for (let r = e.length - 1; r >= 0; r--) {
2313
- const o = e[r];
2314
- for (; n.length >= 2; ) {
2315
- const i = n[n.length - 1], s = n[n.length - 2];
2316
- if ((i.x - s.x) * (o.y - s.y) >= (i.y - s.y) * (o.x - s.x)) n.pop();
767
+ const r = [];
768
+ for (let o = e.length - 1; o >= 0; o--) {
769
+ const n = e[o];
770
+ for (; r.length >= 2; ) {
771
+ const s = r[r.length - 1], a = r[r.length - 2];
772
+ if ((s.x - a.x) * (n.y - a.y) >= (s.y - a.y) * (n.x - a.x)) r.pop();
2317
773
  else break;
2318
774
  }
2319
- n.push(o);
2320
- }
2321
- return n.pop(), t.length === 1 && n.length === 1 && t[0].x === n[0].x && t[0].y === n[0].y ? t : t.concat(n);
2322
- }
2323
- var Lo = Zt, Mo = Qt, _o = Jt, Io = en, ko = tn, Fo = on, sn = {
2324
- color: void 0,
2325
- size: void 0,
2326
- className: void 0,
2327
- style: void 0,
2328
- attr: void 0
2329
- }, vt = ne.createContext && /* @__PURE__ */ ne.createContext(sn), $o = ["attr", "size", "title"];
2330
- function Wo(e, t) {
2331
- if (e == null) return {};
2332
- var n = Ho(e, t), r, o;
2333
- if (Object.getOwnPropertySymbols) {
2334
- var i = Object.getOwnPropertySymbols(e);
2335
- for (o = 0; o < i.length; o++)
2336
- r = i[o], !(t.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (n[r] = e[r]);
2337
- }
2338
- return n;
2339
- }
2340
- function Ho(e, t) {
2341
- if (e == null) return {};
2342
- var n = {};
2343
- for (var r in e)
2344
- if (Object.prototype.hasOwnProperty.call(e, r)) {
2345
- if (t.indexOf(r) >= 0) continue;
2346
- n[r] = e[r];
2347
- }
2348
- return n;
2349
- }
2350
- function Ae() {
2351
- return Ae = Object.assign ? Object.assign.bind() : function(e) {
2352
- for (var t = 1; t < arguments.length; t++) {
2353
- var n = arguments[t];
2354
- for (var r in n)
2355
- Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
2356
- }
2357
- return e;
2358
- }, Ae.apply(this, arguments);
2359
- }
2360
- function wt(e, t) {
2361
- var n = Object.keys(e);
2362
- if (Object.getOwnPropertySymbols) {
2363
- var r = Object.getOwnPropertySymbols(e);
2364
- t && (r = r.filter(function(o) {
2365
- return Object.getOwnPropertyDescriptor(e, o).enumerable;
2366
- })), n.push.apply(n, r);
2367
- }
2368
- return n;
2369
- }
2370
- function Oe(e) {
2371
- for (var t = 1; t < arguments.length; t++) {
2372
- var n = arguments[t] != null ? arguments[t] : {};
2373
- t % 2 ? wt(Object(n), !0).forEach(function(r) {
2374
- Bo(e, r, n[r]);
2375
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : wt(Object(n)).forEach(function(r) {
2376
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(n, r));
2377
- });
2378
- }
2379
- return e;
2380
- }
2381
- function Bo(e, t, n) {
2382
- return t = jo(t), t in e ? Object.defineProperty(e, t, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = n, e;
2383
- }
2384
- function jo(e) {
2385
- var t = zo(e, "string");
2386
- return typeof t == "symbol" ? t : t + "";
2387
- }
2388
- function zo(e, t) {
2389
- if (typeof e != "object" || !e) return e;
2390
- var n = e[Symbol.toPrimitive];
2391
- if (n !== void 0) {
2392
- var r = n.call(e, t);
2393
- if (typeof r != "object") return r;
2394
- throw new TypeError("@@toPrimitive must return a primitive value.");
775
+ r.push(n);
2395
776
  }
2396
- return (t === "string" ? String : Number)(e);
2397
- }
2398
- function cn(e) {
2399
- return e && e.map((t, n) => /* @__PURE__ */ ne.createElement(t.tag, Oe({
2400
- key: n
2401
- }, t.attr), cn(t.child)));
2402
- }
2403
- function Vo(e) {
2404
- return (t) => /* @__PURE__ */ ne.createElement(Uo, Ae({
2405
- attr: Oe({}, e.attr)
2406
- }, t), cn(e.child));
777
+ return r.pop(), t.length === 1 && r.length === 1 && t[0].x === r[0].x && t[0].y === r[0].y ? t : t.concat(r);
2407
778
  }
2408
- function Uo(e) {
2409
- var t = (n) => {
2410
- var {
2411
- attr: r,
2412
- size: o,
2413
- title: i
2414
- } = e, s = Wo(e, $o), c = o || n.size || "1em", l;
2415
- return n.className && (l = n.className), e.className && (l = (l ? l + " " : "") + e.className), /* @__PURE__ */ ne.createElement("svg", Ae({
2416
- stroke: "currentColor",
2417
- fill: "currentColor",
2418
- strokeWidth: "0"
2419
- }, n.attr, r, s, {
2420
- className: l,
2421
- style: Oe(Oe({
2422
- color: e.color || n.color
2423
- }, n.style), e.style),
2424
- height: c,
2425
- width: c,
2426
- xmlns: "http://www.w3.org/2000/svg"
2427
- }), i && /* @__PURE__ */ ne.createElement("title", null, i), e.children);
2428
- };
2429
- return vt !== void 0 ? /* @__PURE__ */ ne.createElement(vt.Consumer, null, (n) => t(n)) : t(sn);
2430
- }
2431
- function xt(e) {
2432
- return Vo({ attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M0 168v-16c0-13.255 10.745-24 24-24h360V80c0-21.367 25.899-32.042 40.971-16.971l80 80c9.372 9.373 9.372 24.569 0 33.941l-80 80C409.956 271.982 384 261.456 384 240v-48H24c-13.255 0-24-10.745-24-24zm488 152H128v-48c0-21.314-25.862-32.08-40.971-16.971l-80 80c-9.372 9.373-9.372 24.569 0 33.941l80 80C102.057 463.997 128 453.437 128 432v-48h360c13.255 0 24-10.745 24-24v-16c0-13.255-10.745-24-24-24z" }, child: [] }] })(e);
2433
- }
2434
- const Yo = 1e3 * 60 * 60, ci = ({
779
+ var mr = Ie, yr = Me, gr = He, wr = ke, Cr = Fe, Er = Be;
780
+ const Pr = 1e3 * 60 * 60, $r = ({
2435
781
  amount: e,
2436
782
  currency: t,
2437
- position: n = On.RIGHT,
2438
- zeroDisplayOption: r = fe.NA,
2439
- customDisplay: o
783
+ position: r = Pt.RIGHT,
784
+ zeroDisplayOption: o = M.NA,
785
+ customDisplay: n
2440
786
  }) => {
2441
- var d;
2442
- const { user: i } = An(), s = (d = i == null ? void 0 : i.userRegion) == null ? void 0 : d.currency, c = s !== t, { data: l, isPending: a } = En({
2443
- queryKey: [Cn.CONVERT_CURRENCY, t],
2444
- queryFn: () => Pn.convertCurrency({ baseCurrency: t }),
2445
- enabled: c,
2446
- staleTime: Yo
2447
- }), u = xn(() => {
2448
- if (!i)
787
+ var f;
788
+ const { user: s } = Et(), a = (f = s == null ? void 0 : s.userRegion) == null ? void 0 : f.currency, u = a !== t, { data: l, isPending: p } = wt({
789
+ queryKey: [gt.CONVERT_CURRENCY, t],
790
+ queryFn: () => Ct.convertCurrency({ baseCurrency: t }),
791
+ enabled: u,
792
+ staleTime: Pr
793
+ }), c = rt(() => {
794
+ if (!s)
2449
795
  return null;
2450
- let m = typeof e == "string" ? parseFloat(e) : e;
2451
- if (c) {
2452
- if (a || !l) return null;
2453
- m = m * l;
2454
- }
2455
- return m;
2456
- }, [e, i, a, c, l]);
2457
- if (!s || !u || u < 0)
2458
- switch (r) {
2459
- case fe.NA:
2460
- return /* @__PURE__ */ x("span", { children: "N/A" });
2461
- case fe.HIDDEN:
2462
- return /* @__PURE__ */ x("span", { className: "hidden", children: "N/A" });
2463
- case fe.DISPLAY_AS_ZERO:
2464
- return /* @__PURE__ */ x("span", { children: u });
2465
- case fe.CUSTOM:
2466
- return /* @__PURE__ */ x("span", { children: o });
796
+ let h = typeof e == "string" ? parseFloat(e) : e;
797
+ if (u) {
798
+ if (p || !l) return null;
799
+ h = h * l;
800
+ }
801
+ return h;
802
+ }, [e, s, p, u, l]);
803
+ if (!a || !c || c < 0)
804
+ switch (o) {
805
+ case M.NA:
806
+ return /* @__PURE__ */ d("span", { children: "N/A" });
807
+ case M.HIDDEN:
808
+ return /* @__PURE__ */ d("span", { className: "hidden", children: "N/A" });
809
+ case M.DISPLAY_AS_ZERO:
810
+ return /* @__PURE__ */ d("span", { children: c });
811
+ case M.CUSTOM:
812
+ return /* @__PURE__ */ d("span", { children: c == 0 ? n : "N/A" });
2467
813
  default:
2468
- return /* @__PURE__ */ x("span", { children: "N/A" });
814
+ return /* @__PURE__ */ d("span", { children: "N/A" });
2469
815
  }
2470
- return /* @__PURE__ */ K("span", { className: "currency-conversion", children: [
2471
- Rn(u, s),
2472
- c && /* @__PURE__ */ x(
2473
- Xo,
816
+ return /* @__PURE__ */ R("span", { className: "currency-conversion", children: [
817
+ bt(c, a),
818
+ u && /* @__PURE__ */ d(
819
+ br,
2474
820
  {
2475
- trigger: /* @__PURE__ */ x("sup", { children: /* @__PURE__ */ x(xt, {}) }),
2476
- position: n,
2477
- children: /* @__PURE__ */ K("div", { className: "currency-conversion-container", children: [
2478
- /* @__PURE__ */ K("p", { children: [
821
+ trigger: /* @__PURE__ */ d("sup", { children: /* @__PURE__ */ d(ue, {}) }),
822
+ position: r,
823
+ children: /* @__PURE__ */ R("div", { className: "currency-conversion-container", children: [
824
+ /* @__PURE__ */ R("p", { children: [
2479
825
  "Converted from ",
2480
826
  t,
2481
827
  " to ",
2482
- s
828
+ a
2483
829
  ] }),
2484
- /* @__PURE__ */ K("div", { className: "currency-conversion-amounts", children: [
2485
- /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x("p", { children: Me(e, t) }) }),
2486
- /* @__PURE__ */ x("div", { children: /* @__PURE__ */ x("p", { children: Me(u, s) }) }),
2487
- /* @__PURE__ */ x("span", { className: "conversion-icon", children: /* @__PURE__ */ x(xt, {}) })
830
+ /* @__PURE__ */ R("div", { className: "currency-conversion-amounts", children: [
831
+ /* @__PURE__ */ d("div", { children: /* @__PURE__ */ d("p", { children: j(e, t) }) }),
832
+ /* @__PURE__ */ d("div", { children: /* @__PURE__ */ d("p", { children: j(c, a) }) }),
833
+ /* @__PURE__ */ d("span", { className: "conversion-icon", children: /* @__PURE__ */ d(ue, {}) })
2488
834
  ] }),
2489
- /* @__PURE__ */ x("div", { className: "currency-conversion-rate", children: /* @__PURE__ */ K("p", { children: [
835
+ /* @__PURE__ */ d("div", { className: "currency-conversion-rate", children: /* @__PURE__ */ R("p", { children: [
2490
836
  "Current Rate:",
2491
837
  " ",
2492
838
  l ? (
@@ -2497,28 +843,28 @@ const Yo = 1e3 * 60 * 60, ci = ({
2497
843
  ) : "N/A",
2498
844
  " ",
2499
845
  "≈ ",
2500
- Me(1, s)
846
+ j(1, a)
2501
847
  ] }) })
2502
848
  ] })
2503
849
  }
2504
850
  )
2505
851
  ] });
2506
- }, Xo = ({ children: e, trigger: t, position: n }) => /* @__PURE__ */ x(Lo, { delayDuration: 100, children: /* @__PURE__ */ K(Mo, { children: [
2507
- /* @__PURE__ */ x(_o, { asChild: !0, children: t }),
2508
- /* @__PURE__ */ x(Io, { children: /* @__PURE__ */ K(
2509
- ko,
852
+ }, br = ({ children: e, trigger: t, position: r }) => /* @__PURE__ */ d(mr, { delayDuration: 100, children: /* @__PURE__ */ R(yr, { children: [
853
+ /* @__PURE__ */ d(gr, { asChild: !0, children: t }),
854
+ /* @__PURE__ */ d(wr, { children: /* @__PURE__ */ R(
855
+ Cr,
2510
856
  {
2511
- className: `tooltip-content ${n}`,
2512
- side: n,
857
+ className: `tooltip-content ${r}`,
858
+ side: r,
2513
859
  align: "center",
2514
860
  children: [
2515
861
  e,
2516
- /* @__PURE__ */ x(Fo, { className: "tooltip-arrow" })
862
+ /* @__PURE__ */ d(Er, { className: "tooltip-arrow" })
2517
863
  ]
2518
864
  }
2519
865
  ) })
2520
866
  ] }) });
2521
867
  export {
2522
- ci as CashValue,
2523
- Yo as CurrencyCallStaleTimeMs
868
+ $r as CashValue,
869
+ Pr as CurrencyCallStaleTimeMs
2524
870
  };