@pdf-viewer/react 1.4.2 → 1.4.3

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-f9017f0e.js} +606 -601
  3. package/dist/component-1da194e8.js +337 -0
  4. package/dist/components/RPConfig.js +270 -259
  5. package/dist/components/RPController.js +1 -1
  6. package/dist/components/RPPages.js +2 -2
  7. package/dist/components/RPProvider.js +12 -11
  8. package/dist/components/layout/LayoutContainer.js +3 -2
  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 +3 -2
  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 +4 -3
  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/SearchTool.js +4 -3
  26. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  28. package/dist/components/layout/toolbar/ZoomTool.js +4 -3
  29. package/dist/components/page/AnnotationLayer.js +3 -2
  30. package/dist/components/page/CanvasLayer.js +3 -2
  31. package/dist/components/page/DualPage.js +1 -1
  32. package/dist/components/page/RPPage.js +3 -2
  33. package/dist/components/page/SinglePage.js +1 -1
  34. package/dist/components/page/TextHighlightLayer.js +3 -2
  35. package/dist/components/page/TextLayer.js +3 -2
  36. package/dist/components/ui/Checkbox.js +111 -94
  37. package/dist/components/ui/DropDown.js +1 -1
  38. package/dist/components/ui/LoadingIndicator.js +1 -1
  39. package/dist/components/ui/Popover.js +1 -1
  40. package/dist/components/ui/RPTooltip.js +206 -205
  41. package/dist/contexts/PaginationContext.js +1 -1
  42. package/dist/contexts/PrintContext.js +1 -1
  43. package/dist/contexts/SearchContext.js +1 -1
  44. package/dist/contexts/ThumbnailsContext.js +1 -1
  45. package/dist/floating-ui.react-dom-15b9b819.js +1310 -0
  46. package/dist/index-0f08882b.js +1561 -0
  47. package/dist/index-10ac1200.js +150 -0
  48. package/dist/index-271658fe.js +331 -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 +2 -2
  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,16 +1,17 @@
1
- import { jsx as d, jsxs as j } from "react/jsx-runtime";
1
+ import { jsx as d, jsxs as Y } from "react/jsx-runtime";
2
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;
3
+ import { forwardRef as Fe } from "react";
4
+ import { P as N, c as ae, u as k, e as We, g as re, a as Be, b as E, d as Ge, h as Xe } from "../../index-271658fe.js";
5
+ import { u as Ve, a as Ue, D as ze } from "../../index-10ac1200.js";
6
+ import { u as qe, a as Ze, o as Ke, s as Je, f as Qe, b as et, c as tt, h as ot, l as rt } from "../../floating-ui.react-dom-15b9b819.js";
7
+ import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e, o) => {
8
+ const { children: t, width: r = 10, height: n = 5, ...s } = e;
8
9
  return /* @__PURE__ */ d(
9
- O.svg,
10
+ N.svg,
10
11
  {
11
12
  ...s,
12
- ref: r,
13
- width: o,
13
+ ref: o,
14
+ width: r,
14
15
  height: n,
15
16
  viewBox: "0 0 30 10",
16
17
  preserveAspectRatio: "none",
@@ -20,25 +21,25 @@ import '../../assets/RPTooltip.css';var nt = "Arrow", se = a.forwardRef((e, r) =
20
21
  });
21
22
  se.displayName = nt;
22
23
  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 });
24
+ const { __scopePopper: o, children: t } = e, [r, n] = a.useState(null);
25
+ return /* @__PURE__ */ d(st, { scope: o, anchor: r, onAnchorChange: n, children: t });
25
26
  };
26
27
  de.displayName = B;
27
28
  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);
29
+ (e, o) => {
30
+ const { __scopePopper: t, virtualRef: r, ...n } = e, s = ce(pe, t), i = a.useRef(null), h = k(o, i);
30
31
  return a.useEffect(() => {
31
- s.onAnchorChange((o == null ? void 0 : o.current) || i.current);
32
- }), o ? null : /* @__PURE__ */ d(O.div, { ...n, ref: h });
32
+ s.onAnchorChange((r == null ? void 0 : r.current) || i.current);
33
+ }), r ? null : /* @__PURE__ */ d(N.div, { ...n, ref: h });
33
34
  }
34
35
  );
35
36
  ue.displayName = pe;
36
37
  var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
37
- (e, r) => {
38
+ (e, o) => {
38
39
  var Z, K, J, Q, ee, te;
39
40
  const {
40
41
  __scopePopper: t,
41
- side: o = "bottom",
42
+ side: r = "bottom",
42
43
  sideOffset: n = 0,
43
44
  align: s = "center",
44
45
  alignOffset: i = 0,
@@ -47,63 +48,63 @@ var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
47
48
  collisionBoundary: p = [],
48
49
  collisionPadding: c = 0,
49
50
  sticky: f = "partial",
50
- hideWhenDetached: m = !1,
51
+ hideWhenDetached: g = !1,
51
52
  updatePositionStrategy: u = "optimized",
52
53
  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 = {
54
+ ...m
55
+ } = e, y = ce(G, t), [w, x] = a.useState(null), T = k(o, (_) => x(_)), [C, b] = a.useState(null), P = We(C), S = (P == null ? void 0 : P.width) ?? 0, V = (P == null ? void 0 : P.height) ?? 0, Ee = r + (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, D = {
55
56
  padding: Re,
56
57
  boundary: U.filter(dt),
57
58
  // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
58
59
  altBoundary: _e
59
- }, { refs: Oe, floatingStyles: q, placement: Ne, isPositioned: D, middlewareData: A } = Ue({
60
+ }, { refs: Oe, floatingStyles: z, placement: Ne, isPositioned: H, middlewareData: A } = qe({
60
61
  // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
61
62
  strategy: "fixed",
62
63
  placement: Ee,
63
- whileElementsMounted: (..._) => qe(..._, {
64
+ whileElementsMounted: (..._) => Ze(..._, {
64
65
  animationFrame: u === "always"
65
66
  }),
66
67
  elements: {
67
68
  reference: y.anchor
68
69
  },
69
70
  middleware: [
70
- ze({ mainAxis: n + V, alignmentAxis: i }),
71
- l && Ze({
71
+ Ke({ mainAxis: n + V, alignmentAxis: i }),
72
+ l && Je({
72
73
  mainAxis: !0,
73
74
  crossAxis: !1,
74
- limiter: f === "partial" ? tt() : void 0,
75
- ...S
75
+ limiter: f === "partial" ? rt() : void 0,
76
+ ...D
76
77
  }),
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`);
78
+ l && Qe({ ...D }),
79
+ et({
80
+ ...D,
81
+ apply: ({ elements: _, rects: oe, availableWidth: Me, availableHeight: $e }) => {
82
+ const { width: je, height: Ye } = oe.reference, L = _.floating.style;
83
+ L.setProperty("--radix-popper-available-width", `${Me}px`), L.setProperty("--radix-popper-available-height", `${$e}px`), L.setProperty("--radix-popper-anchor-width", `${je}px`), L.setProperty("--radix-popper-anchor-height", `${Ye}px`);
83
84
  }
84
85
  }),
85
- C && Qe({ element: C, padding: h }),
86
- pt({ arrowWidth: N, arrowHeight: V }),
87
- m && et({ strategy: "referenceHidden", ...S })
86
+ C && tt({ element: C, padding: h }),
87
+ pt({ arrowWidth: S, arrowHeight: V }),
88
+ g && ot({ strategy: "referenceHidden", ...D })
88
89
  ]
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);
90
+ }), [q, Se] = ge(Ne), I = Ve(v);
91
+ re(() => {
92
+ H && (I == null || I());
93
+ }, [H, I]);
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, [Le, ke] = a.useState();
95
+ return re(() => {
96
+ w && ke(window.getComputedStyle(w).zIndex);
96
97
  }, [w]), /* @__PURE__ */ d(
97
98
  "div",
98
99
  {
99
100
  ref: Oe.setFloating,
100
101
  "data-radix-popper-content-wrapper": "",
101
102
  style: {
102
- ...q,
103
- transform: D ? q.transform : "translate(0, -200%)",
103
+ ...z,
104
+ transform: H ? z.transform : "translate(0, -200%)",
104
105
  // keep off the page when measuring
105
106
  minWidth: "max-content",
106
- zIndex: ke,
107
+ zIndex: Le,
107
108
  "--radix-popper-transform-origin": [
108
109
  (Q = A.transformOrigin) == null ? void 0 : Q.x,
109
110
  (ee = A.transformOrigin) == null ? void 0 : ee.y
@@ -121,23 +122,23 @@ var G = "PopperContent", [it, lt] = ie(G), fe = a.forwardRef(
121
122
  it,
122
123
  {
123
124
  scope: t,
124
- placedSide: z,
125
+ placedSide: q,
125
126
  onArrowChange: b,
126
127
  arrowX: De,
127
128
  arrowY: He,
128
129
  shouldHideArrow: Ie,
129
130
  children: /* @__PURE__ */ d(
130
- O.div,
131
+ N.div,
131
132
  {
132
- "data-side": z,
133
+ "data-side": q,
133
134
  "data-align": Se,
134
- ...g,
135
+ ...m,
135
136
  ref: T,
136
137
  style: {
137
- ...g.style,
138
+ ...m.style,
138
139
  // if the PopperContent hasn't been placed yet (not all measurements done)
139
140
  // we prevent animations so that users's animation don't kick in too early referring wrong sides
140
- animation: D ? void 0 : "none"
141
+ animation: H ? void 0 : "none"
141
142
  }
142
143
  }
143
144
  )
@@ -153,8 +154,8 @@ var he = "PopperArrow", ct = {
153
154
  right: "left",
154
155
  bottom: "top",
155
156
  left: "right"
156
- }, ve = a.forwardRef(function(r, t) {
157
- const { __scopePopper: o, ...n } = r, s = lt(he, o), i = ct[s.placedSide];
157
+ }, ve = a.forwardRef(function(o, t) {
158
+ const { __scopePopper: r, ...n } = o, s = lt(he, r), i = ct[s.placedSide];
158
159
  return (
159
160
  // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
160
161
  // doesn't report size as we'd expect on SVG elements.
@@ -205,72 +206,71 @@ function dt(e) {
205
206
  var pt = (e) => ({
206
207
  name: "transformOrigin",
207
208
  options: e,
208
- fn(r) {
209
+ fn(o) {
209
210
  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 } };
211
+ const { placement: t, rects: r, middlewareData: n } = o, 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], 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 = `${r.floating.height + l}px`) : p === "right" ? (v = `${-l}px`, m = i ? f : `${u}px`) : p === "left" && (v = `${r.floating.width + l}px`, m = i ? f : `${u}px`), { data: { x: v, y: m } };
213
214
  }
214
215
  });
215
216
  function ge(e) {
216
- const [r, t = "center"] = e.split("-");
217
- return [r, t];
217
+ const [o, t = "center"] = e.split("-");
218
+ return [o, t];
218
219
  }
219
- var ut = de, ft = ue, ht = fe, vt = ve, gt = "VisuallyHidden", me = a.forwardRef(
220
- (e, r) => /* @__PURE__ */ d(
221
- O.span,
220
+ var ut = de, ft = ue, ht = fe, vt = ve, gt = Object.freeze({
221
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
222
+ position: "absolute",
223
+ border: 0,
224
+ width: 1,
225
+ height: 1,
226
+ padding: 0,
227
+ margin: -1,
228
+ overflow: "hidden",
229
+ clip: "rect(0, 0, 0, 0)",
230
+ whiteSpace: "nowrap",
231
+ wordWrap: "normal"
232
+ }), mt = "VisuallyHidden", me = a.forwardRef(
233
+ (e, o) => /* @__PURE__ */ d(
234
+ N.span,
222
235
  {
223
236
  ...e,
224
- ref: r,
225
- style: {
226
- // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
227
- position: "absolute",
228
- border: 0,
229
- width: 1,
230
- height: 1,
231
- padding: 0,
232
- margin: -1,
233
- overflow: "hidden",
234
- clip: "rect(0, 0, 0, 0)",
235
- whiteSpace: "nowrap",
236
- wordWrap: "normal",
237
- ...e.style
238
- }
237
+ ref: o,
238
+ style: { ...gt, ...e.style }
239
239
  }
240
240
  )
241
241
  );
242
- me.displayName = gt;
243
- var mt = me, [L, jt] = ae("Tooltip", [
242
+ me.displayName = mt;
243
+ var yt = me, [M, Bt] = ae("Tooltip", [
244
244
  le
245
- ]), M = le(), ye = "TooltipProvider", yt = 700, W = "tooltip.open", [wt, X] = L(ye), we = (e) => {
245
+ ]), $ = le(), ye = "TooltipProvider", wt = 700, F = "tooltip.open", [xt, X] = M(ye), we = (e) => {
246
246
  const {
247
- __scopeTooltip: r,
248
- delayDuration: t = yt,
249
- skipDelayDuration: o = 300,
247
+ __scopeTooltip: o,
248
+ delayDuration: t = wt,
249
+ skipDelayDuration: r = 300,
250
250
  disableHoverableContent: n = !1,
251
251
  children: s
252
- } = e, [i, h] = a.useState(!0), l = a.useRef(!1), p = a.useRef(0);
252
+ } = e, i = a.useRef(!0), h = a.useRef(!1), l = a.useRef(0);
253
253
  return a.useEffect(() => {
254
- const c = p.current;
255
- return () => window.clearTimeout(c);
254
+ const p = l.current;
255
+ return () => window.clearTimeout(p);
256
256
  }, []), /* @__PURE__ */ d(
257
- wt,
257
+ xt,
258
258
  {
259
- scope: r,
260
- isOpenDelayed: i,
259
+ scope: o,
260
+ isOpenDelayedRef: i,
261
261
  delayDuration: t,
262
262
  onOpen: a.useCallback(() => {
263
- window.clearTimeout(p.current), h(!1);
263
+ window.clearTimeout(l.current), i.current = !1;
264
264
  }, []),
265
265
  onClose: a.useCallback(() => {
266
- window.clearTimeout(p.current), p.current = window.setTimeout(
267
- () => h(!0),
268
- o
266
+ window.clearTimeout(l.current), l.current = window.setTimeout(
267
+ () => i.current = !0,
268
+ r
269
269
  );
270
- }, [o]),
271
- isPointerInTransitRef: l,
272
- onPointerInTransitChange: a.useCallback((c) => {
273
- l.current = c;
270
+ }, [r]),
271
+ isPointerInTransitRef: h,
272
+ onPointerInTransitChange: a.useCallback((p) => {
273
+ h.current = p;
274
274
  }, []),
275
275
  disableHoverableContent: n,
276
276
  children: s
@@ -278,21 +278,22 @@ var mt = me, [L, jt] = ae("Tooltip", [
278
278
  );
279
279
  };
280
280
  we.displayName = ye;
281
- var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
281
+ var O = "Tooltip", [Ct, j] = M(O), xe = (e) => {
282
282
  const {
283
- __scopeTooltip: r,
283
+ __scopeTooltip: o,
284
284
  children: t,
285
- open: o,
286
- defaultOpen: n = !1,
285
+ open: r,
286
+ defaultOpen: n,
287
287
  onOpenChange: s,
288
288
  disableHoverableContent: i,
289
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({
291
- prop: o,
292
- defaultProp: n,
293
- onChange: (N) => {
294
- N ? (l.onOpen(), document.dispatchEvent(new CustomEvent(W))) : l.onClose(), s == null || s(N);
295
- }
290
+ } = e, l = X(O, e.__scopeTooltip), p = $(o), [c, f] = a.useState(null), g = Ue(), u = a.useRef(0), v = i ?? l.disableHoverableContent, m = h ?? l.delayDuration, y = a.useRef(!1), [w, x] = Be({
291
+ prop: r,
292
+ defaultProp: n ?? !1,
293
+ onChange: (S) => {
294
+ S ? (l.onOpen(), document.dispatchEvent(new CustomEvent(F))) : l.onClose(), s == null || s(S);
295
+ },
296
+ caller: O
296
297
  }), T = a.useMemo(() => w ? y.current ? "delayed-open" : "instant-open" : "closed", [w]), C = a.useCallback(() => {
297
298
  window.clearTimeout(u.current), u.current = 0, y.current = !1, x(!0);
298
299
  }, [x]), b = a.useCallback(() => {
@@ -300,22 +301,22 @@ var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
300
301
  }, [x]), P = a.useCallback(() => {
301
302
  window.clearTimeout(u.current), u.current = window.setTimeout(() => {
302
303
  y.current = !0, x(!0), u.current = 0;
303
- }, g);
304
- }, [g, x]);
304
+ }, m);
305
+ }, [m, x]);
305
306
  return a.useEffect(() => () => {
306
307
  u.current && (window.clearTimeout(u.current), u.current = 0);
307
308
  }, []), /* @__PURE__ */ d(ut, { ...p, children: /* @__PURE__ */ d(
308
- xt,
309
+ Ct,
309
310
  {
310
- scope: r,
311
- contentId: m,
311
+ scope: o,
312
+ contentId: g,
312
313
  open: w,
313
314
  stateAttribute: T,
314
315
  trigger: c,
315
316
  onTriggerChange: f,
316
317
  onTriggerEnter: a.useCallback(() => {
317
- l.isOpenDelayed ? P() : C();
318
- }, [l.isOpenDelayed, P, C]),
318
+ l.isOpenDelayedRef.current ? P() : C();
319
+ }, [l.isOpenDelayedRef, P, C]),
319
320
  onTriggerLeave: a.useCallback(() => {
320
321
  v ? b() : (window.clearTimeout(u.current), u.current = 0);
321
322
  }, [b, v]),
@@ -326,25 +327,25 @@ var $ = "Tooltip", [xt, F] = L($), xe = (e) => {
326
327
  }
327
328
  ) });
328
329
  };
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, []);
330
+ xe.displayName = O;
331
+ var W = "TooltipTrigger", Ce = a.forwardRef(
332
+ (e, o) => {
333
+ const { __scopeTooltip: t, ...r } = e, n = j(W, t), s = X(W, t), i = $(t), h = a.useRef(null), l = k(o, h, n.onTriggerChange), p = a.useRef(!1), c = a.useRef(!1), f = a.useCallback(() => p.current = !1, []);
333
334
  return a.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(ft, { asChild: !0, ...i, children: /* @__PURE__ */ d(
334
- O.button,
335
+ N.button,
335
336
  {
336
337
  "aria-describedby": n.open ? n.contentId : void 0,
337
338
  "data-state": n.stateAttribute,
338
- ...o,
339
+ ...r,
339
340
  ref: l,
340
- onPointerMove: E(e.onPointerMove, (m) => {
341
- m.pointerType !== "touch" && !c.current && !s.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
341
+ onPointerMove: E(e.onPointerMove, (g) => {
342
+ g.pointerType !== "touch" && !c.current && !s.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
342
343
  }),
343
344
  onPointerLeave: E(e.onPointerLeave, () => {
344
345
  n.onTriggerLeave(), c.current = !1;
345
346
  }),
346
347
  onPointerDown: E(e.onPointerDown, () => {
347
- p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
348
+ n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
348
349
  }),
349
350
  onFocus: E(e.onFocus, () => {
350
351
  p.current || n.onOpen();
@@ -355,60 +356,60 @@ var Y = "TooltipTrigger", Ce = a.forwardRef(
355
356
  ) });
356
357
  }
357
358
  );
358
- Ce.displayName = Y;
359
- var Ct = "TooltipPortal", [Wt, Pt] = L(Ct, {
359
+ Ce.displayName = W;
360
+ var Pt = "TooltipPortal", [Gt, Tt] = M(Pt, {
360
361
  forceMount: void 0
361
362
  }), 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 }) });
363
+ (e, o) => {
364
+ const t = Tt(R, e.__scopeTooltip), { forceMount: r = t.forceMount, side: n = "top", ...s } = e, i = j(R, e.__scopeTooltip);
365
+ return /* @__PURE__ */ d(Ge, { present: r || i.open, children: i.disableHoverableContent ? /* @__PURE__ */ d(Te, { side: n, ...s, ref: o }) : /* @__PURE__ */ d(bt, { side: n, ...s, ref: o }) });
365
366
  }
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(() => {
367
+ ), bt = a.forwardRef((e, o) => {
368
+ const t = j(R, e.__scopeTooltip), r = X(R, e.__scopeTooltip), n = a.useRef(null), s = k(o, n), [i, h] = a.useState(null), { trigger: l, onClose: p } = t, c = n.current, { onPointerInTransitChange: f } = r, g = a.useCallback(() => {
368
369
  h(null), f(!1);
369
370
  }, [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]);
371
+ (v, m) => {
372
+ const y = v.currentTarget, w = { x: v.clientX, y: v.clientY }, x = _t(w, y.getBoundingClientRect()), T = Ot(w, x), C = Nt(m.getBoundingClientRect()), b = Dt([...T, ...C]);
372
373
  h(b), f(!0);
373
374
  },
374
375
  [f]
375
376
  );
376
- return a.useEffect(() => () => m(), [m]), a.useEffect(() => {
377
+ return a.useEffect(() => () => g(), [g]), a.useEffect(() => {
377
378
  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);
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);
381
382
  };
382
383
  }
383
- }, [l, c, u, m]), a.useEffect(() => {
384
+ }, [l, c, u, g]), a.useEffect(() => {
384
385
  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());
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 = !St(w, i);
388
+ x ? g() : T && (g(), p());
388
389
  };
389
390
  return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
390
391
  }
391
- }, [l, c, i, p, m]), /* @__PURE__ */ d(Te, { ...e, ref: s });
392
- }), [bt, At] = L($, { isInside: !1 }), Te = a.forwardRef(
393
- (e, r) => {
392
+ }, [l, c, i, p, g]), /* @__PURE__ */ d(Te, { ...e, ref: s });
393
+ }), [At, Et] = M(O, { isInside: !1 }), Rt = Xe("TooltipContent"), Te = a.forwardRef(
394
+ (e, o) => {
394
395
  const {
395
396
  __scopeTooltip: t,
396
- children: o,
397
+ children: r,
397
398
  "aria-label": n,
398
399
  onEscapeKeyDown: s,
399
400
  onPointerDownOutside: i,
400
401
  ...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(() => {
402
+ } = e, l = j(R, t), p = $(t), { onClose: c } = l;
403
+ return a.useEffect(() => (document.addEventListener(F, c), () => document.removeEventListener(F, c)), [c]), a.useEffect(() => {
403
404
  if (l.trigger) {
404
- const f = (m) => {
405
- const u = m.target;
405
+ const f = (g) => {
406
+ const u = g.target;
406
407
  u != null && u.contains(l.trigger) && c();
407
408
  };
408
409
  return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
409
410
  }
410
411
  }, [l.trigger, c]), /* @__PURE__ */ d(
411
- ot,
412
+ ze,
412
413
  {
413
414
  asChild: !0,
414
415
  disableOutsidePointerEvents: !1,
@@ -416,13 +417,13 @@ var Ct = "TooltipPortal", [Wt, Pt] = L(Ct, {
416
417
  onPointerDownOutside: i,
417
418
  onFocusOutside: (f) => f.preventDefault(),
418
419
  onDismiss: c,
419
- children: /* @__PURE__ */ j(
420
+ children: /* @__PURE__ */ Y(
420
421
  ht,
421
422
  {
422
423
  "data-state": l.stateAttribute,
423
424
  ...p,
424
425
  ...h,
425
- ref: r,
426
+ ref: o,
426
427
  style: {
427
428
  ...h.style,
428
429
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
@@ -432,8 +433,8 @@ var Ct = "TooltipPortal", [Wt, Pt] = L(Ct, {
432
433
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
433
434
  },
434
435
  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 }) })
436
+ /* @__PURE__ */ d(Rt, { children: r }),
437
+ /* @__PURE__ */ d(At, { scope: t, isInside: !0, children: /* @__PURE__ */ d(yt, { id: l.contentId, role: "tooltip", children: n || r }) })
437
438
  ]
438
439
  }
439
440
  )
@@ -443,101 +444,101 @@ var Ct = "TooltipPortal", [Wt, Pt] = L(Ct, {
443
444
  );
444
445
  Pe.displayName = R;
445
446
  var be = "TooltipArrow", Ae = a.forwardRef(
446
- (e, r) => {
447
- const { __scopeTooltip: t, ...o } = e, n = M(t);
448
- return At(
447
+ (e, o) => {
448
+ const { __scopeTooltip: t, ...r } = e, n = $(t);
449
+ return Et(
449
450
  be,
450
451
  t
451
- ).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...o, ref: r });
452
+ ).isInside ? null : /* @__PURE__ */ d(vt, { ...n, ...r, ref: o });
452
453
  }
453
454
  );
454
455
  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)) {
456
+ function _t(e, o) {
457
+ const t = Math.abs(o.top - e.y), r = Math.abs(o.bottom - e.y), n = Math.abs(o.right - e.x), s = Math.abs(o.left - e.x);
458
+ switch (Math.min(t, r, n, s)) {
458
459
  case s:
459
460
  return "left";
460
461
  case n:
461
462
  return "right";
462
463
  case t:
463
464
  return "top";
464
- case o:
465
+ case r:
465
466
  return "bottom";
466
467
  default:
467
468
  throw new Error("unreachable");
468
469
  }
469
470
  }
470
- function Rt(e, r, t = 5) {
471
- const o = [];
472
- switch (r) {
471
+ function Ot(e, o, t = 5) {
472
+ const r = [];
473
+ switch (o) {
473
474
  case "top":
474
- o.push(
475
+ r.push(
475
476
  { x: e.x - t, y: e.y + t },
476
477
  { x: e.x + t, y: e.y + t }
477
478
  );
478
479
  break;
479
480
  case "bottom":
480
- o.push(
481
+ r.push(
481
482
  { x: e.x - t, y: e.y - t },
482
483
  { x: e.x + t, y: e.y - t }
483
484
  );
484
485
  break;
485
486
  case "left":
486
- o.push(
487
+ r.push(
487
488
  { x: e.x + t, y: e.y - t },
488
489
  { x: e.x + t, y: e.y + t }
489
490
  );
490
491
  break;
491
492
  case "right":
492
- o.push(
493
+ r.push(
493
494
  { x: e.x - t, y: e.y - t },
494
495
  { x: e.x - t, y: e.y + t }
495
496
  );
496
497
  break;
497
498
  }
498
- return o;
499
+ return r;
499
500
  }
500
- function _t(e) {
501
- const { top: r, right: t, bottom: o, left: n } = e;
501
+ function Nt(e) {
502
+ const { top: o, right: t, bottom: r, left: n } = e;
502
503
  return [
503
- { x: n, y: r },
504
- { x: t, y: r },
504
+ { x: n, y: o },
505
505
  { x: t, y: o },
506
- { x: n, y: o }
506
+ { x: t, y: r },
507
+ { x: n, y: r }
507
508
  ];
508
509
  }
509
- function Ot(e, r) {
510
- const { x: t, y: o } = e;
510
+ function St(e, o) {
511
+ const { x: t, y: r } = e;
511
512
  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);
513
+ for (let s = 0, i = o.length - 1; s < o.length; i = s++) {
514
+ const h = o[s], l = o[i], p = h.x, c = h.y, f = l.x, g = l.y;
515
+ c > r != g > r && t < (f - p) * (r - c) / (g - c) + p && (n = !n);
515
516
  }
516
517
  return n;
517
518
  }
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);
519
+ function Dt(e) {
520
+ const o = e.slice();
521
+ return o.sort((t, r) => t.x < r.x ? -1 : t.x > r.x ? 1 : t.y < r.y ? -1 : t.y > r.y ? 1 : 0), Ht(o);
521
522
  }
522
- function St(e) {
523
+ function Ht(e) {
523
524
  if (e.length <= 1)
524
525
  return e.slice();
525
- const r = [];
526
- 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];
526
+ const o = [];
527
+ for (let r = 0; r < e.length; r++) {
528
+ const n = e[r];
529
+ for (; o.length >= 2; ) {
530
+ const s = o[o.length - 1], i = o[o.length - 2];
530
531
  if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
531
- r.pop();
532
+ o.pop();
532
533
  else
533
534
  break;
534
535
  }
535
- r.push(n);
536
+ o.push(n);
536
537
  }
537
- r.pop();
538
+ o.pop();
538
539
  const t = [];
539
- for (let o = e.length - 1; o >= 0; o--) {
540
- const n = e[o];
540
+ for (let r = e.length - 1; r >= 0; r--) {
541
+ const n = e[r];
541
542
  for (; t.length >= 2; ) {
542
543
  const s = t[t.length - 1], i = t[t.length - 2];
543
544
  if ((s.x - i.x) * (n.y - i.y) >= (s.y - i.y) * (n.x - i.x))
@@ -547,22 +548,22 @@ function St(e) {
547
548
  }
548
549
  t.push(n);
549
550
  }
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);
551
+ return t.pop(), o.length === 1 && t.length === 1 && o[0].x === t[0].x && o[0].y === t[0].y ? o : o.concat(t);
551
552
  }
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: [
553
+ const It = "_tooltipContent_thtj1_1", Lt = "_tooltipArrow_thtj1_8", kt = "_fadeIn_thtj1_1", ne = {
554
+ tooltipContent: It,
555
+ tooltipArrow: Lt,
556
+ fadeIn: kt
557
+ }, Mt = Fe(
558
+ ({ children: e, content: o, className: t, style: r }, n) => /* @__PURE__ */ d(we, { children: /* @__PURE__ */ Y(xe, { delayDuration: 1e3, children: [
559
+ /* @__PURE__ */ d(Ce, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: r, children: e }) }),
560
+ /* @__PURE__ */ Y(Pe, { className: ne.tooltipContent, sideOffset: 5, children: [
560
561
  /* @__PURE__ */ d(Ae, { className: ne.tooltipArrow }),
561
- /* @__PURE__ */ d("span", { children: r })
562
+ /* @__PURE__ */ d("span", { children: o })
562
563
  ] })
563
564
  ] }) })
564
565
  );
565
- kt.displayName = "RPTooltip";
566
+ Mt.displayName = "RPTooltip";
566
567
  export {
567
- kt as default
568
+ Mt as default
568
569
  };