@pdf-viewer/react 1.5.1 → 1.6.0-beta.1

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