@odynn/awayz-core 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,18 @@
1
- import { jsx as c, Fragment as rt, jsxs as R } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { useMemo as nt } from "react";
4
- import { u as D, a as ot, c as A, b as q, d as ve, e as st, f as it, g as G, o as at, s as lt, h as ct, i as dt, j as ut, k as pt, l as ft, m as ht, n as vt, p as mt, P as me } from "../../index-BC-KTkxU.js";
5
- import { r as yt, R as gt } from "../../index-Cv-wvFlM.js";
6
- import { useQuery as Ct } from "@tanstack/react-query";
1
+ import { jsx as d, Fragment as tt, jsxs as R } from "react/jsx-runtime";
2
+ import * as s from "react";
3
+ import { useMemo as rt } from "react";
4
+ import { u as D, a as nt, c as A, b as q, d as he, e as ot, f as st, g as G, o as it, s as at, h as ct, i as lt, j as ut, k as dt, l as pt, m as ft, n as ht, p as vt, P as ve } from "../../index-BC-KTkxU.js";
5
+ import { r as mt, R as yt } from "../../index-Cv-wvFlM.js";
6
+ import { useQuery as gt } from "@tanstack/react-query";
7
7
  import "../../arrayExtensions-DlcBOj5a.js";
8
- import { E as Et } from "../../AccountService-CtMwRIoL.js";
9
- import { b as ue } from "../../index-agnspg2e.js";
8
+ import { E as Ct } from "../../AccountService-CtMwRIoL.js";
9
+ import { b as de } from "../../index-agnspg2e.js";
10
10
  import "../../context/AwayzContext.js";
11
11
  import "../../configs/awayzClient.js";
12
12
  import { useAwayzContext as wt } from "../../hooks/useAwayzContext.js";
13
13
  import "../../services/noRetryInstance.js";
14
- import { CurrencyService as Pt } from "../../services/currency/CurrencyService.js";
15
- import { EInvalidAmountDisplayOption as N, EToolTipPosition as bt } from "./CashValueTypes.js";
14
+ import { CurrencyService as Et } from "../../services/currency/CurrencyService.js";
15
+ import { EInvalidAmountDisplayOption as N, EToolTipPosition as Pt } from "./CashValueTypes.js";
16
16
  import '../../assets/_styles.css';import '../../assets/_styles5.css';import '../../assets/_styles4.css';import '../../assets/_styles3.css';import '../../assets/_styles2.css';/* empty css */
17
17
  /* empty css */
18
18
  /* empty css */
@@ -24,66 +24,73 @@ const Y = (e, t) => {
24
24
  currency: t ?? "USD"
25
25
  });
26
26
  if (!e) return r.format(0);
27
- const o = parseFloat(e.toString());
28
- return r.format(o);
29
- }, pe = (e, t) => {
30
- if (e < 0) return "N/A";
27
+ const n = parseFloat(e.toString());
28
+ return r.format(n);
29
+ }, bt = (e, t) => {
31
30
  var r = new Intl.NumberFormat("en-US", {
32
31
  style: "currency",
33
32
  currency: t ?? "USD"
34
33
  });
35
34
  return r.format(Math.round(e)).toString().split(".")[0];
35
+ }, xt = (e, t, r = 0) => {
36
+ const n = parseFloat((e == null ? void 0 : e.toString()) || "0");
37
+ return new Intl.NumberFormat("en-US", {
38
+ style: "currency",
39
+ currency: t ?? "USD",
40
+ minimumFractionDigits: r,
41
+ maximumFractionDigits: r
42
+ }).format(isNaN(n) ? 0 : n);
36
43
  };
37
44
  // @__NO_SIDE_EFFECTS__
38
- function xt(e) {
39
- const t = /* @__PURE__ */ Tt(e), r = i.forwardRef((o, n) => {
40
- const { children: s, ...a } = o, u = i.Children.toArray(s), l = u.find(Rt);
41
- if (l) {
42
- const p = l.props.children, d = u.map((f) => f === l ? i.Children.count(p) > 1 ? i.Children.only(null) : i.isValidElement(p) ? p.props.children : null : f);
43
- return /* @__PURE__ */ c(t, { ...a, ref: n, children: i.isValidElement(p) ? i.cloneElement(p, void 0, d) : null });
45
+ function Tt(e) {
46
+ const t = /* @__PURE__ */ At(e), r = s.forwardRef((n, o) => {
47
+ const { children: i, ...a } = n, l = s.Children.toArray(i), c = l.find(St);
48
+ if (c) {
49
+ const u = c.props.children, p = l.map((f) => f === c ? s.Children.count(u) > 1 ? s.Children.only(null) : s.isValidElement(u) ? u.props.children : null : f);
50
+ return /* @__PURE__ */ d(t, { ...a, ref: o, children: s.isValidElement(u) ? s.cloneElement(u, void 0, p) : null });
44
51
  }
45
- return /* @__PURE__ */ c(t, { ...a, ref: n, children: s });
52
+ return /* @__PURE__ */ d(t, { ...a, ref: o, children: i });
46
53
  });
47
54
  return r.displayName = `${e}.Slot`, r;
48
55
  }
49
56
  // @__NO_SIDE_EFFECTS__
50
- function Tt(e) {
51
- const t = i.forwardRef((r, o) => {
52
- const { children: n, ...s } = r, a = i.isValidElement(n) ? St(n) : void 0, u = D(a, o);
53
- if (i.isValidElement(n)) {
54
- const l = Ot(s, n.props);
55
- return n.type !== i.Fragment && (l.ref = u), i.cloneElement(n, l);
57
+ function At(e) {
58
+ const t = s.forwardRef((r, n) => {
59
+ const { children: o, ...i } = r, a = s.isValidElement(o) ? Nt(o) : void 0, l = D(a, n);
60
+ if (s.isValidElement(o)) {
61
+ const c = Ot(i, o.props);
62
+ return o.type !== s.Fragment && (c.ref = l), s.cloneElement(o, c);
56
63
  }
57
- return i.Children.count(n) > 1 ? i.Children.only(null) : null;
64
+ return s.Children.count(o) > 1 ? s.Children.only(null) : null;
58
65
  });
59
66
  return t.displayName = `${e}.SlotClone`, t;
60
67
  }
61
- var ye = Symbol("radix.slottable");
68
+ var me = Symbol("radix.slottable");
62
69
  // @__NO_SIDE_EFFECTS__
63
- function At(e) {
64
- const t = ({ children: r }) => /* @__PURE__ */ c(rt, { children: r });
65
- return t.displayName = `${e}.Slottable`, t.__radixId = ye, t;
66
- }
67
70
  function Rt(e) {
68
- return i.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === ye;
71
+ const t = ({ children: r }) => /* @__PURE__ */ d(tt, { children: r });
72
+ return t.displayName = `${e}.Slottable`, t.__radixId = me, t;
73
+ }
74
+ function St(e) {
75
+ return s.isValidElement(e) && typeof e.type == "function" && "__radixId" in e.type && e.type.__radixId === me;
69
76
  }
70
77
  function Ot(e, t) {
71
78
  const r = { ...t };
72
- for (const o in t) {
73
- const n = e[o], s = t[o];
74
- /^on[A-Z]/.test(o) ? n && s ? r[o] = (...u) => {
75
- const l = s(...u);
76
- return n(...u), l;
77
- } : n && (r[o] = n) : o === "style" ? r[o] = { ...n, ...s } : o === "className" && (r[o] = [n, s].filter(Boolean).join(" "));
79
+ for (const n in t) {
80
+ const o = e[n], i = t[n];
81
+ /^on[A-Z]/.test(n) ? o && i ? r[n] = (...l) => {
82
+ const c = i(...l);
83
+ return o(...l), c;
84
+ } : o && (r[n] = o) : n === "style" ? r[n] = { ...o, ...i } : n === "className" && (r[n] = [o, i].filter(Boolean).join(" "));
78
85
  }
79
86
  return { ...e, ...r };
80
87
  }
81
- function St(e) {
82
- var o, n;
83
- let t = (o = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : o.get, r = t && "isReactWarning" in t && t.isReactWarning;
84
- 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);
88
+ function Nt(e) {
89
+ var n, o;
90
+ let t = (n = Object.getOwnPropertyDescriptor(e.props, "ref")) == null ? void 0 : n.get, r = t && "isReactWarning" in t && t.isReactWarning;
91
+ return r ? e.ref : (t = (o = Object.getOwnPropertyDescriptor(e, "ref")) == null ? void 0 : o.get, r = t && "isReactWarning" in t && t.isReactWarning, r ? e.props.ref : e.props.ref || e.ref);
85
92
  }
86
- var Nt = [
93
+ var Dt = [
87
94
  "a",
88
95
  "button",
89
96
  "div",
@@ -101,53 +108,53 @@ var Nt = [
101
108
  "span",
102
109
  "svg",
103
110
  "ul"
104
- ], O = Nt.reduce((e, t) => {
105
- const r = /* @__PURE__ */ xt(`Primitive.${t}`), o = i.forwardRef((n, s) => {
106
- const { asChild: a, ...u } = n, l = a ? r : t;
107
- return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ c(l, { ...u, ref: s });
111
+ ], S = Dt.reduce((e, t) => {
112
+ const r = /* @__PURE__ */ Tt(`Primitive.${t}`), n = s.forwardRef((o, i) => {
113
+ const { asChild: a, ...l } = o, c = a ? r : t;
114
+ return typeof window < "u" && (window[Symbol.for("radix-ui")] = !0), /* @__PURE__ */ d(c, { ...l, ref: i });
108
115
  });
109
- return o.displayName = `Primitive.${t}`, { ...e, [t]: o };
116
+ return n.displayName = `Primitive.${t}`, { ...e, [t]: n };
110
117
  }, {});
111
- function Dt(e, t) {
112
- e && yt.flushSync(() => e.dispatchEvent(t));
118
+ function _t(e, t) {
119
+ e && mt.flushSync(() => e.dispatchEvent(t));
113
120
  }
114
- var _t = "DismissableLayer", z = "dismissableLayer.update", Lt = "dismissableLayer.pointerDownOutside", It = "dismissableLayer.focusOutside", fe, ge = i.createContext({
121
+ var Lt = "DismissableLayer", z = "dismissableLayer.update", It = "dismissableLayer.pointerDownOutside", Mt = "dismissableLayer.focusOutside", pe, ye = s.createContext({
115
122
  layers: /* @__PURE__ */ new Set(),
116
123
  layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
117
124
  branches: /* @__PURE__ */ new Set()
118
- }), Ce = i.forwardRef(
125
+ }), ge = s.forwardRef(
119
126
  (e, t) => {
120
127
  const {
121
128
  disableOutsidePointerEvents: r = !1,
122
- onEscapeKeyDown: o,
123
- onPointerDownOutside: n,
124
- onFocusOutside: s,
129
+ onEscapeKeyDown: n,
130
+ onPointerDownOutside: o,
131
+ onFocusOutside: i,
125
132
  onInteractOutside: a,
126
- onDismiss: u,
127
- ...l
128
- } = e, p = i.useContext(ge), [d, f] = i.useState(null), v = (d == null ? void 0 : d.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, h] = i.useState({}), m = D(t, (g) => f(g)), y = Array.from(p.layers), [C] = [...p.layersWithOutsidePointerEventsDisabled].slice(-1), w = y.indexOf(C), E = d ? y.indexOf(d) : -1, x = p.layersWithOutsidePointerEventsDisabled.size > 0, P = E >= w, T = kt((g) => {
129
- const S = g.target, F = [...p.branches].some((I) => I.contains(S));
130
- !P || F || (n == null || n(g), a == null || a(g), g.defaultPrevented || u == null || u());
131
- }, v), b = Ft((g) => {
132
- const S = g.target;
133
- [...p.branches].some((I) => I.contains(S)) || (s == null || s(g), a == null || a(g), g.defaultPrevented || u == null || u());
134
- }, v);
135
- return ot((g) => {
136
- E === p.layers.size - 1 && (o == null || o(g), !g.defaultPrevented && u && (g.preventDefault(), u()));
137
- }, v), i.useEffect(() => {
138
- if (d)
139
- return r && (p.layersWithOutsidePointerEventsDisabled.size === 0 && (fe = v.body.style.pointerEvents, v.body.style.pointerEvents = "none"), p.layersWithOutsidePointerEventsDisabled.add(d)), p.layers.add(d), he(), () => {
140
- r && p.layersWithOutsidePointerEventsDisabled.size === 1 && (v.body.style.pointerEvents = fe);
133
+ onDismiss: l,
134
+ ...c
135
+ } = e, u = s.useContext(ye), [p, f] = s.useState(null), h = (p == null ? void 0 : p.ownerDocument) ?? (globalThis == null ? void 0 : globalThis.document), [, v] = s.useState({}), m = D(t, (g) => f(g)), y = Array.from(u.layers), [C] = [...u.layersWithOutsidePointerEventsDisabled].slice(-1), E = y.indexOf(C), w = p ? y.indexOf(p) : -1, x = u.layersWithOutsidePointerEventsDisabled.size > 0, P = w >= E, T = kt((g) => {
136
+ const O = g.target, k = [...u.branches].some((I) => I.contains(O));
137
+ !P || k || (o == null || o(g), a == null || a(g), g.defaultPrevented || l == null || l());
138
+ }, h), b = $t((g) => {
139
+ const O = g.target;
140
+ [...u.branches].some((I) => I.contains(O)) || (i == null || i(g), a == null || a(g), g.defaultPrevented || l == null || l());
141
+ }, h);
142
+ return nt((g) => {
143
+ w === u.layers.size - 1 && (n == null || n(g), !g.defaultPrevented && l && (g.preventDefault(), l()));
144
+ }, h), s.useEffect(() => {
145
+ if (p)
146
+ return r && (u.layersWithOutsidePointerEventsDisabled.size === 0 && (pe = h.body.style.pointerEvents, h.body.style.pointerEvents = "none"), u.layersWithOutsidePointerEventsDisabled.add(p)), u.layers.add(p), fe(), () => {
147
+ r && u.layersWithOutsidePointerEventsDisabled.size === 1 && (h.body.style.pointerEvents = pe);
141
148
  };
142
- }, [d, v, r, p]), i.useEffect(() => () => {
143
- d && (p.layers.delete(d), p.layersWithOutsidePointerEventsDisabled.delete(d), he());
144
- }, [d, p]), i.useEffect(() => {
145
- const g = () => h({});
149
+ }, [p, h, r, u]), s.useEffect(() => () => {
150
+ p && (u.layers.delete(p), u.layersWithOutsidePointerEventsDisabled.delete(p), fe());
151
+ }, [p, u]), s.useEffect(() => {
152
+ const g = () => v({});
146
153
  return document.addEventListener(z, g), () => document.removeEventListener(z, g);
147
- }, []), /* @__PURE__ */ c(
148
- O.div,
154
+ }, []), /* @__PURE__ */ d(
155
+ S.div,
149
156
  {
150
- ...l,
157
+ ...c,
151
158
  ref: m,
152
159
  style: {
153
160
  pointerEvents: x ? P ? "auto" : "none" : void 0,
@@ -163,198 +170,198 @@ var _t = "DismissableLayer", z = "dismissableLayer.update", Lt = "dismissableLay
163
170
  );
164
171
  }
165
172
  );
166
- Ce.displayName = _t;
167
- var Mt = "DismissableLayerBranch", Ht = i.forwardRef((e, t) => {
168
- const r = i.useContext(ge), o = i.useRef(null), n = D(t, o);
169
- return i.useEffect(() => {
170
- const s = o.current;
171
- if (s)
172
- return r.branches.add(s), () => {
173
- r.branches.delete(s);
173
+ ge.displayName = Lt;
174
+ var Ht = "DismissableLayerBranch", Ft = s.forwardRef((e, t) => {
175
+ const r = s.useContext(ye), n = s.useRef(null), o = D(t, n);
176
+ return s.useEffect(() => {
177
+ const i = n.current;
178
+ if (i)
179
+ return r.branches.add(i), () => {
180
+ r.branches.delete(i);
174
181
  };
175
- }, [r.branches]), /* @__PURE__ */ c(O.div, { ...e, ref: n });
182
+ }, [r.branches]), /* @__PURE__ */ d(S.div, { ...e, ref: o });
176
183
  });
177
- Ht.displayName = Mt;
184
+ Ft.displayName = Ht;
178
185
  function kt(e, t = globalThis == null ? void 0 : globalThis.document) {
179
- const r = q(e), o = i.useRef(!1), n = i.useRef(() => {
186
+ const r = q(e), n = s.useRef(!1), o = s.useRef(() => {
180
187
  });
181
- return i.useEffect(() => {
182
- const s = (u) => {
183
- if (u.target && !o.current) {
184
- let l = function() {
185
- Ee(
186
- Lt,
188
+ return s.useEffect(() => {
189
+ const i = (l) => {
190
+ if (l.target && !n.current) {
191
+ let c = function() {
192
+ Ce(
193
+ It,
187
194
  r,
188
- p,
195
+ u,
189
196
  { discrete: !0 }
190
197
  );
191
198
  };
192
- const p = { originalEvent: u };
193
- u.pointerType === "touch" ? (t.removeEventListener("click", n.current), n.current = l, t.addEventListener("click", n.current, { once: !0 })) : l();
199
+ const u = { originalEvent: l };
200
+ l.pointerType === "touch" ? (t.removeEventListener("click", o.current), o.current = c, t.addEventListener("click", o.current, { once: !0 })) : c();
194
201
  } else
195
- t.removeEventListener("click", n.current);
196
- o.current = !1;
202
+ t.removeEventListener("click", o.current);
203
+ n.current = !1;
197
204
  }, a = window.setTimeout(() => {
198
- t.addEventListener("pointerdown", s);
205
+ t.addEventListener("pointerdown", i);
199
206
  }, 0);
200
207
  return () => {
201
- window.clearTimeout(a), t.removeEventListener("pointerdown", s), t.removeEventListener("click", n.current);
208
+ window.clearTimeout(a), t.removeEventListener("pointerdown", i), t.removeEventListener("click", o.current);
202
209
  };
203
210
  }, [t, r]), {
204
211
  // ensures we check React component tree (not just DOM tree)
205
- onPointerDownCapture: () => o.current = !0
212
+ onPointerDownCapture: () => n.current = !0
206
213
  };
207
214
  }
208
- function Ft(e, t = globalThis == null ? void 0 : globalThis.document) {
209
- const r = q(e), o = i.useRef(!1);
210
- return i.useEffect(() => {
211
- const n = (s) => {
212
- s.target && !o.current && Ee(It, r, { originalEvent: s }, {
215
+ function $t(e, t = globalThis == null ? void 0 : globalThis.document) {
216
+ const r = q(e), n = s.useRef(!1);
217
+ return s.useEffect(() => {
218
+ const o = (i) => {
219
+ i.target && !n.current && Ce(Mt, r, { originalEvent: i }, {
213
220
  discrete: !1
214
221
  });
215
222
  };
216
- return t.addEventListener("focusin", n), () => t.removeEventListener("focusin", n);
223
+ return t.addEventListener("focusin", o), () => t.removeEventListener("focusin", o);
217
224
  }, [t, r]), {
218
- onFocusCapture: () => o.current = !0,
219
- onBlurCapture: () => o.current = !1
225
+ onFocusCapture: () => n.current = !0,
226
+ onBlurCapture: () => n.current = !1
220
227
  };
221
228
  }
222
- function he() {
229
+ function fe() {
223
230
  const e = new CustomEvent(z);
224
231
  document.dispatchEvent(e);
225
232
  }
226
- function Ee(e, t, r, { discrete: o }) {
227
- const n = r.originalEvent.target, s = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: r });
228
- t && n.addEventListener(e, t, { once: !0 }), o ? Dt(n, s) : n.dispatchEvent(s);
233
+ function Ce(e, t, r, { discrete: n }) {
234
+ const o = r.originalEvent.target, i = new CustomEvent(e, { bubbles: !1, cancelable: !0, detail: r });
235
+ t && o.addEventListener(e, t, { once: !0 }), n ? _t(o, i) : o.dispatchEvent(i);
229
236
  }
230
- var $t = "Arrow", we = i.forwardRef((e, t) => {
231
- const { children: r, width: o = 10, height: n = 5, ...s } = e;
232
- return /* @__PURE__ */ c(
233
- O.svg,
237
+ var Wt = "Arrow", we = s.forwardRef((e, t) => {
238
+ const { children: r, width: n = 10, height: o = 5, ...i } = e;
239
+ return /* @__PURE__ */ d(
240
+ S.svg,
234
241
  {
235
- ...s,
242
+ ...i,
236
243
  ref: t,
237
- width: o,
238
- height: n,
244
+ width: n,
245
+ height: o,
239
246
  viewBox: "0 0 30 10",
240
247
  preserveAspectRatio: "none",
241
- children: e.asChild ? r : /* @__PURE__ */ c("polygon", { points: "0,0 30,0 15,10" })
248
+ children: e.asChild ? r : /* @__PURE__ */ d("polygon", { points: "0,0 30,0 15,10" })
242
249
  }
243
250
  );
244
251
  });
245
- we.displayName = $t;
246
- var Wt = we, K = "Popper", [Pe, be] = ve(K), [Bt, xe] = Pe(K), Te = (e) => {
247
- const { __scopePopper: t, children: r } = e, [o, n] = i.useState(null);
248
- return /* @__PURE__ */ c(Bt, { scope: t, anchor: o, onAnchorChange: n, children: r });
252
+ we.displayName = Wt;
253
+ var Bt = we, K = "Popper", [Ee, Pe] = he(K), [Ut, be] = Ee(K), xe = (e) => {
254
+ const { __scopePopper: t, children: r } = e, [n, o] = s.useState(null);
255
+ return /* @__PURE__ */ d(Ut, { scope: t, anchor: n, onAnchorChange: o, children: r });
249
256
  };
250
- Te.displayName = K;
251
- var Ae = "PopperAnchor", Re = i.forwardRef(
257
+ xe.displayName = K;
258
+ var Te = "PopperAnchor", Ae = s.forwardRef(
252
259
  (e, t) => {
253
- const { __scopePopper: r, virtualRef: o, ...n } = e, s = xe(Ae, r), a = i.useRef(null), u = D(t, a);
254
- return i.useEffect(() => {
255
- s.onAnchorChange((o == null ? void 0 : o.current) || a.current);
256
- }), o ? null : /* @__PURE__ */ c(O.div, { ...n, ref: u });
260
+ const { __scopePopper: r, virtualRef: n, ...o } = e, i = be(Te, r), a = s.useRef(null), l = D(t, a);
261
+ return s.useEffect(() => {
262
+ i.onAnchorChange((n == null ? void 0 : n.current) || a.current);
263
+ }), n ? null : /* @__PURE__ */ d(S.div, { ...o, ref: l });
257
264
  }
258
265
  );
259
- Re.displayName = Ae;
260
- var Q = "PopperContent", [Ut, Yt] = Pe(Q), Oe = i.forwardRef(
266
+ Ae.displayName = Te;
267
+ var Q = "PopperContent", [Yt, Vt] = Ee(Q), Re = s.forwardRef(
261
268
  (e, t) => {
262
- var oe, se, ie, ae, le, ce;
269
+ var oe, se, ie, ae, ce, le;
263
270
  const {
264
271
  __scopePopper: r,
265
- side: o = "bottom",
266
- sideOffset: n = 0,
267
- align: s = "center",
272
+ side: n = "bottom",
273
+ sideOffset: o = 0,
274
+ align: i = "center",
268
275
  alignOffset: a = 0,
269
- arrowPadding: u = 0,
270
- avoidCollisions: l = !0,
271
- collisionBoundary: p = [],
272
- collisionPadding: d = 0,
276
+ arrowPadding: l = 0,
277
+ avoidCollisions: c = !0,
278
+ collisionBoundary: u = [],
279
+ collisionPadding: p = 0,
273
280
  sticky: f = "partial",
274
- hideWhenDetached: v = !1,
275
- updatePositionStrategy: h = "optimized",
281
+ hideWhenDetached: h = !1,
282
+ updatePositionStrategy: v = "optimized",
276
283
  onPlaced: m,
277
284
  ...y
278
- } = e, C = xe(Q, r), [w, E] = i.useState(null), x = D(t, (M) => E(M)), [P, T] = i.useState(null), b = st(P), g = (b == null ? void 0 : b.width) ?? 0, S = (b == null ? void 0 : b.height) ?? 0, F = o + (s !== "center" ? "-" + s : ""), I = typeof d == "number" ? d : { top: 0, right: 0, bottom: 0, left: 0, ...d }, te = Array.isArray(p) ? p : [p], Ye = te.length > 0, $ = {
285
+ } = e, C = be(Q, r), [E, w] = s.useState(null), x = D(t, (M) => w(M)), [P, T] = s.useState(null), b = ot(P), g = (b == null ? void 0 : b.width) ?? 0, O = (b == null ? void 0 : b.height) ?? 0, k = n + (i !== "center" ? "-" + i : ""), I = typeof p == "number" ? p : { top: 0, right: 0, bottom: 0, left: 0, ...p }, te = Array.isArray(u) ? u : [u], Ue = te.length > 0, $ = {
279
286
  padding: I,
280
- boundary: te.filter(jt),
287
+ boundary: te.filter(Gt),
281
288
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
282
- altBoundary: Ye
283
- }, { refs: Ve, floatingStyles: re, placement: je, isPositioned: W, middlewareData: _ } = it({
289
+ altBoundary: Ue
290
+ }, { refs: Ye, floatingStyles: re, placement: Ve, isPositioned: W, middlewareData: _ } = st({
284
291
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
285
292
  strategy: "fixed",
286
- placement: F,
287
- whileElementsMounted: (...M) => ht(...M, {
288
- animationFrame: h === "always"
293
+ placement: k,
294
+ whileElementsMounted: (...M) => ft(...M, {
295
+ animationFrame: v === "always"
289
296
  }),
290
297
  elements: {
291
298
  reference: C.anchor
292
299
  },
293
300
  middleware: [
294
- at({ mainAxis: n + S, alignmentAxis: a }),
295
- l && lt({
301
+ it({ mainAxis: o + O, alignmentAxis: a }),
302
+ c && at({
296
303
  mainAxis: !0,
297
304
  crossAxis: !1,
298
- limiter: f === "partial" ? ft() : void 0,
305
+ limiter: f === "partial" ? pt() : void 0,
299
306
  ...$
300
307
  }),
301
- l && ct({ ...$ }),
302
- dt({
308
+ c && ct({ ...$ }),
309
+ lt({
303
310
  ...$,
304
- apply: ({ elements: M, rects: de, availableWidth: Qe, availableHeight: Je }) => {
305
- const { width: et, height: tt } = de.reference, U = M.floating.style;
306
- U.setProperty("--radix-popper-available-width", `${Qe}px`), U.setProperty("--radix-popper-available-height", `${Je}px`), U.setProperty("--radix-popper-anchor-width", `${et}px`), U.setProperty("--radix-popper-anchor-height", `${tt}px`);
311
+ apply: ({ elements: M, rects: ue, availableWidth: Ke, availableHeight: Qe }) => {
312
+ const { width: Je, height: et } = ue.reference, U = M.floating.style;
313
+ 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`);
307
314
  }
308
315
  }),
309
- P && ut({ element: P, padding: u }),
310
- Gt({ arrowWidth: g, arrowHeight: S }),
311
- v && pt({ strategy: "referenceHidden", ...$ })
316
+ P && ut({ element: P, padding: l }),
317
+ zt({ arrowWidth: g, arrowHeight: O }),
318
+ h && dt({ strategy: "referenceHidden", ...$ })
312
319
  ]
313
- }), [ne, Ge] = De(je), B = q(m);
320
+ }), [ne, je] = Ne(Ve), B = q(m);
314
321
  G(() => {
315
322
  W && (B == null || B());
316
323
  }, [W, B]);
317
- const ze = (oe = _.arrow) == null ? void 0 : oe.x, Xe = (se = _.arrow) == null ? void 0 : se.y, Ze = ((ie = _.arrow) == null ? void 0 : ie.centerOffset) !== 0, [qe, Ke] = i.useState();
324
+ const Ge = (oe = _.arrow) == null ? void 0 : oe.x, ze = (se = _.arrow) == null ? void 0 : se.y, Xe = ((ie = _.arrow) == null ? void 0 : ie.centerOffset) !== 0, [Ze, qe] = s.useState();
318
325
  return G(() => {
319
- w && Ke(window.getComputedStyle(w).zIndex);
320
- }, [w]), /* @__PURE__ */ c(
326
+ E && qe(window.getComputedStyle(E).zIndex);
327
+ }, [E]), /* @__PURE__ */ d(
321
328
  "div",
322
329
  {
323
- ref: Ve.setFloating,
330
+ ref: Ye.setFloating,
324
331
  "data-radix-popper-content-wrapper": "",
325
332
  style: {
326
333
  ...re,
327
334
  transform: W ? re.transform : "translate(0, -200%)",
328
335
  // keep off the page when measuring
329
336
  minWidth: "max-content",
330
- zIndex: qe,
337
+ zIndex: Ze,
331
338
  "--radix-popper-transform-origin": [
332
339
  (ae = _.transformOrigin) == null ? void 0 : ae.x,
333
- (le = _.transformOrigin) == null ? void 0 : le.y
340
+ (ce = _.transformOrigin) == null ? void 0 : ce.y
334
341
  ].join(" "),
335
342
  // hide the content if using the hide middleware and should be hidden
336
343
  // set visibility to hidden and disable pointer events so the UI behaves
337
344
  // as if the PopperContent isn't there at all
338
- ...((ce = _.hide) == null ? void 0 : ce.referenceHidden) && {
345
+ ...((le = _.hide) == null ? void 0 : le.referenceHidden) && {
339
346
  visibility: "hidden",
340
347
  pointerEvents: "none"
341
348
  }
342
349
  },
343
350
  dir: e.dir,
344
- children: /* @__PURE__ */ c(
345
- Ut,
351
+ children: /* @__PURE__ */ d(
352
+ Yt,
346
353
  {
347
354
  scope: r,
348
355
  placedSide: ne,
349
356
  onArrowChange: T,
350
- arrowX: ze,
351
- arrowY: Xe,
352
- shouldHideArrow: Ze,
353
- children: /* @__PURE__ */ c(
354
- O.div,
357
+ arrowX: Ge,
358
+ arrowY: ze,
359
+ shouldHideArrow: Xe,
360
+ children: /* @__PURE__ */ d(
361
+ S.div,
355
362
  {
356
363
  "data-side": ne,
357
- "data-align": Ge,
364
+ "data-align": je,
358
365
  ...y,
359
366
  ref: x,
360
367
  style: {
@@ -371,48 +378,48 @@ var Q = "PopperContent", [Ut, Yt] = Pe(Q), Oe = i.forwardRef(
371
378
  );
372
379
  }
373
380
  );
374
- Oe.displayName = Q;
375
- var Se = "PopperArrow", Vt = {
381
+ Re.displayName = Q;
382
+ var Se = "PopperArrow", jt = {
376
383
  top: "bottom",
377
384
  right: "left",
378
385
  bottom: "top",
379
386
  left: "right"
380
- }, Ne = i.forwardRef(function(t, r) {
381
- const { __scopePopper: o, ...n } = t, s = Yt(Se, o), a = Vt[s.placedSide];
387
+ }, Oe = s.forwardRef(function(t, r) {
388
+ const { __scopePopper: n, ...o } = t, i = Vt(Se, n), a = jt[i.placedSide];
382
389
  return (
383
390
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
384
391
  // doesn't report size as we'd expect on SVG elements.
385
392
  // it reports their bounding box which is effectively the largest path inside the SVG.
386
- /* @__PURE__ */ c(
393
+ /* @__PURE__ */ d(
387
394
  "span",
388
395
  {
389
- ref: s.onArrowChange,
396
+ ref: i.onArrowChange,
390
397
  style: {
391
398
  position: "absolute",
392
- left: s.arrowX,
393
- top: s.arrowY,
399
+ left: i.arrowX,
400
+ top: i.arrowY,
394
401
  [a]: 0,
395
402
  transformOrigin: {
396
403
  top: "",
397
404
  right: "0 0",
398
405
  bottom: "center 0",
399
406
  left: "100% 0"
400
- }[s.placedSide],
407
+ }[i.placedSide],
401
408
  transform: {
402
409
  top: "translateY(100%)",
403
410
  right: "translateY(50%) rotate(90deg) translateX(-50%)",
404
411
  bottom: "rotate(180deg)",
405
412
  left: "translateY(50%) rotate(-90deg) translateX(50%)"
406
- }[s.placedSide],
407
- visibility: s.shouldHideArrow ? "hidden" : void 0
413
+ }[i.placedSide],
414
+ visibility: i.shouldHideArrow ? "hidden" : void 0
408
415
  },
409
- children: /* @__PURE__ */ c(
410
- Wt,
416
+ children: /* @__PURE__ */ d(
417
+ Bt,
411
418
  {
412
- ...n,
419
+ ...o,
413
420
  ref: r,
414
421
  style: {
415
- ...n.style,
422
+ ...o.style,
416
423
  // ensures the element can be measured correctly (mostly for if SVG)
417
424
  display: "block"
418
425
  }
@@ -422,33 +429,33 @@ var Se = "PopperArrow", Vt = {
422
429
  )
423
430
  );
424
431
  });
425
- Ne.displayName = Se;
426
- function jt(e) {
432
+ Oe.displayName = Se;
433
+ function Gt(e) {
427
434
  return e !== null;
428
435
  }
429
- var Gt = (e) => ({
436
+ var zt = (e) => ({
430
437
  name: "transformOrigin",
431
438
  options: e,
432
439
  fn(t) {
433
- var C, w, E;
434
- const { placement: r, rects: o, middlewareData: n } = t, a = ((C = n.arrow) == null ? void 0 : C.centerOffset) !== 0, u = a ? 0 : e.arrowWidth, l = a ? 0 : e.arrowHeight, [p, d] = De(r), f = { start: "0%", center: "50%", end: "100%" }[d], v = (((w = n.arrow) == null ? void 0 : w.x) ?? 0) + u / 2, h = (((E = n.arrow) == null ? void 0 : E.y) ?? 0) + l / 2;
440
+ var C, E, w;
441
+ const { placement: r, rects: n, middlewareData: o } = t, a = ((C = o.arrow) == null ? void 0 : C.centerOffset) !== 0, l = a ? 0 : e.arrowWidth, c = a ? 0 : e.arrowHeight, [u, p] = Ne(r), f = { start: "0%", center: "50%", end: "100%" }[p], h = (((E = o.arrow) == null ? void 0 : E.x) ?? 0) + l / 2, v = (((w = o.arrow) == null ? void 0 : w.y) ?? 0) + c / 2;
435
442
  let m = "", y = "";
436
- return p === "bottom" ? (m = a ? f : `${v}px`, y = `${-l}px`) : p === "top" ? (m = a ? f : `${v}px`, y = `${o.floating.height + l}px`) : p === "right" ? (m = `${-l}px`, y = a ? f : `${h}px`) : p === "left" && (m = `${o.floating.width + l}px`, y = a ? f : `${h}px`), { data: { x: m, y } };
443
+ return u === "bottom" ? (m = a ? f : `${h}px`, y = `${-c}px`) : u === "top" ? (m = a ? f : `${h}px`, y = `${n.floating.height + c}px`) : u === "right" ? (m = `${-c}px`, y = a ? f : `${v}px`) : u === "left" && (m = `${n.floating.width + c}px`, y = a ? f : `${v}px`), { data: { x: m, y } };
437
444
  }
438
445
  });
439
- function De(e) {
446
+ function Ne(e) {
440
447
  const [t, r = "center"] = e.split("-");
441
448
  return [t, r];
442
449
  }
443
- var zt = Te, Xt = Re, Zt = Oe, qt = Ne, Kt = "Portal", _e = i.forwardRef((e, t) => {
444
- var u;
445
- const { container: r, ...o } = e, [n, s] = i.useState(!1);
446
- G(() => s(!0), []);
447
- const a = r || n && ((u = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : u.body);
448
- return a ? gt.createPortal(/* @__PURE__ */ c(O.div, { ...o, ref: t }), a) : null;
450
+ var Xt = xe, Zt = Ae, qt = Re, Kt = Oe, Qt = "Portal", De = s.forwardRef((e, t) => {
451
+ var l;
452
+ const { container: r, ...n } = e, [o, i] = s.useState(!1);
453
+ G(() => i(!0), []);
454
+ const a = r || o && ((l = globalThis == null ? void 0 : globalThis.document) == null ? void 0 : l.body);
455
+ return a ? yt.createPortal(/* @__PURE__ */ d(S.div, { ...n, ref: t }), a) : null;
449
456
  });
450
- _e.displayName = Kt;
451
- var Qt = Object.freeze({
457
+ De.displayName = Qt;
458
+ var Jt = Object.freeze({
452
459
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
453
460
  position: "absolute",
454
461
  border: 0,
@@ -460,96 +467,96 @@ var Qt = Object.freeze({
460
467
  clip: "rect(0, 0, 0, 0)",
461
468
  whiteSpace: "nowrap",
462
469
  wordWrap: "normal"
463
- }), Jt = "VisuallyHidden", Le = i.forwardRef(
464
- (e, t) => /* @__PURE__ */ c(
465
- O.span,
470
+ }), er = "VisuallyHidden", _e = s.forwardRef(
471
+ (e, t) => /* @__PURE__ */ d(
472
+ S.span,
466
473
  {
467
474
  ...e,
468
475
  ref: t,
469
- style: { ...Qt, ...e.style }
476
+ style: { ...Jt, ...e.style }
470
477
  }
471
478
  )
472
479
  );
473
- Le.displayName = Jt;
474
- var er = Le, [V, Yr] = ve("Tooltip", [
475
- be
476
- ]), j = be(), Ie = "TooltipProvider", tr = 700, X = "tooltip.open", [rr, J] = V(Ie), Me = (e) => {
480
+ _e.displayName = er;
481
+ var tr = _e, [V, Vr] = he("Tooltip", [
482
+ Pe
483
+ ]), j = Pe(), Le = "TooltipProvider", rr = 700, X = "tooltip.open", [nr, J] = V(Le), Ie = (e) => {
477
484
  const {
478
485
  __scopeTooltip: t,
479
- delayDuration: r = tr,
480
- skipDelayDuration: o = 300,
481
- disableHoverableContent: n = !1,
482
- children: s
483
- } = e, a = i.useRef(!0), u = i.useRef(!1), l = i.useRef(0);
484
- return i.useEffect(() => {
485
- const p = l.current;
486
- return () => window.clearTimeout(p);
487
- }, []), /* @__PURE__ */ c(
488
- rr,
486
+ delayDuration: r = rr,
487
+ skipDelayDuration: n = 300,
488
+ disableHoverableContent: o = !1,
489
+ children: i
490
+ } = e, a = s.useRef(!0), l = s.useRef(!1), c = s.useRef(0);
491
+ return s.useEffect(() => {
492
+ const u = c.current;
493
+ return () => window.clearTimeout(u);
494
+ }, []), /* @__PURE__ */ d(
495
+ nr,
489
496
  {
490
497
  scope: t,
491
498
  isOpenDelayedRef: a,
492
499
  delayDuration: r,
493
- onOpen: i.useCallback(() => {
494
- window.clearTimeout(l.current), a.current = !1;
500
+ onOpen: s.useCallback(() => {
501
+ window.clearTimeout(c.current), a.current = !1;
495
502
  }, []),
496
- onClose: i.useCallback(() => {
497
- window.clearTimeout(l.current), l.current = window.setTimeout(
503
+ onClose: s.useCallback(() => {
504
+ window.clearTimeout(c.current), c.current = window.setTimeout(
498
505
  () => a.current = !0,
499
- o
506
+ n
500
507
  );
501
- }, [o]),
502
- isPointerInTransitRef: u,
503
- onPointerInTransitChange: i.useCallback((p) => {
504
- u.current = p;
508
+ }, [n]),
509
+ isPointerInTransitRef: l,
510
+ onPointerInTransitChange: s.useCallback((u) => {
511
+ l.current = u;
505
512
  }, []),
506
- disableHoverableContent: n,
507
- children: s
513
+ disableHoverableContent: o,
514
+ children: i
508
515
  }
509
516
  );
510
517
  };
511
- Me.displayName = Ie;
512
- var H = "Tooltip", [nr, k] = V(H), He = (e) => {
518
+ Ie.displayName = Le;
519
+ var H = "Tooltip", [or, F] = V(H), Me = (e) => {
513
520
  const {
514
521
  __scopeTooltip: t,
515
522
  children: r,
516
- open: o,
517
- defaultOpen: n,
518
- onOpenChange: s,
523
+ open: n,
524
+ defaultOpen: o,
525
+ onOpenChange: i,
519
526
  disableHoverableContent: a,
520
- delayDuration: u
521
- } = e, l = J(H, e.__scopeTooltip), p = j(t), [d, f] = i.useState(null), v = vt(), h = i.useRef(0), m = a ?? l.disableHoverableContent, y = u ?? l.delayDuration, C = i.useRef(!1), [w, E] = mt({
522
- prop: o,
523
- defaultProp: n ?? !1,
527
+ delayDuration: l
528
+ } = e, c = J(H, e.__scopeTooltip), u = j(t), [p, f] = s.useState(null), h = ht(), v = s.useRef(0), m = a ?? c.disableHoverableContent, y = l ?? c.delayDuration, C = s.useRef(!1), [E, w] = vt({
529
+ prop: n,
530
+ defaultProp: o ?? !1,
524
531
  onChange: (g) => {
525
- g ? (l.onOpen(), document.dispatchEvent(new CustomEvent(X))) : l.onClose(), s == null || s(g);
532
+ g ? (c.onOpen(), document.dispatchEvent(new CustomEvent(X))) : c.onClose(), i == null || i(g);
526
533
  },
527
534
  caller: H
528
- }), x = i.useMemo(() => w ? C.current ? "delayed-open" : "instant-open" : "closed", [w]), P = i.useCallback(() => {
529
- window.clearTimeout(h.current), h.current = 0, C.current = !1, E(!0);
530
- }, [E]), T = i.useCallback(() => {
531
- window.clearTimeout(h.current), h.current = 0, E(!1);
532
- }, [E]), b = i.useCallback(() => {
533
- window.clearTimeout(h.current), h.current = window.setTimeout(() => {
534
- C.current = !0, E(!0), h.current = 0;
535
+ }), x = s.useMemo(() => E ? C.current ? "delayed-open" : "instant-open" : "closed", [E]), P = s.useCallback(() => {
536
+ window.clearTimeout(v.current), v.current = 0, C.current = !1, w(!0);
537
+ }, [w]), T = s.useCallback(() => {
538
+ window.clearTimeout(v.current), v.current = 0, w(!1);
539
+ }, [w]), b = s.useCallback(() => {
540
+ window.clearTimeout(v.current), v.current = window.setTimeout(() => {
541
+ C.current = !0, w(!0), v.current = 0;
535
542
  }, y);
536
- }, [y, E]);
537
- return i.useEffect(() => () => {
538
- h.current && (window.clearTimeout(h.current), h.current = 0);
539
- }, []), /* @__PURE__ */ c(zt, { ...p, children: /* @__PURE__ */ c(
540
- nr,
543
+ }, [y, w]);
544
+ return s.useEffect(() => () => {
545
+ v.current && (window.clearTimeout(v.current), v.current = 0);
546
+ }, []), /* @__PURE__ */ d(Xt, { ...u, children: /* @__PURE__ */ d(
547
+ or,
541
548
  {
542
549
  scope: t,
543
- contentId: v,
544
- open: w,
550
+ contentId: h,
551
+ open: E,
545
552
  stateAttribute: x,
546
- trigger: d,
553
+ trigger: p,
547
554
  onTriggerChange: f,
548
- onTriggerEnter: i.useCallback(() => {
549
- l.isOpenDelayedRef.current ? b() : P();
550
- }, [l.isOpenDelayedRef, b, P]),
551
- onTriggerLeave: i.useCallback(() => {
552
- m ? T() : (window.clearTimeout(h.current), h.current = 0);
555
+ onTriggerEnter: s.useCallback(() => {
556
+ c.isOpenDelayedRef.current ? b() : P();
557
+ }, [c.isOpenDelayedRef, b, P]),
558
+ onTriggerLeave: s.useCallback(() => {
559
+ m ? T() : (window.clearTimeout(v.current), v.current = 0);
553
560
  }, [T, m]),
554
561
  onOpen: P,
555
562
  onClose: T,
@@ -558,110 +565,110 @@ var H = "Tooltip", [nr, k] = V(H), He = (e) => {
558
565
  }
559
566
  ) });
560
567
  };
561
- He.displayName = H;
562
- var Z = "TooltipTrigger", ke = i.forwardRef(
568
+ Me.displayName = H;
569
+ var Z = "TooltipTrigger", He = s.forwardRef(
563
570
  (e, t) => {
564
- const { __scopeTooltip: r, ...o } = e, n = k(Z, r), s = J(Z, r), a = j(r), u = i.useRef(null), l = D(t, u, n.onTriggerChange), p = i.useRef(!1), d = i.useRef(!1), f = i.useCallback(() => p.current = !1, []);
565
- return i.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ c(Xt, { asChild: !0, ...a, children: /* @__PURE__ */ c(
566
- O.button,
571
+ const { __scopeTooltip: r, ...n } = e, o = F(Z, r), i = J(Z, r), a = j(r), l = s.useRef(null), c = D(t, l, o.onTriggerChange), u = s.useRef(!1), p = s.useRef(!1), f = s.useCallback(() => u.current = !1, []);
572
+ return s.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(Zt, { asChild: !0, ...a, children: /* @__PURE__ */ d(
573
+ S.button,
567
574
  {
568
- "aria-describedby": n.open ? n.contentId : void 0,
569
- "data-state": n.stateAttribute,
570
- ...o,
571
- ref: l,
572
- onPointerMove: A(e.onPointerMove, (v) => {
573
- v.pointerType !== "touch" && !d.current && !s.isPointerInTransitRef.current && (n.onTriggerEnter(), d.current = !0);
575
+ "aria-describedby": o.open ? o.contentId : void 0,
576
+ "data-state": o.stateAttribute,
577
+ ...n,
578
+ ref: c,
579
+ onPointerMove: A(e.onPointerMove, (h) => {
580
+ h.pointerType !== "touch" && !p.current && !i.isPointerInTransitRef.current && (o.onTriggerEnter(), p.current = !0);
574
581
  }),
575
582
  onPointerLeave: A(e.onPointerLeave, () => {
576
- n.onTriggerLeave(), d.current = !1;
583
+ o.onTriggerLeave(), p.current = !1;
577
584
  }),
578
585
  onPointerDown: A(e.onPointerDown, () => {
579
- n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
586
+ o.open && o.onClose(), u.current = !0, document.addEventListener("pointerup", f, { once: !0 });
580
587
  }),
581
588
  onFocus: A(e.onFocus, () => {
582
- p.current || n.onOpen();
589
+ u.current || o.onOpen();
583
590
  }),
584
- onBlur: A(e.onBlur, n.onClose),
585
- onClick: A(e.onClick, n.onClose)
591
+ onBlur: A(e.onBlur, o.onClose),
592
+ onClick: A(e.onClick, o.onClose)
586
593
  }
587
594
  ) });
588
595
  }
589
596
  );
590
- ke.displayName = Z;
591
- var ee = "TooltipPortal", [or, sr] = V(ee, {
597
+ He.displayName = Z;
598
+ var ee = "TooltipPortal", [sr, ir] = V(ee, {
592
599
  forceMount: void 0
593
600
  }), Fe = (e) => {
594
- const { __scopeTooltip: t, forceMount: r, children: o, container: n } = e, s = k(ee, t);
595
- return /* @__PURE__ */ c(or, { scope: t, forceMount: r, children: /* @__PURE__ */ c(me, { present: r || s.open, children: /* @__PURE__ */ c(_e, { asChild: !0, container: n, children: o }) }) });
601
+ const { __scopeTooltip: t, forceMount: r, children: n, container: o } = e, i = F(ee, t);
602
+ return /* @__PURE__ */ d(sr, { scope: t, forceMount: r, children: /* @__PURE__ */ d(ve, { present: r || i.open, children: /* @__PURE__ */ d(De, { asChild: !0, container: o, children: n }) }) });
596
603
  };
597
604
  Fe.displayName = ee;
598
- var L = "TooltipContent", $e = i.forwardRef(
605
+ var L = "TooltipContent", ke = s.forwardRef(
599
606
  (e, t) => {
600
- const r = sr(L, e.__scopeTooltip), { forceMount: o = r.forceMount, side: n = "top", ...s } = e, a = k(L, e.__scopeTooltip);
601
- return /* @__PURE__ */ c(me, { present: o || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ c(We, { side: n, ...s, ref: t }) : /* @__PURE__ */ c(ir, { side: n, ...s, ref: t }) });
607
+ const r = ir(L, e.__scopeTooltip), { forceMount: n = r.forceMount, side: o = "top", ...i } = e, a = F(L, e.__scopeTooltip);
608
+ return /* @__PURE__ */ d(ve, { present: n || a.open, children: a.disableHoverableContent ? /* @__PURE__ */ d($e, { side: o, ...i, ref: t }) : /* @__PURE__ */ d(ar, { side: o, ...i, ref: t }) });
602
609
  }
603
- ), ir = i.forwardRef((e, t) => {
604
- const r = k(L, e.__scopeTooltip), o = J(L, e.__scopeTooltip), n = i.useRef(null), s = D(t, n), [a, u] = i.useState(null), { trigger: l, onClose: p } = r, d = n.current, { onPointerInTransitChange: f } = o, v = i.useCallback(() => {
605
- u(null), f(!1);
606
- }, [f]), h = i.useCallback(
610
+ ), ar = s.forwardRef((e, t) => {
611
+ const r = F(L, e.__scopeTooltip), n = J(L, e.__scopeTooltip), o = s.useRef(null), i = D(t, o), [a, l] = s.useState(null), { trigger: c, onClose: u } = r, p = o.current, { onPointerInTransitChange: f } = n, h = s.useCallback(() => {
612
+ l(null), f(!1);
613
+ }, [f]), v = s.useCallback(
607
614
  (m, y) => {
608
- const C = m.currentTarget, w = { x: m.clientX, y: m.clientY }, E = dr(w, C.getBoundingClientRect()), x = ur(w, E), P = pr(y.getBoundingClientRect()), T = hr([...x, ...P]);
609
- u(T), f(!0);
615
+ const C = m.currentTarget, E = { x: m.clientX, y: m.clientY }, w = dr(E, C.getBoundingClientRect()), x = pr(E, w), P = fr(y.getBoundingClientRect()), T = vr([...x, ...P]);
616
+ l(T), f(!0);
610
617
  },
611
618
  [f]
612
619
  );
613
- return i.useEffect(() => () => v(), [v]), i.useEffect(() => {
614
- if (l && d) {
615
- const m = (C) => h(C, d), y = (C) => h(C, l);
616
- return l.addEventListener("pointerleave", m), d.addEventListener("pointerleave", y), () => {
617
- l.removeEventListener("pointerleave", m), d.removeEventListener("pointerleave", y);
620
+ return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
621
+ if (c && p) {
622
+ const m = (C) => v(C, p), y = (C) => v(C, c);
623
+ return c.addEventListener("pointerleave", m), p.addEventListener("pointerleave", y), () => {
624
+ c.removeEventListener("pointerleave", m), p.removeEventListener("pointerleave", y);
618
625
  };
619
626
  }
620
- }, [l, d, h, v]), i.useEffect(() => {
627
+ }, [c, p, v, h]), s.useEffect(() => {
621
628
  if (a) {
622
629
  const m = (y) => {
623
- const C = y.target, w = { x: y.clientX, y: y.clientY }, E = (l == null ? void 0 : l.contains(C)) || (d == null ? void 0 : d.contains(C)), x = !fr(w, a);
624
- E ? v() : x && (v(), p());
630
+ const C = y.target, E = { x: y.clientX, y: y.clientY }, w = (c == null ? void 0 : c.contains(C)) || (p == null ? void 0 : p.contains(C)), x = !hr(E, a);
631
+ w ? h() : x && (h(), u());
625
632
  };
626
633
  return document.addEventListener("pointermove", m), () => document.removeEventListener("pointermove", m);
627
634
  }
628
- }, [l, d, a, p, v]), /* @__PURE__ */ c(We, { ...e, ref: s });
629
- }), [ar, lr] = V(H, { isInside: !1 }), cr = /* @__PURE__ */ At("TooltipContent"), We = i.forwardRef(
635
+ }, [c, p, a, u, h]), /* @__PURE__ */ d($e, { ...e, ref: i });
636
+ }), [cr, lr] = V(H, { isInside: !1 }), ur = /* @__PURE__ */ Rt("TooltipContent"), $e = s.forwardRef(
630
637
  (e, t) => {
631
638
  const {
632
639
  __scopeTooltip: r,
633
- children: o,
634
- "aria-label": n,
635
- onEscapeKeyDown: s,
640
+ children: n,
641
+ "aria-label": o,
642
+ onEscapeKeyDown: i,
636
643
  onPointerDownOutside: a,
637
- ...u
638
- } = e, l = k(L, r), p = j(r), { onClose: d } = l;
639
- return i.useEffect(() => (document.addEventListener(X, d), () => document.removeEventListener(X, d)), [d]), i.useEffect(() => {
640
- if (l.trigger) {
641
- const f = (v) => {
642
- const h = v.target;
643
- h != null && h.contains(l.trigger) && d();
644
+ ...l
645
+ } = e, c = F(L, r), u = j(r), { onClose: p } = c;
646
+ return s.useEffect(() => (document.addEventListener(X, p), () => document.removeEventListener(X, p)), [p]), s.useEffect(() => {
647
+ if (c.trigger) {
648
+ const f = (h) => {
649
+ const v = h.target;
650
+ v != null && v.contains(c.trigger) && p();
644
651
  };
645
652
  return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
646
653
  }
647
- }, [l.trigger, d]), /* @__PURE__ */ c(
648
- Ce,
654
+ }, [c.trigger, p]), /* @__PURE__ */ d(
655
+ ge,
649
656
  {
650
657
  asChild: !0,
651
658
  disableOutsidePointerEvents: !1,
652
- onEscapeKeyDown: s,
659
+ onEscapeKeyDown: i,
653
660
  onPointerDownOutside: a,
654
661
  onFocusOutside: (f) => f.preventDefault(),
655
- onDismiss: d,
662
+ onDismiss: p,
656
663
  children: /* @__PURE__ */ R(
657
- Zt,
664
+ qt,
658
665
  {
659
- "data-state": l.stateAttribute,
660
- ...p,
666
+ "data-state": c.stateAttribute,
661
667
  ...u,
668
+ ...l,
662
669
  ref: t,
663
670
  style: {
664
- ...u.style,
671
+ ...l.style,
665
672
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
666
673
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
667
674
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -669,8 +676,8 @@ var L = "TooltipContent", $e = i.forwardRef(
669
676
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
670
677
  },
671
678
  children: [
672
- /* @__PURE__ */ c(cr, { children: o }),
673
- /* @__PURE__ */ c(ar, { scope: r, isInside: !0, children: /* @__PURE__ */ c(er, { id: l.contentId, role: "tooltip", children: n || o }) })
679
+ /* @__PURE__ */ d(ur, { children: n }),
680
+ /* @__PURE__ */ d(cr, { scope: r, isInside: !0, children: /* @__PURE__ */ d(tr, { id: c.contentId, role: "tooltip", children: o || n }) })
674
681
  ]
675
682
  }
676
683
  )
@@ -678,192 +685,197 @@ var L = "TooltipContent", $e = i.forwardRef(
678
685
  );
679
686
  }
680
687
  );
681
- $e.displayName = L;
682
- var Be = "TooltipArrow", Ue = i.forwardRef(
688
+ ke.displayName = L;
689
+ var We = "TooltipArrow", Be = s.forwardRef(
683
690
  (e, t) => {
684
- const { __scopeTooltip: r, ...o } = e, n = j(r);
691
+ const { __scopeTooltip: r, ...n } = e, o = j(r);
685
692
  return lr(
686
- Be,
693
+ We,
687
694
  r
688
- ).isInside ? null : /* @__PURE__ */ c(qt, { ...n, ...o, ref: t });
695
+ ).isInside ? null : /* @__PURE__ */ d(Kt, { ...o, ...n, ref: t });
689
696
  }
690
697
  );
691
- Ue.displayName = Be;
698
+ Be.displayName = We;
692
699
  function dr(e, t) {
693
- 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);
694
- switch (Math.min(r, o, n, s)) {
695
- case s:
700
+ const r = Math.abs(t.top - e.y), n = Math.abs(t.bottom - e.y), o = Math.abs(t.right - e.x), i = Math.abs(t.left - e.x);
701
+ switch (Math.min(r, n, o, i)) {
702
+ case i:
696
703
  return "left";
697
- case n:
704
+ case o:
698
705
  return "right";
699
706
  case r:
700
707
  return "top";
701
- case o:
708
+ case n:
702
709
  return "bottom";
703
710
  default:
704
711
  throw new Error("unreachable");
705
712
  }
706
713
  }
707
- function ur(e, t, r = 5) {
708
- const o = [];
714
+ function pr(e, t, r = 5) {
715
+ const n = [];
709
716
  switch (t) {
710
717
  case "top":
711
- o.push(
718
+ n.push(
712
719
  { x: e.x - r, y: e.y + r },
713
720
  { x: e.x + r, y: e.y + r }
714
721
  );
715
722
  break;
716
723
  case "bottom":
717
- o.push(
724
+ n.push(
718
725
  { x: e.x - r, y: e.y - r },
719
726
  { x: e.x + r, y: e.y - r }
720
727
  );
721
728
  break;
722
729
  case "left":
723
- o.push(
730
+ n.push(
724
731
  { x: e.x + r, y: e.y - r },
725
732
  { x: e.x + r, y: e.y + r }
726
733
  );
727
734
  break;
728
735
  case "right":
729
- o.push(
736
+ n.push(
730
737
  { x: e.x - r, y: e.y - r },
731
738
  { x: e.x - r, y: e.y + r }
732
739
  );
733
740
  break;
734
741
  }
735
- return o;
742
+ return n;
736
743
  }
737
- function pr(e) {
738
- const { top: t, right: r, bottom: o, left: n } = e;
744
+ function fr(e) {
745
+ const { top: t, right: r, bottom: n, left: o } = e;
739
746
  return [
740
- { x: n, y: t },
747
+ { x: o, y: t },
741
748
  { x: r, y: t },
742
- { x: r, y: o },
743
- { x: n, y: o }
749
+ { x: r, y: n },
750
+ { x: o, y: n }
744
751
  ];
745
752
  }
746
- function fr(e, t) {
747
- const { x: r, y: o } = e;
748
- let n = !1;
749
- for (let s = 0, a = t.length - 1; s < t.length; a = s++) {
750
- const u = t[s], l = t[a], p = u.x, d = u.y, f = l.x, v = l.y;
751
- d > o != v > o && r < (f - p) * (o - d) / (v - d) + p && (n = !n);
753
+ function hr(e, t) {
754
+ const { x: r, y: n } = e;
755
+ let o = !1;
756
+ for (let i = 0, a = t.length - 1; i < t.length; a = i++) {
757
+ const l = t[i], c = t[a], u = l.x, p = l.y, f = c.x, h = c.y;
758
+ p > n != h > n && r < (f - u) * (n - p) / (h - p) + u && (o = !o);
752
759
  }
753
- return n;
760
+ return o;
754
761
  }
755
- function hr(e) {
762
+ function vr(e) {
756
763
  const t = e.slice();
757
- 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);
764
+ return t.sort((r, n) => r.x < n.x ? -1 : r.x > n.x ? 1 : r.y < n.y ? -1 : r.y > n.y ? 1 : 0), mr(t);
758
765
  }
759
- function vr(e) {
766
+ function mr(e) {
760
767
  if (e.length <= 1) return e.slice();
761
768
  const t = [];
762
- for (let o = 0; o < e.length; o++) {
763
- const n = e[o];
769
+ for (let n = 0; n < e.length; n++) {
770
+ const o = e[n];
764
771
  for (; t.length >= 2; ) {
765
- const s = t[t.length - 1], a = t[t.length - 2];
766
- if ((s.x - a.x) * (n.y - a.y) >= (s.y - a.y) * (n.x - a.x)) t.pop();
772
+ const i = t[t.length - 1], a = t[t.length - 2];
773
+ if ((i.x - a.x) * (o.y - a.y) >= (i.y - a.y) * (o.x - a.x)) t.pop();
767
774
  else break;
768
775
  }
769
- t.push(n);
776
+ t.push(o);
770
777
  }
771
778
  t.pop();
772
779
  const r = [];
773
- for (let o = e.length - 1; o >= 0; o--) {
774
- const n = e[o];
780
+ for (let n = e.length - 1; n >= 0; n--) {
781
+ const o = e[n];
775
782
  for (; r.length >= 2; ) {
776
- const s = r[r.length - 1], a = r[r.length - 2];
777
- if ((s.x - a.x) * (n.y - a.y) >= (s.y - a.y) * (n.x - a.x)) r.pop();
783
+ const i = r[r.length - 1], a = r[r.length - 2];
784
+ if ((i.x - a.x) * (o.y - a.y) >= (i.y - a.y) * (o.x - a.x)) r.pop();
778
785
  else break;
779
786
  }
780
- r.push(n);
787
+ r.push(o);
781
788
  }
782
789
  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);
783
790
  }
784
- var mr = Me, yr = He, gr = ke, Cr = Fe, Er = $e, wr = Ue;
785
- const Pr = 1e3 * 60 * 60, Vr = ({
791
+ var yr = Ie, gr = Me, Cr = He, wr = Fe, Er = ke, Pr = Be;
792
+ const br = 1e3 * 60 * 60, jr = ({
786
793
  amount: e,
787
794
  currency: t,
788
- position: r = bt.RIGHT,
789
- zeroDisplayOption: o = N.NA,
790
- customDisplay: n
795
+ position: r = Pt.RIGHT,
796
+ zeroDisplayOption: n = N.NA,
797
+ customDisplay: o,
798
+ decimalPlaces: i = 0
791
799
  }) => {
792
- var f, v;
793
- const { user: s } = wt(), a = ((f = s == null ? void 0 : s.preferences) == null ? void 0 : f.currency) ?? ((v = s == null ? void 0 : s.userRegion) == null ? void 0 : v.currency), u = a !== t, { data: l, isPending: p } = Ct({
794
- queryKey: [Et.CONVERT_CURRENCY, t, a],
795
- queryFn: () => Pt.convertCurrency({
800
+ var h, v;
801
+ const { user: a } = wt(), l = ((h = a == null ? void 0 : a.preferences) == null ? void 0 : h.currency) ?? ((v = a == null ? void 0 : a.userRegion) == null ? void 0 : v.currency), c = l !== t, { data: u, isPending: p } = gt({
802
+ queryKey: [Ct.CONVERT_CURRENCY, t, l],
803
+ queryFn: () => Et.convertCurrency({
796
804
  baseCurrency: t,
797
- targetCurrency: a
805
+ targetCurrency: l
798
806
  }),
799
- enabled: u,
800
- staleTime: Pr
801
- }), d = nt(() => {
802
- if (!s)
807
+ enabled: c,
808
+ staleTime: br
809
+ }), f = rt(() => {
810
+ if (!a)
803
811
  return null;
804
- let h = typeof e == "string" ? parseFloat(e) : e;
805
- if (u) {
806
- if (p || !l) return null;
807
- h = h * l;
812
+ let m = typeof e == "string" ? parseFloat(e) : e;
813
+ if (c) {
814
+ if (p || !u) return null;
815
+ m = m * u;
808
816
  }
809
- return h;
810
- }, [e, s, p, u, l]);
811
- if (!a || !d || d < 0)
812
- switch (o) {
817
+ return m;
818
+ }, [e, a, p, c, u]);
819
+ if (!l || !f || f < 0)
820
+ switch (n) {
813
821
  case N.NA:
814
- return /* @__PURE__ */ c("span", { children: "N/A" });
822
+ return /* @__PURE__ */ d("span", { children: "N/A" });
815
823
  case N.HIDDEN:
816
- return /* @__PURE__ */ c("span", { className: "hidden", children: "N/A" });
824
+ return /* @__PURE__ */ d("span", { className: "hidden", children: "N/A" });
817
825
  case N.DISPLAY_AS_ZERO:
818
- return /* @__PURE__ */ c("span", { children: "0" });
826
+ return /* @__PURE__ */ d("span", { children: "0" });
819
827
  case N.DISPLAY_AS_ZERO_WITH_CURRENCY:
820
- return /* @__PURE__ */ c("span", { children: Y(0, a ?? t) });
828
+ return /* @__PURE__ */ d("span", { children: Y(0, l ?? t) });
821
829
  case N.DISPLAY_AS_ZERO_WITH_CURRENCY_NO_DECIMAL:
822
- return /* @__PURE__ */ c("span", { children: pe(0, a ?? t) });
830
+ return /* @__PURE__ */ d("span", { children: bt(0, l ?? t) });
823
831
  case N.CUSTOM:
824
- return /* @__PURE__ */ c("span", { children: d == 0 ? n : "N/A" });
832
+ return /* @__PURE__ */ d("span", { children: f == 0 ? o : "N/A" });
825
833
  default:
826
- return /* @__PURE__ */ c("span", { children: "N/A" });
834
+ return /* @__PURE__ */ d("span", { children: "N/A" });
827
835
  }
828
836
  return /* @__PURE__ */ R("span", { className: "currency-conversion", children: [
829
- pe(d, a),
830
- u && /* @__PURE__ */ c(
831
- br,
837
+ xt(
838
+ f,
839
+ l,
840
+ i
841
+ ),
842
+ c && /* @__PURE__ */ d(
843
+ xr,
832
844
  {
833
- trigger: /* @__PURE__ */ c("sup", { children: /* @__PURE__ */ c(ue, {}) }),
845
+ trigger: /* @__PURE__ */ d("sup", { children: /* @__PURE__ */ d(de, {}) }),
834
846
  position: r,
835
847
  children: /* @__PURE__ */ R("div", { className: "currency-conversion-container", children: [
836
848
  /* @__PURE__ */ R("p", { children: [
837
849
  "Converted from ",
838
850
  t,
839
851
  " to ",
840
- a
852
+ l
841
853
  ] }),
842
854
  /* @__PURE__ */ R("div", { className: "currency-conversion-amounts", children: [
843
- /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c("p", { children: Y(e, t) }) }),
844
- /* @__PURE__ */ c("div", { children: /* @__PURE__ */ c("p", { children: Y(d, a) }) }),
845
- /* @__PURE__ */ c("span", { className: "conversion-icon", children: /* @__PURE__ */ c(ue, {}) })
855
+ /* @__PURE__ */ d("div", { children: /* @__PURE__ */ d("p", { children: Y(e, t) }) }),
856
+ /* @__PURE__ */ d("div", { children: /* @__PURE__ */ d("p", { children: Y(f, l) }) }),
857
+ /* @__PURE__ */ d("span", { className: "conversion-icon", children: /* @__PURE__ */ d(de, {}) })
846
858
  ] }),
847
- /* @__PURE__ */ c("div", { className: "currency-conversion-rate", children: /* @__PURE__ */ R("p", { children: [
859
+ /* @__PURE__ */ d("div", { className: "currency-conversion-rate", children: /* @__PURE__ */ R("p", { children: [
848
860
  "Current Rate:",
849
861
  " ",
850
- l ? (
862
+ u ? (
851
863
  // only leaving 2 decimal places for the conversion rate is
852
864
  // not enough, can lead to confusion
853
865
  // use Number constructor to strip unnecessary trailing zeros
854
- `${Number((1 / l).toFixed(5))} ${t}`
866
+ `${Number((1 / u).toFixed(5))} ${t}`
855
867
  ) : "N/A",
856
868
  " ",
857
869
  "≈ ",
858
- Y(1, a)
870
+ Y(1, l)
859
871
  ] }) })
860
872
  ] })
861
873
  }
862
874
  )
863
875
  ] });
864
- }, br = ({ children: e, trigger: t, position: r }) => /* @__PURE__ */ c(mr, { delayDuration: 100, children: /* @__PURE__ */ R(yr, { children: [
865
- /* @__PURE__ */ c(gr, { asChild: !0, children: t }),
866
- /* @__PURE__ */ c(Cr, { children: /* @__PURE__ */ R(
876
+ }, xr = ({ children: e, trigger: t, position: r }) => /* @__PURE__ */ d(yr, { delayDuration: 100, children: /* @__PURE__ */ R(gr, { children: [
877
+ /* @__PURE__ */ d(Cr, { asChild: !0, children: t }),
878
+ /* @__PURE__ */ d(wr, { children: /* @__PURE__ */ R(
867
879
  Er,
868
880
  {
869
881
  className: `tooltip-content ${r}`,
@@ -871,12 +883,12 @@ const Pr = 1e3 * 60 * 60, Vr = ({
871
883
  align: "center",
872
884
  children: [
873
885
  e,
874
- /* @__PURE__ */ c(wr, { className: "tooltip-arrow" })
886
+ /* @__PURE__ */ d(Pr, { className: "tooltip-arrow" })
875
887
  ]
876
888
  }
877
889
  ) })
878
890
  ] }) });
879
891
  export {
880
- Vr as CashValue,
881
- Pr as CurrencyCallStaleTimeMs
892
+ jr as CashValue,
893
+ br as CurrencyCallStaleTimeMs
882
894
  };