@pdf-viewer/react 1.4.2 → 1.4.3-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/dist/Popover-b7402893.js +1445 -0
  2. package/dist/{RPDefaultLayout-e27ef121.js → RPDefaultLayout-b9f5eccb.js} +228 -228
  3. package/dist/component-1da194e8.js +337 -0
  4. package/dist/components/RPController.js +1 -1
  5. package/dist/components/RPPages.js +2 -2
  6. package/dist/components/RPProvider.js +12 -11
  7. package/dist/components/layout/LayoutContainer.js +3 -2
  8. package/dist/components/layout/RPDefaultLayout.js +1 -1
  9. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  10. package/dist/components/layout/sidebar/Thumbnail.js +1 -1
  11. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  12. package/dist/components/layout/toolbar/DocumentDialog.js +3 -2
  13. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  14. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  15. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  16. package/dist/components/layout/toolbar/MostPageTool.js +4 -3
  17. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  18. package/dist/components/layout/toolbar/Paginate.js +1 -1
  19. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  20. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  21. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  22. package/dist/components/layout/toolbar/RotateTool.js +1 -1
  23. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  24. package/dist/components/layout/toolbar/SearchTool.js +4 -3
  25. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  26. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ZoomTool.js +4 -3
  28. package/dist/components/page/AnnotationLayer.js +3 -2
  29. package/dist/components/page/CanvasLayer.js +3 -2
  30. package/dist/components/page/DualPage.js +1 -1
  31. package/dist/components/page/RPPage.js +3 -2
  32. package/dist/components/page/SinglePage.js +1 -1
  33. package/dist/components/page/TextHighlightLayer.js +3 -2
  34. package/dist/components/page/TextLayer.js +3 -2
  35. package/dist/components/ui/Checkbox.js +7 -6
  36. package/dist/components/ui/DropDown.js +1 -1
  37. package/dist/components/ui/LoadingIndicator.js +1 -1
  38. package/dist/components/ui/Popover.js +1 -1
  39. package/dist/components/ui/RPTooltip.js +687 -328
  40. package/dist/contexts/PaginationContext.js +1 -1
  41. package/dist/contexts/PrintContext.js +1 -1
  42. package/dist/contexts/SearchContext.js +1 -1
  43. package/dist/contexts/ThumbnailsContext.js +1 -1
  44. package/dist/floating-ui.react-dom-15b9b819.js +1310 -0
  45. package/dist/index-2e540713.js +23 -0
  46. package/dist/index-353ec0a6.js +172 -0
  47. package/dist/index-5ff5dbd0.js +1675 -0
  48. package/dist/index-71898eb9.js +139 -0
  49. package/dist/main.js +1 -1
  50. package/dist/types/utils/hooks/useWatermark.d.ts +1 -1
  51. package/dist/utils/hooks/useFileDownload.js +3 -2
  52. package/dist/utils/hooks/useLicense.js +1 -1
  53. package/dist/utils/hooks/usePaginate.js +3 -2
  54. package/dist/utils/hooks/usePrint.js +3 -2
  55. package/dist/utils/hooks/useScrollToPage.js +3 -2
  56. package/dist/utils/hooks/useSearch.js +3 -2
  57. package/dist/utils/hooks/useThumbnail.js +3 -2
  58. package/dist/utils/hooks/useVirtualReactWindow.js +3 -2
  59. package/dist/utils/hooks/useWatermark.js +59 -28
  60. package/package.json +1 -1
  61. package/dist/Popover-d11ec15c.js +0 -3061
  62. package/dist/floating-ui.react-dom-88a86594.js +0 -1447
  63. package/dist/index-48ca3f30.js +0 -307
  64. package/dist/index-4ba3ab9a.js +0 -1877
@@ -1,143 +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, c as ae, u as k, e as Ye, f as Be, g as oe, a as Ge, b as E, d as Xe, S as Ve } from "../../index-48ca3f30.js";
5
- import { u as Ue, a as qe, o as ze, s as Ze, f as Ke, b as Je, c as Qe, h as et, l as tt, d as rt, D as ot } from "../../floating-ui.react-dom-88a86594.js";
6
- import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e, r) => {
7
- const { children: t, width: o = 10, height: n = 5, ...s } = e;
8
- return /* @__PURE__ */ d(
9
- 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,
10
222
  {
11
- ...s,
12
- ref: r,
223
+ ...i,
224
+ ref: t,
13
225
  width: o,
14
- height: n,
226
+ height: r,
15
227
  viewBox: "0 0 30 10",
16
228
  preserveAspectRatio: "none",
17
- 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" })
18
230
  }
19
231
  );
20
232
  });
21
- se.displayName = nt;
22
- var at = se, B = "Popper", [ie, le] = ae(B), [st, ce] = ie(B), de = (e) => {
23
- const { __scopePopper: r, children: t } = e, [o, n] = a.useState(null);
24
- 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 });
25
237
  };
26
- de.displayName = B;
27
- var pe = "PopperAnchor", ue = a.forwardRef(
28
- (e, r) => {
29
- const { __scopePopper: t, virtualRef: o, ...n } = e, s = ce(pe, t), i = a.useRef(null), h = k(r, i);
30
- return a.useEffect(() => {
31
- s.onAnchorChange((o == null ? void 0 : o.current) || i.current);
32
- }), 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 });
33
245
  }
34
246
  );
35
- ue.displayName = pe;
36
- var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
37
- (e, r) => {
38
- 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;
39
251
  const {
40
- __scopePopper: t,
252
+ __scopePopper: n,
41
253
  side: o = "bottom",
42
- sideOffset: n = 0,
43
- align: s = "center",
44
- alignOffset: i = 0,
45
- arrowPadding: h = 0,
254
+ sideOffset: r = 0,
255
+ align: i = "center",
256
+ alignOffset: a = 0,
257
+ arrowPadding: d = 0,
46
258
  avoidCollisions: l = !0,
47
- collisionBoundary: p = [],
48
- collisionPadding: c = 0,
49
- sticky: f = "partial",
259
+ collisionBoundary: c = [],
260
+ collisionPadding: u = 0,
261
+ sticky: h = "partial",
50
262
  hideWhenDetached: m = !1,
51
- updatePositionStrategy: u = "optimized",
263
+ updatePositionStrategy: p = "optimized",
52
264
  onPlaced: v,
53
- ...g
54
- } = 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 = {
55
- padding: Re,
56
- 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),
57
269
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
58
- altBoundary: _e
59
- }, { refs: Oe, floatingStyles: q, placement: Ne, isPositioned: D, middlewareData: A } = Ue({
270
+ altBoundary: Ge
271
+ }, { refs: Xe, floatingStyles: ne, placement: ze, isPositioned: W, middlewareData: N } = dt({
60
272
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
61
273
  strategy: "fixed",
62
- placement: Ee,
63
- whileElementsMounted: (..._) => qe(..._, {
64
- animationFrame: u === "always"
274
+ placement: M,
275
+ whileElementsMounted: (...L) => ft(...L, {
276
+ animationFrame: p === "always"
65
277
  }),
66
278
  elements: {
67
- reference: y.anchor
279
+ reference: w.anchor
68
280
  },
69
281
  middleware: [
70
- ze({ mainAxis: n + V, alignmentAxis: i }),
71
- l && Ze({
282
+ pt({ mainAxis: r + R, alignmentAxis: a }),
283
+ l && ht({
72
284
  mainAxis: !0,
73
285
  crossAxis: !1,
74
- limiter: f === "partial" ? tt() : void 0,
75
- ...S
286
+ limiter: h === "partial" ? wt() : void 0,
287
+ ...I
76
288
  }),
77
- l && Ke({ ...S }),
78
- Je({
79
- ...S,
80
- apply: ({ elements: _, rects: re, availableWidth: Me, availableHeight: $e }) => {
81
- const { width: Fe, height: je } = re.reference, I = _.floating.style;
82
- 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`);
83
295
  }
84
296
  }),
85
- C && Qe({ element: C, padding: h }),
86
- pt({ arrowWidth: N, arrowHeight: V }),
87
- m && et({ strategy: "referenceHidden", ...S })
297
+ E && yt({ element: E, padding: d }),
298
+ Ft({ arrowWidth: g, arrowHeight: R }),
299
+ m && gt({ strategy: "referenceHidden", ...I })
88
300
  ]
89
- }), [z, Se] = ge(Ne), H = Be(v);
90
- oe(() => {
91
- D && (H == null || H());
92
- }, [D, H]);
93
- 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();
94
- return oe(() => {
95
- w && Le(window.getComputedStyle(w).zIndex);
96
- }, [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(
97
309
  "div",
98
310
  {
99
- ref: Oe.setFloating,
311
+ ref: Xe.setFloating,
100
312
  "data-radix-popper-content-wrapper": "",
101
313
  style: {
102
- ...q,
103
- transform: D ? q.transform : "translate(0, -200%)",
314
+ ...ne,
315
+ transform: W ? ne.transform : "translate(0, -200%)",
104
316
  // keep off the page when measuring
105
317
  minWidth: "max-content",
106
- zIndex: ke,
318
+ zIndex: Qe,
107
319
  "--radix-popper-transform-origin": [
108
- (Q = A.transformOrigin) == null ? void 0 : Q.x,
109
- (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
110
322
  ].join(" "),
111
323
  // hide the content if using the hide middleware and should be hidden
112
324
  // set visibility to hidden and disable pointer events so the UI behaves
113
325
  // as if the PopperContent isn't there at all
114
- ...((te = A.hide) == null ? void 0 : te.referenceHidden) && {
326
+ ...((ce = N.hide) == null ? void 0 : ce.referenceHidden) && {
115
327
  visibility: "hidden",
116
328
  pointerEvents: "none"
117
329
  }
118
330
  },
119
331
  dir: e.dir,
120
- children: /* @__PURE__ */ d(
121
- it,
332
+ children: /* @__PURE__ */ f(
333
+ It,
122
334
  {
123
- scope: t,
124
- placedSide: z,
125
- onArrowChange: b,
126
- arrowX: De,
127
- arrowY: He,
128
- shouldHideArrow: Ie,
129
- children: /* @__PURE__ */ d(
130
- 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,
131
343
  {
132
- "data-side": z,
133
- "data-align": Se,
134
- ...g,
135
- ref: T,
344
+ "data-side": re,
345
+ "data-align": Ze,
346
+ ...y,
347
+ ref: x,
136
348
  style: {
137
- ...g.style,
349
+ ...y.style,
138
350
  // if the PopperContent hasn't been placed yet (not all measurements done)
139
351
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
140
- animation: D ? void 0 : "none"
352
+ animation: W ? void 0 : "none"
141
353
  }
142
354
  }
143
355
  )
@@ -147,48 +359,48 @@ var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
147
359
  );
148
360
  }
149
361
  );
150
- fe.displayName = G;
151
- var he = "PopperArrow", ct = {
362
+ Se.displayName = Q;
363
+ var _e = "PopperArrow", kt = {
152
364
  top: "bottom",
153
365
  right: "left",
154
366
  bottom: "top",
155
367
  left: "right"
156
- }, ve = a.forwardRef(function(r, t) {
157
- 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];
158
370
  return (
159
371
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
160
372
  // doesn't report size as we'd expect on SVG elements.
161
373
  // it reports their bounding box which is effectively the largest path inside the SVG.
162
- /* @__PURE__ */ d(
374
+ /* @__PURE__ */ f(
163
375
  "span",
164
376
  {
165
- ref: s.onArrowChange,
377
+ ref: i.onArrowChange,
166
378
  style: {
167
379
  position: "absolute",
168
- left: s.arrowX,
169
- top: s.arrowY,
170
- [i]: 0,
380
+ left: i.arrowX,
381
+ top: i.arrowY,
382
+ [a]: 0,
171
383
  transformOrigin: {
172
384
  top: "",
173
385
  right: "0 0",
174
386
  bottom: "center 0",
175
387
  left: "100% 0"
176
- }[s.placedSide],
388
+ }[i.placedSide],
177
389
  transform: {
178
390
  top: "translateY(100%)",
179
391
  right: "translateY(50%) rotate(90deg) translateX(-50%)",
180
392
  bottom: "rotate(180deg)",
181
393
  left: "translateY(50%) rotate(-90deg) translateX(50%)"
182
- }[s.placedSide],
183
- visibility: s.shouldHideArrow ? "hidden" : void 0
394
+ }[i.placedSide],
395
+ visibility: i.shouldHideArrow ? "hidden" : void 0
184
396
  },
185
- children: /* @__PURE__ */ d(
186
- at,
397
+ children: /* @__PURE__ */ f(
398
+ Lt,
187
399
  {
188
- ...n,
189
- ref: t,
400
+ ...r,
401
+ ref: n,
190
402
  style: {
191
- ...n.style,
403
+ ...r.style,
192
404
  // ensures the element can be measured correctly (mostly for if SVG)
193
405
  display: "block"
194
406
  }
@@ -198,30 +410,177 @@ var he = "PopperArrow", ct = {
198
410
  )
199
411
  );
200
412
  });
201
- ve.displayName = he;
202
- function dt(e) {
413
+ Le.displayName = _e;
414
+ function $t(e) {
203
415
  return e !== null;
204
416
  }
205
- var pt = (e) => ({
417
+ var Ft = (e) => ({
206
418
  name: "transformOrigin",
207
419
  options: e,
208
- fn(r) {
209
- var y, w, x;
210
- 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] = ge(t), f = { start: "0%", center: "50%", end: "100%" }[c], m = (((w = n.arrow) == null ? void 0 : w.x) ?? 0) + h / 2, u = (((x = n.arrow) == null ? void 0 : x.y) ?? 0) + l / 2;
211
- let v = "", g = "";
212
- return p === "bottom" ? (v = i ? f : `${m}px`, g = `${-l}px`) : p === "top" ? (v = i ? f : `${m}px`, g = `${o.floating.height + l}px`) : p === "right" ? (v = `${-l}px`, g = i ? f : `${u}px`) : p === "left" && (v = `${o.floating.width + l}px`, g = i ? f : `${u}px`), { data: { x: v, y: g } };
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 } };
213
425
  }
214
426
  });
215
- function ge(e) {
216
- const [r, t = "center"] = e.split("-");
217
- return [r, t];
427
+ function Me(e) {
428
+ const [t, n = "center"] = e.split("-");
429
+ return [t, n];
218
430
  }
219
- var ut = de, ft = ue, ht = fe, vt = ve, gt = "VisuallyHidden", me = a.forwardRef(
220
- (e, r) => /* @__PURE__ */ d(
221
- 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,
222
581
  {
223
582
  ...e,
224
- ref: r,
583
+ ref: t,
225
584
  style: {
226
585
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
227
586
  position: "absolute",
@@ -239,192 +598,192 @@ var ut = de, ft = ue, ht = fe, vt = ve, gt = "VisuallyHidden", me = a.forwardRef
239
598
  }
240
599
  )
241
600
  );
242
- me.displayName = gt;
243
- var mt = me, [L, jt] = ae("Tooltip", [
244
- le
245
- ]), 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) => {
246
605
  const {
247
- __scopeTooltip: r,
248
- delayDuration: t = yt,
606
+ __scopeTooltip: t,
607
+ delayDuration: n = nn,
249
608
  skipDelayDuration: o = 300,
250
- disableHoverableContent: n = !1,
251
- children: s
252
- } = e, [i, h] = a.useState(!0), l = a.useRef(!1), p = a.useRef(0);
253
- return a.useEffect(() => {
254
- const c = p.current;
255
- return () => window.clearTimeout(c);
256
- }, []), /* @__PURE__ */ d(
257
- 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,
258
617
  {
259
- scope: r,
260
- isOpenDelayed: i,
261
- delayDuration: t,
262
- onOpen: a.useCallback(() => {
263
- 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);
264
623
  }, []),
265
- onClose: a.useCallback(() => {
266
- window.clearTimeout(p.current), p.current = window.setTimeout(
267
- () => h(!0),
624
+ onClose: s.useCallback(() => {
625
+ window.clearTimeout(c.current), c.current = window.setTimeout(
626
+ () => d(!0),
268
627
  o
269
628
  );
270
629
  }, [o]),
271
630
  isPointerInTransitRef: l,
272
- onPointerInTransitChange: a.useCallback((c) => {
273
- l.current = c;
631
+ onPointerInTransitChange: s.useCallback((u) => {
632
+ l.current = u;
274
633
  }, []),
275
- disableHoverableContent: n,
276
- children: s
634
+ disableHoverableContent: r,
635
+ children: i
277
636
  }
278
637
  );
279
638
  };
280
- we.displayName = ye;
281
- var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
639
+ Fe.displayName = $e;
640
+ var V = "Tooltip", [on, j] = B(V), He = (e) => {
282
641
  const {
283
- __scopeTooltip: r,
284
- children: t,
642
+ __scopeTooltip: t,
643
+ children: n,
285
644
  open: o,
286
- defaultOpen: n = !1,
287
- onOpenChange: s,
288
- disableHoverableContent: i,
289
- delayDuration: h
290
- } = e, l = X($, e.__scopeTooltip), p = M(r), [c, f] = a.useState(null), m = rt(), u = a.useRef(0), v = i ?? l.disableHoverableContent, g = 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({
291
650
  prop: o,
292
- defaultProp: n,
293
- onChange: (N) => {
294
- 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);
295
654
  }
296
- }), T = a.useMemo(() => w ? y.current ? "delayed-open" : "instant-open" : "closed", [w]), C = a.useCallback(() => {
297
- window.clearTimeout(u.current), u.current = 0, y.current = !1, x(!0);
298
- }, [x]), b = a.useCallback(() => {
299
- window.clearTimeout(u.current), u.current = 0, x(!1);
300
- }, [x]), P = a.useCallback(() => {
301
- window.clearTimeout(u.current), u.current = window.setTimeout(() => {
302
- y.current = !0, x(!0), u.current = 0;
303
- }, g);
304
- }, [g, x]);
305
- return a.useEffect(() => () => {
306
- u.current && (window.clearTimeout(u.current), u.current = 0);
307
- }, []), /* @__PURE__ */ d(ut, { ...p, children: /* @__PURE__ */ d(
308
- 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,
309
668
  {
310
- scope: r,
669
+ scope: t,
311
670
  contentId: m,
312
- open: w,
313
- stateAttribute: T,
314
- trigger: c,
315
- onTriggerChange: f,
316
- onTriggerEnter: a.useCallback(() => {
317
- l.isOpenDelayed ? P() : C();
318
- }, [l.isOpenDelayed, P, C]),
319
- onTriggerLeave: a.useCallback(() => {
320
- v ? b() : (window.clearTimeout(u.current), u.current = 0);
321
- }, [b, v]),
322
- onOpen: C,
323
- onClose: b,
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,
324
683
  disableHoverableContent: v,
325
- children: t
684
+ children: n
326
685
  }
327
686
  ) });
328
687
  };
329
- xe.displayName = $;
330
- var Y = "TooltipTrigger", Ce = a.forwardRef(
331
- (e, r) => {
332
- 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, []);
333
- return a.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(ft, { asChild: !0, ...i, children: /* @__PURE__ */ d(
334
- 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,
335
694
  {
336
- "aria-describedby": n.open ? n.contentId : void 0,
337
- "data-state": n.stateAttribute,
695
+ "aria-describedby": r.open ? r.contentId : void 0,
696
+ "data-state": r.stateAttribute,
338
697
  ...o,
339
698
  ref: l,
340
- onPointerMove: E(e.onPointerMove, (m) => {
341
- m.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);
342
701
  }),
343
- onPointerLeave: E(e.onPointerLeave, () => {
344
- n.onTriggerLeave(), c.current = !1;
702
+ onPointerLeave: A(e.onPointerLeave, () => {
703
+ r.onTriggerLeave(), u.current = !1;
345
704
  }),
346
- onPointerDown: E(e.onPointerDown, () => {
347
- p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
705
+ onPointerDown: A(e.onPointerDown, () => {
706
+ c.current = !0, document.addEventListener("pointerup", h, { once: !0 });
348
707
  }),
349
- onFocus: E(e.onFocus, () => {
350
- p.current || n.onOpen();
708
+ onFocus: A(e.onFocus, () => {
709
+ c.current || r.onOpen();
351
710
  }),
352
- onBlur: E(e.onBlur, n.onClose),
353
- onClick: E(e.onClick, n.onClose)
711
+ onBlur: A(e.onBlur, r.onClose),
712
+ onClick: A(e.onClick, r.onClose)
354
713
  }
355
714
  ) });
356
715
  }
357
716
  );
358
- Ce.displayName = Y;
359
- var Ct = "TooltipPortal", [Wt, Pt] = L(Ct, {
717
+ Be.displayName = q;
718
+ var sn = "TooltipPortal", [Rn, an] = B(sn, {
360
719
  forceMount: void 0
361
- }), R = "TooltipContent", Pe = a.forwardRef(
362
- (e, r) => {
363
- const t = Pt(R, e.__scopeTooltip), { forceMount: o = t.forceMount, side: n = "top", ...s } = e, i = F(R, e.__scopeTooltip);
364
- 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 }) });
365
724
  }
366
- ), Tt = a.forwardRef((e, r) => {
367
- 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, m = a.useCallback(() => {
368
- h(null), f(!1);
369
- }, [f]), u = a.useCallback(
370
- (v, g) => {
371
- const y = v.currentTarget, w = { x: v.clientX, y: v.clientY }, x = Et(w, y.getBoundingClientRect()), T = Rt(w, x), C = _t(g.getBoundingClientRect()), b = Nt([...T, ...C]);
372
- 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);
373
732
  },
374
- [f]
733
+ [h]
375
734
  );
376
- return a.useEffect(() => () => m(), [m]), a.useEffect(() => {
377
- if (l && c) {
378
- const v = (y) => u(y, c), g = (y) => u(y, l);
379
- return l.addEventListener("pointerleave", v), c.addEventListener("pointerleave", g), () => {
380
- l.removeEventListener("pointerleave", v), c.removeEventListener("pointerleave", g);
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);
381
740
  };
382
741
  }
383
- }, [l, c, u, m]), a.useEffect(() => {
384
- if (i) {
385
- const v = (g) => {
386
- const y = g.target, w = { x: g.clientX, y: g.clientY }, x = (l == null ? void 0 : l.contains(y)) || (c == null ? void 0 : c.contains(y)), T = !Ot(w, i);
387
- x ? m() : T && (m(), 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());
388
747
  };
389
748
  return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
390
749
  }
391
- }, [l, c, i, p, m]), /* @__PURE__ */ d(Te, { ...e, ref: s });
392
- }), [bt, At] = L($, { isInside: !1 }), Te = a.forwardRef(
393
- (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) => {
394
753
  const {
395
- __scopeTooltip: t,
754
+ __scopeTooltip: n,
396
755
  children: o,
397
- "aria-label": n,
398
- onEscapeKeyDown: s,
399
- onPointerDownOutside: i,
400
- ...h
401
- } = e, l = F(R, t), p = M(t), { onClose: c } = l;
402
- 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(() => {
403
762
  if (l.trigger) {
404
- const f = (m) => {
405
- const u = m.target;
406
- u != null && u.contains(l.trigger) && c();
763
+ const h = (m) => {
764
+ const p = m.target;
765
+ p != null && p.contains(l.trigger) && u();
407
766
  };
408
- 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 });
409
768
  }
410
- }, [l.trigger, c]), /* @__PURE__ */ d(
411
- ot,
769
+ }, [l.trigger, u]), /* @__PURE__ */ f(
770
+ Ee,
412
771
  {
413
772
  asChild: !0,
414
773
  disableOutsidePointerEvents: !1,
415
- onEscapeKeyDown: s,
416
- onPointerDownOutside: i,
417
- onFocusOutside: (f) => f.preventDefault(),
418
- onDismiss: c,
419
- children: /* @__PURE__ */ j(
420
- ht,
774
+ onEscapeKeyDown: i,
775
+ onPointerDownOutside: a,
776
+ onFocusOutside: (h) => h.preventDefault(),
777
+ onDismiss: u,
778
+ children: /* @__PURE__ */ Y(
779
+ Ut,
421
780
  {
422
781
  "data-state": l.stateAttribute,
423
- ...p,
424
- ...h,
425
- ref: r,
782
+ ...c,
783
+ ...d,
784
+ ref: t,
426
785
  style: {
427
- ...h.style,
786
+ ...d.style,
428
787
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
429
788
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
430
789
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -432,8 +791,8 @@ var Ct = "TooltipPortal", [Wt, Pt] = L(Ct, {
432
791
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
433
792
  },
434
793
  children: [
435
- /* @__PURE__ */ d(Ve, { children: o }),
436
- /* @__PURE__ */ d(bt, { scope: t, isInside: !0, children: /* @__PURE__ */ d(mt, { 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 }) })
437
796
  ]
438
797
  }
439
798
  )
@@ -441,25 +800,25 @@ var Ct = "TooltipPortal", [Wt, Pt] = L(Ct, {
441
800
  );
442
801
  }
443
802
  );
444
- Pe.displayName = R;
445
- var be = "TooltipArrow", Ae = a.forwardRef(
446
- (e, r) => {
447
- const { __scopeTooltip: t, ...o } = e, n = M(t);
448
- return At(
449
- be,
450
- t
451
- ).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 });
452
811
  }
453
812
  );
454
- Ae.displayName = be;
455
- function Et(e, r) {
456
- 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);
457
- switch (Math.min(t, o, n, s)) {
458
- 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:
459
818
  return "left";
460
- case n:
819
+ case r:
461
820
  return "right";
462
- case t:
821
+ case n:
463
822
  return "top";
464
823
  case o:
465
824
  return "bottom";
@@ -467,102 +826,102 @@ function Et(e, r) {
467
826
  throw new Error("unreachable");
468
827
  }
469
828
  }
470
- function Rt(e, r, t = 5) {
829
+ function fn(e, t, n = 5) {
471
830
  const o = [];
472
- switch (r) {
831
+ switch (t) {
473
832
  case "top":
474
833
  o.push(
475
- { x: e.x - t, y: e.y + t },
476
- { 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 }
477
836
  );
478
837
  break;
479
838
  case "bottom":
480
839
  o.push(
481
- { x: e.x - t, y: e.y - t },
482
- { 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 }
483
842
  );
484
843
  break;
485
844
  case "left":
486
845
  o.push(
487
- { x: e.x + t, y: e.y - t },
488
- { 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 }
489
848
  );
490
849
  break;
491
850
  case "right":
492
851
  o.push(
493
- { x: e.x - t, y: e.y - t },
494
- { 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 }
495
854
  );
496
855
  break;
497
856
  }
498
857
  return o;
499
858
  }
500
- function _t(e) {
501
- 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;
502
861
  return [
503
- { x: n, y: r },
504
- { x: t, y: r },
505
- { x: t, y: o },
506
- { x: n, y: o }
862
+ { x: r, y: t },
863
+ { x: n, y: t },
864
+ { x: n, y: o },
865
+ { x: r, y: o }
507
866
  ];
508
867
  }
509
- function Ot(e, r) {
510
- const { x: t, y: o } = e;
511
- let n = !1;
512
- for (let s = 0, i = r.length - 1; s < r.length; i = s++) {
513
- const h = r[s].x, l = r[s].y, p = r[i].x, c = r[i].y;
514
- 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);
515
874
  }
516
- return n;
875
+ return r;
517
876
  }
518
- function Nt(e) {
519
- const r = e.slice();
520
- 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);
521
880
  }
522
- function St(e) {
881
+ function vn(e) {
523
882
  if (e.length <= 1)
524
883
  return e.slice();
525
- const r = [];
884
+ const t = [];
526
885
  for (let o = 0; o < e.length; o++) {
527
- const n = e[o];
528
- for (; r.length >= 2; ) {
529
- const s = r[r.length - 1], i = r[r.length - 2];
530
- if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
531
- 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();
532
891
  else
533
892
  break;
534
893
  }
535
- r.push(n);
894
+ t.push(r);
536
895
  }
537
- r.pop();
538
- const t = [];
896
+ t.pop();
897
+ const n = [];
539
898
  for (let o = e.length - 1; o >= 0; o--) {
540
- const n = e[o];
541
- for (; t.length >= 2; ) {
542
- const s = t[t.length - 1], i = t[t.length - 2];
543
- if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
544
- 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();
545
904
  else
546
905
  break;
547
906
  }
548
- t.push(n);
907
+ n.push(r);
549
908
  }
550
- 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);
551
910
  }
552
- const Dt = "_tooltipContent_thtj1_1", Ht = "_tooltipArrow_thtj1_8", It = "_fadeIn_thtj1_1", ne = {
553
- tooltipContent: Dt,
554
- tooltipArrow: Ht,
555
- fadeIn: It
556
- }, kt = We(
557
- ({ children: e, content: r, className: t, style: o }, n) => /* @__PURE__ */ d(we, { children: /* @__PURE__ */ j(xe, { delayDuration: 1e3, children: [
558
- /* @__PURE__ */ d(Ce, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: o, children: e }) }),
559
- /* @__PURE__ */ j(Pe, { className: ne.tooltipContent, sideOffset: 5, children: [
560
- /* @__PURE__ */ d(Ae, { className: ne.tooltipArrow }),
561
- /* @__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 })
562
921
  ] })
563
922
  ] }) })
564
923
  );
565
- kt.displayName = "RPTooltip";
924
+ Cn.displayName = "RPTooltip";
566
925
  export {
567
- kt as default
926
+ Cn as default
568
927
  };