@pdf-viewer/react 1.11.0 → 1.12.0-beta.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 (85) hide show
  1. package/dist/{ToolbarLayout.module-e774f3e1.js → ToolbarLayout.module-e03c451b.js} +1066 -1060
  2. package/dist/components/RPController.js +1 -1
  3. package/dist/components/RPPages.js +3 -2
  4. package/dist/components/RPProvider.js +31 -17
  5. package/dist/components/layout/LayoutContainer.js +3 -2
  6. package/dist/components/layout/RPDefaultLayout.js +1 -1
  7. package/dist/components/layout/RPLayout.js +4 -3
  8. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  9. package/dist/components/layout/sidebar/Thumbnail.js +3 -2
  10. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  11. package/dist/components/layout/toolbar/DocumentDialog.js +3 -2
  12. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  13. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  14. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  15. package/dist/components/layout/toolbar/MostPageTool.js +4 -3
  16. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  17. package/dist/components/layout/toolbar/Paginate.js +1 -1
  18. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  19. package/dist/components/layout/toolbar/RPMoreOptions.js +2 -2
  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/SearchResultNavigator.js +1 -1
  25. package/dist/components/layout/toolbar/SearchTool.js +3 -2
  26. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  28. package/dist/components/layout/toolbar/ToolbarCustom.js +4 -3
  29. package/dist/components/layout/toolbar/ToolbarDefault.js +4 -3
  30. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  31. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  32. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +1 -1
  33. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  34. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  35. package/dist/components/layout/toolbar/tools/NextPageTool.js +4 -3
  36. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  38. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +4 -3
  41. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +1 -1
  42. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +4 -3
  43. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -4
  44. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +1 -1
  45. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +1 -1
  46. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +1 -1
  47. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +1 -1
  48. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +1 -1
  49. package/dist/components/page/AnnotationLayer.js +3 -2
  50. package/dist/components/page/CanvasLayer.js +3 -2
  51. package/dist/components/page/DualPage.js +1 -1
  52. package/dist/components/page/RPPage.js +3 -2
  53. package/dist/components/page/SinglePage.js +1 -1
  54. package/dist/components/page/TextHighlightLayer.js +3 -2
  55. package/dist/components/page/TextLayer.js +3 -2
  56. package/dist/components/ui/DropDown.js +1 -1
  57. package/dist/components/ui/LoadingIndicator.js +1 -1
  58. package/dist/components/ui/RPTooltip.js +430 -200
  59. package/dist/contexts/EventCallbackContext.js +30 -0
  60. package/dist/contexts/GlobalCurrentPage.js +13 -10
  61. package/dist/contexts/PagesRotateContext.js +23 -17
  62. package/dist/contexts/PaginationContext.js +1 -1
  63. package/dist/contexts/PrintContext.js +1 -1
  64. package/dist/contexts/RPDocumentContext.js +21 -19
  65. package/dist/contexts/RenderQueueProvider.js +1 -1
  66. package/dist/contexts/SearchContext.js +1 -1
  67. package/dist/contexts/ThumbnailsContext.js +1 -1
  68. package/dist/floating-ui.react-dom-d22a10b4.js +1474 -0
  69. package/dist/index-3bf64864.js +1886 -0
  70. package/dist/main.js +1 -1
  71. package/dist/types/contexts/EventCallbackContext.d.ts +5 -0
  72. package/dist/types/utils/types.d.ts +7 -1
  73. package/dist/utils/hooks/useFileDownload.js +3 -2
  74. package/dist/utils/hooks/useLicense.js +1 -1
  75. package/dist/utils/hooks/useLoadPdf.js +43 -41
  76. package/dist/utils/hooks/usePaginate.js +3 -2
  77. package/dist/utils/hooks/usePresentPage.js +3 -2
  78. package/dist/utils/hooks/usePrint.js +3 -2
  79. package/dist/utils/hooks/useScrollToPage.js +3 -2
  80. package/dist/utils/hooks/useSearch.js +3 -2
  81. package/dist/utils/hooks/useThumbnail.js +3 -2
  82. package/dist/utils/hooks/useVirtualReactWindow.js +3 -2
  83. package/package.json +1 -1
  84. package/dist/index-808ea7bf.js +0 -1685
  85. package/dist/index-a48ec088.js +0 -1672
@@ -1,9 +1,239 @@
1
- import { jsx as p, jsxs as L } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import { P as M, c as K, e as J, u as j, a as g, b as Q, f as Z } from "../../index-c9a2990a.js";
4
- import { c as G, u as $, R as ee, A as te, D as oe, C as re, a as ne } from "../../index-808ea7bf.js";
5
- import { withRef as se } from "../../utils/withRef.js";
6
- import '../../assets/RPTooltip.css';var ae = Object.freeze({
1
+ import { jsx as d, jsxs as Y } from "react/jsx-runtime";
2
+ import * as a from "react";
3
+ import { useRef as Fe, useEffect as Be, useMemo as We, useLayoutEffect as Ge } from "react";
4
+ import { P as S, c as ae, u as k, d as Xe, e as Ve, a as E, b as Ue, f as ze } from "../../index-c9a2990a.js";
5
+ import { u as qe, a as Ze, o as Ke, s as Je, f as Qe, b as et, c as tt, h as rt, l as ot, d as nt, D as at } from "../../floating-ui.react-dom-d22a10b4.js";
6
+ import { withRef as st } from "../../utils/withRef.js";
7
+ import '../../assets/RPTooltip.css';var it = "Arrow", se = a.forwardRef((e, r) => {
8
+ const { children: t, width: o = 10, height: n = 5, ...i } = e;
9
+ return /* @__PURE__ */ d(
10
+ S.svg,
11
+ {
12
+ ...i,
13
+ ref: r,
14
+ width: o,
15
+ height: n,
16
+ viewBox: "0 0 30 10",
17
+ preserveAspectRatio: "none",
18
+ children: e.asChild ? t : /* @__PURE__ */ d("polygon", { points: "0,0 30,0 15,10" })
19
+ }
20
+ );
21
+ });
22
+ se.displayName = it;
23
+ var lt = se;
24
+ function ct(e) {
25
+ const r = Fe(e);
26
+ return Be(() => {
27
+ r.current = e;
28
+ }), We(
29
+ () => (...t) => {
30
+ var o;
31
+ return (o = r.current) === null || o === void 0 ? void 0 : o.call(r, ...t);
32
+ },
33
+ []
34
+ );
35
+ }
36
+ const oe = globalThis != null && globalThis.document ? Ge : () => {
37
+ };
38
+ var W = "Popper", [ie, le] = ae(W), [dt, ce] = ie(W), de = (e) => {
39
+ const { __scopePopper: r, children: t } = e, [o, n] = a.useState(null);
40
+ return /* @__PURE__ */ d(dt, { scope: r, anchor: o, onAnchorChange: n, children: t });
41
+ };
42
+ de.displayName = W;
43
+ var pe = "PopperAnchor", ue = a.forwardRef(
44
+ (e, r) => {
45
+ const { __scopePopper: t, virtualRef: o, ...n } = e, i = ce(pe, t), l = a.useRef(null), h = k(r, l), s = a.useRef(null);
46
+ return a.useEffect(() => {
47
+ const p = s.current;
48
+ s.current = (o == null ? void 0 : o.current) || l.current, p !== s.current && i.onAnchorChange(s.current);
49
+ }), o ? null : /* @__PURE__ */ d(S.div, { ...n, ref: h });
50
+ }
51
+ );
52
+ ue.displayName = pe;
53
+ var G = "PopperContent", [pt, ut] = ie(G), fe = a.forwardRef(
54
+ (e, r) => {
55
+ var Z, K, J, Q, ee, te;
56
+ const {
57
+ __scopePopper: t,
58
+ side: o = "bottom",
59
+ sideOffset: n = 0,
60
+ align: i = "center",
61
+ alignOffset: l = 0,
62
+ arrowPadding: h = 0,
63
+ avoidCollisions: s = !0,
64
+ collisionBoundary: p = [],
65
+ collisionPadding: c = 0,
66
+ sticky: f = "partial",
67
+ hideWhenDetached: g = !1,
68
+ updatePositionStrategy: u = "optimized",
69
+ onPlaced: v,
70
+ ...m
71
+ } = e, y = ce(G, t), [w, x] = a.useState(null), b = k(r, (_) => x(_)), [C, T] = a.useState(null), P = Xe(C), N = (P == null ? void 0 : P.width) ?? 0, V = (P == null ? void 0 : P.height) ?? 0, Ee = o + (i !== "center" ? "-" + i : ""), 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 = {
72
+ padding: Re,
73
+ boundary: U.filter(ht),
74
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
75
+ altBoundary: _e
76
+ }, { refs: Oe, floatingStyles: z, placement: Se, isPositioned: H, middlewareData: A } = qe({
77
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
78
+ strategy: "fixed",
79
+ placement: Ee,
80
+ whileElementsMounted: (..._) => Ze(..._, {
81
+ animationFrame: u === "always"
82
+ }),
83
+ elements: {
84
+ reference: y.anchor
85
+ },
86
+ middleware: [
87
+ Ke({ mainAxis: n + V, alignmentAxis: l }),
88
+ s && Je({
89
+ mainAxis: !0,
90
+ crossAxis: !1,
91
+ limiter: f === "partial" ? ot() : void 0,
92
+ ...D
93
+ }),
94
+ s && Qe({ ...D }),
95
+ et({
96
+ ...D,
97
+ apply: ({ elements: _, rects: re, availableWidth: Me, availableHeight: $e }) => {
98
+ const { width: je, height: Ye } = re.reference, L = _.floating.style;
99
+ 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`);
100
+ }
101
+ }),
102
+ C && tt({ element: C, padding: h }),
103
+ vt({ arrowWidth: N, arrowHeight: V }),
104
+ g && rt({ strategy: "referenceHidden", ...D })
105
+ ]
106
+ }), [q, Ne] = ge(Se), I = ct(v);
107
+ oe(() => {
108
+ H && (I == null || I());
109
+ }, [H, I]);
110
+ 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();
111
+ return oe(() => {
112
+ w && ke(window.getComputedStyle(w).zIndex);
113
+ }, [w]), /* @__PURE__ */ d(
114
+ "div",
115
+ {
116
+ ref: Oe.setFloating,
117
+ "data-radix-popper-content-wrapper": "",
118
+ style: {
119
+ ...z,
120
+ transform: H ? z.transform : "translate(0, -200%)",
121
+ // keep off the page when measuring
122
+ minWidth: "max-content",
123
+ zIndex: Le,
124
+ "--radix-popper-transform-origin": [
125
+ (Q = A.transformOrigin) == null ? void 0 : Q.x,
126
+ (ee = A.transformOrigin) == null ? void 0 : ee.y
127
+ ].join(" "),
128
+ // hide the content if using the hide middleware and should be hidden
129
+ // set visibility to hidden and disable pointer events so the UI behaves
130
+ // as if the PopperContent isn't there at all
131
+ ...((te = A.hide) == null ? void 0 : te.referenceHidden) && {
132
+ visibility: "hidden",
133
+ pointerEvents: "none"
134
+ }
135
+ },
136
+ dir: e.dir,
137
+ children: /* @__PURE__ */ d(
138
+ pt,
139
+ {
140
+ scope: t,
141
+ placedSide: q,
142
+ onArrowChange: T,
143
+ arrowX: De,
144
+ arrowY: He,
145
+ shouldHideArrow: Ie,
146
+ children: /* @__PURE__ */ d(
147
+ S.div,
148
+ {
149
+ "data-side": q,
150
+ "data-align": Ne,
151
+ ...m,
152
+ ref: b,
153
+ style: {
154
+ ...m.style,
155
+ // if the PopperContent hasn't been placed yet (not all measurements done)
156
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
157
+ animation: H ? void 0 : "none"
158
+ }
159
+ }
160
+ )
161
+ }
162
+ )
163
+ }
164
+ );
165
+ }
166
+ );
167
+ fe.displayName = G;
168
+ var he = "PopperArrow", ft = {
169
+ top: "bottom",
170
+ right: "left",
171
+ bottom: "top",
172
+ left: "right"
173
+ }, ve = a.forwardRef(function(r, t) {
174
+ const { __scopePopper: o, ...n } = r, i = ut(he, o), l = ft[i.placedSide];
175
+ return (
176
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
177
+ // doesn't report size as we'd expect on SVG elements.
178
+ // it reports their bounding box which is effectively the largest path inside the SVG.
179
+ /* @__PURE__ */ d(
180
+ "span",
181
+ {
182
+ ref: i.onArrowChange,
183
+ style: {
184
+ position: "absolute",
185
+ left: i.arrowX,
186
+ top: i.arrowY,
187
+ [l]: 0,
188
+ transformOrigin: {
189
+ top: "",
190
+ right: "0 0",
191
+ bottom: "center 0",
192
+ left: "100% 0"
193
+ }[i.placedSide],
194
+ transform: {
195
+ top: "translateY(100%)",
196
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
197
+ bottom: "rotate(180deg)",
198
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
199
+ }[i.placedSide],
200
+ visibility: i.shouldHideArrow ? "hidden" : void 0
201
+ },
202
+ children: /* @__PURE__ */ d(
203
+ lt,
204
+ {
205
+ ...n,
206
+ ref: t,
207
+ style: {
208
+ ...n.style,
209
+ // ensures the element can be measured correctly (mostly for if SVG)
210
+ display: "block"
211
+ }
212
+ }
213
+ )
214
+ }
215
+ )
216
+ );
217
+ });
218
+ ve.displayName = he;
219
+ function ht(e) {
220
+ return e !== null;
221
+ }
222
+ var vt = (e) => ({
223
+ name: "transformOrigin",
224
+ options: e,
225
+ fn(r) {
226
+ var y, w, x;
227
+ const { placement: t, rects: o, middlewareData: n } = r, l = ((y = n.arrow) == null ? void 0 : y.centerOffset) !== 0, h = l ? 0 : e.arrowWidth, s = l ? 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) + s / 2;
228
+ let v = "", m = "";
229
+ return p === "bottom" ? (v = l ? f : `${g}px`, m = `${-s}px`) : p === "top" ? (v = l ? f : `${g}px`, m = `${o.floating.height + s}px`) : p === "right" ? (v = `${-s}px`, m = l ? f : `${u}px`) : p === "left" && (v = `${o.floating.width + s}px`, m = l ? f : `${u}px`), { data: { x: v, y: m } };
230
+ }
231
+ });
232
+ function ge(e) {
233
+ const [r, t = "center"] = e.split("-");
234
+ return [r, t];
235
+ }
236
+ var gt = de, mt = ue, yt = fe, wt = ve, xt = Object.freeze({
7
237
  // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
8
238
  position: "absolute",
9
239
  border: 0,
@@ -15,203 +245,203 @@ import '../../assets/RPTooltip.css';var ae = Object.freeze({
15
245
  clip: "rect(0, 0, 0, 0)",
16
246
  whiteSpace: "nowrap",
17
247
  wordWrap: "normal"
18
- }), ie = "VisuallyHidden", F = s.forwardRef(
19
- (e, o) => /* @__PURE__ */ p(
20
- M.span,
248
+ }), Ct = "VisuallyHidden", me = a.forwardRef(
249
+ (e, r) => /* @__PURE__ */ d(
250
+ S.span,
21
251
  {
22
252
  ...e,
23
- ref: o,
24
- style: { ...ae, ...e.style }
253
+ ref: r,
254
+ style: { ...xt, ...e.style }
25
255
  }
26
256
  )
27
257
  );
28
- F.displayName = ie;
29
- var le = F, [_, Oe] = K("Tooltip", [
30
- G
31
- ]), A = G(), V = "TooltipProvider", ce = 700, O = "tooltip.open", [ue, I] = _(V), Y = (e) => {
258
+ me.displayName = Ct;
259
+ var Pt = me, [M, Vt] = ae("Tooltip", [
260
+ le
261
+ ]), $ = le(), ye = "TooltipProvider", bt = 700, F = "tooltip.open", [Tt, X] = M(ye), we = (e) => {
32
262
  const {
33
- __scopeTooltip: o,
34
- delayDuration: t = ce,
35
- skipDelayDuration: r = 300,
263
+ __scopeTooltip: r,
264
+ delayDuration: t = bt,
265
+ skipDelayDuration: o = 300,
36
266
  disableHoverableContent: n = !1,
37
- children: l
38
- } = e, i = s.useRef(!0), v = s.useRef(!1), a = s.useRef(0);
39
- return s.useEffect(() => {
40
- const d = a.current;
41
- return () => window.clearTimeout(d);
42
- }, []), /* @__PURE__ */ p(
43
- ue,
267
+ children: i
268
+ } = e, l = a.useRef(!0), h = a.useRef(!1), s = a.useRef(0);
269
+ return a.useEffect(() => {
270
+ const p = s.current;
271
+ return () => window.clearTimeout(p);
272
+ }, []), /* @__PURE__ */ d(
273
+ Tt,
44
274
  {
45
- scope: o,
46
- isOpenDelayedRef: i,
275
+ scope: r,
276
+ isOpenDelayedRef: l,
47
277
  delayDuration: t,
48
- onOpen: s.useCallback(() => {
49
- window.clearTimeout(a.current), i.current = !1;
278
+ onOpen: a.useCallback(() => {
279
+ window.clearTimeout(s.current), l.current = !1;
50
280
  }, []),
51
- onClose: s.useCallback(() => {
52
- window.clearTimeout(a.current), a.current = window.setTimeout(
53
- () => i.current = !0,
54
- r
281
+ onClose: a.useCallback(() => {
282
+ window.clearTimeout(s.current), s.current = window.setTimeout(
283
+ () => l.current = !0,
284
+ o
55
285
  );
56
- }, [r]),
57
- isPointerInTransitRef: v,
58
- onPointerInTransitChange: s.useCallback((d) => {
59
- v.current = d;
286
+ }, [o]),
287
+ isPointerInTransitRef: h,
288
+ onPointerInTransitChange: a.useCallback((p) => {
289
+ h.current = p;
60
290
  }, []),
61
291
  disableHoverableContent: n,
62
- children: l
292
+ children: i
63
293
  }
64
294
  );
65
295
  };
66
- Y.displayName = V;
67
- var P = "Tooltip", [pe, D] = _(P), B = (e) => {
296
+ we.displayName = ye;
297
+ var O = "Tooltip", [At, j] = M(O), xe = (e) => {
68
298
  const {
69
- __scopeTooltip: o,
299
+ __scopeTooltip: r,
70
300
  children: t,
71
- open: r,
301
+ open: o,
72
302
  defaultOpen: n,
73
- onOpenChange: l,
74
- disableHoverableContent: i,
75
- delayDuration: v
76
- } = e, a = I(P, e.__scopeTooltip), d = A(o), [c, f] = s.useState(null), h = $(), u = s.useRef(0), y = i ?? a.disableHoverableContent, C = v ?? a.delayDuration, T = s.useRef(!1), [x, m] = J({
77
- prop: r,
303
+ onOpenChange: i,
304
+ disableHoverableContent: l,
305
+ delayDuration: h
306
+ } = e, s = X(O, e.__scopeTooltip), p = $(r), [c, f] = a.useState(null), g = nt(), u = a.useRef(0), v = l ?? s.disableHoverableContent, m = h ?? s.delayDuration, y = a.useRef(!1), [w, x] = Ve({
307
+ prop: o,
78
308
  defaultProp: n ?? !1,
79
- onChange: (S) => {
80
- S ? (a.onOpen(), document.dispatchEvent(new CustomEvent(O))) : a.onClose(), l == null || l(S);
309
+ onChange: (N) => {
310
+ N ? (s.onOpen(), document.dispatchEvent(new CustomEvent(F))) : s.onClose(), i == null || i(N);
81
311
  },
82
- caller: P
83
- }), b = s.useMemo(() => x ? T.current ? "delayed-open" : "instant-open" : "closed", [x]), E = s.useCallback(() => {
84
- window.clearTimeout(u.current), u.current = 0, T.current = !1, m(!0);
85
- }, [m]), R = s.useCallback(() => {
86
- window.clearTimeout(u.current), u.current = 0, m(!1);
87
- }, [m]), N = s.useCallback(() => {
312
+ caller: O
313
+ }), b = a.useMemo(() => w ? y.current ? "delayed-open" : "instant-open" : "closed", [w]), C = a.useCallback(() => {
314
+ window.clearTimeout(u.current), u.current = 0, y.current = !1, x(!0);
315
+ }, [x]), T = a.useCallback(() => {
316
+ window.clearTimeout(u.current), u.current = 0, x(!1);
317
+ }, [x]), P = a.useCallback(() => {
88
318
  window.clearTimeout(u.current), u.current = window.setTimeout(() => {
89
- T.current = !0, m(!0), u.current = 0;
90
- }, C);
91
- }, [C, m]);
92
- return s.useEffect(() => () => {
319
+ y.current = !0, x(!0), u.current = 0;
320
+ }, m);
321
+ }, [m, x]);
322
+ return a.useEffect(() => () => {
93
323
  u.current && (window.clearTimeout(u.current), u.current = 0);
94
- }, []), /* @__PURE__ */ p(ee, { ...d, children: /* @__PURE__ */ p(
95
- pe,
324
+ }, []), /* @__PURE__ */ d(gt, { ...p, children: /* @__PURE__ */ d(
325
+ At,
96
326
  {
97
- scope: o,
98
- contentId: h,
99
- open: x,
327
+ scope: r,
328
+ contentId: g,
329
+ open: w,
100
330
  stateAttribute: b,
101
331
  trigger: c,
102
332
  onTriggerChange: f,
103
- onTriggerEnter: s.useCallback(() => {
104
- a.isOpenDelayedRef.current ? N() : E();
105
- }, [a.isOpenDelayedRef, N, E]),
106
- onTriggerLeave: s.useCallback(() => {
107
- y ? R() : (window.clearTimeout(u.current), u.current = 0);
108
- }, [R, y]),
109
- onOpen: E,
110
- onClose: R,
111
- disableHoverableContent: y,
333
+ onTriggerEnter: a.useCallback(() => {
334
+ s.isOpenDelayedRef.current ? P() : C();
335
+ }, [s.isOpenDelayedRef, P, C]),
336
+ onTriggerLeave: a.useCallback(() => {
337
+ v ? T() : (window.clearTimeout(u.current), u.current = 0);
338
+ }, [T, v]),
339
+ onOpen: C,
340
+ onClose: T,
341
+ disableHoverableContent: v,
112
342
  children: t
113
343
  }
114
344
  ) });
115
345
  };
116
- B.displayName = P;
117
- var k = "TooltipTrigger", U = s.forwardRef(
118
- (e, o) => {
119
- const { __scopeTooltip: t, ...r } = e, n = D(k, t), l = I(k, t), i = A(t), v = s.useRef(null), a = j(o, v, n.onTriggerChange), d = s.useRef(!1), c = s.useRef(!1), f = s.useCallback(() => d.current = !1, []);
120
- return s.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ p(te, { asChild: !0, ...i, children: /* @__PURE__ */ p(
121
- M.button,
346
+ xe.displayName = O;
347
+ var B = "TooltipTrigger", Ce = a.forwardRef(
348
+ (e, r) => {
349
+ const { __scopeTooltip: t, ...o } = e, n = j(B, t), i = X(B, t), l = $(t), h = a.useRef(null), s = k(r, h, n.onTriggerChange), p = a.useRef(!1), c = a.useRef(!1), f = a.useCallback(() => p.current = !1, []);
350
+ return a.useEffect(() => () => document.removeEventListener("pointerup", f), [f]), /* @__PURE__ */ d(mt, { asChild: !0, ...l, children: /* @__PURE__ */ d(
351
+ S.button,
122
352
  {
123
353
  "aria-describedby": n.open ? n.contentId : void 0,
124
354
  "data-state": n.stateAttribute,
125
- ...r,
126
- ref: a,
127
- onPointerMove: g(e.onPointerMove, (h) => {
128
- h.pointerType !== "touch" && !c.current && !l.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
355
+ ...o,
356
+ ref: s,
357
+ onPointerMove: E(e.onPointerMove, (g) => {
358
+ g.pointerType !== "touch" && !c.current && !i.isPointerInTransitRef.current && (n.onTriggerEnter(), c.current = !0);
129
359
  }),
130
- onPointerLeave: g(e.onPointerLeave, () => {
360
+ onPointerLeave: E(e.onPointerLeave, () => {
131
361
  n.onTriggerLeave(), c.current = !1;
132
362
  }),
133
- onPointerDown: g(e.onPointerDown, () => {
134
- n.open && n.onClose(), d.current = !0, document.addEventListener("pointerup", f, { once: !0 });
363
+ onPointerDown: E(e.onPointerDown, () => {
364
+ n.open && n.onClose(), p.current = !0, document.addEventListener("pointerup", f, { once: !0 });
135
365
  }),
136
- onFocus: g(e.onFocus, () => {
137
- d.current || n.onOpen();
366
+ onFocus: E(e.onFocus, () => {
367
+ p.current || n.onOpen();
138
368
  }),
139
- onBlur: g(e.onBlur, n.onClose),
140
- onClick: g(e.onClick, n.onClose)
369
+ onBlur: E(e.onBlur, n.onClose),
370
+ onClick: E(e.onClick, n.onClose)
141
371
  }
142
372
  ) });
143
373
  }
144
374
  );
145
- U.displayName = k;
146
- var de = "TooltipPortal", [ke, fe] = _(de, {
375
+ Ce.displayName = B;
376
+ var Et = "TooltipPortal", [Ut, Rt] = M(Et, {
147
377
  forceMount: void 0
148
- }), w = "TooltipContent", q = s.forwardRef(
149
- (e, o) => {
150
- const t = fe(w, e.__scopeTooltip), { forceMount: r = t.forceMount, side: n = "top", ...l } = e, i = D(w, e.__scopeTooltip);
151
- return /* @__PURE__ */ p(Q, { present: r || i.open, children: i.disableHoverableContent ? /* @__PURE__ */ p(W, { side: n, ...l, ref: o }) : /* @__PURE__ */ p(ve, { side: n, ...l, ref: o }) });
378
+ }), R = "TooltipContent", Pe = a.forwardRef(
379
+ (e, r) => {
380
+ const t = Rt(R, e.__scopeTooltip), { forceMount: o = t.forceMount, side: n = "top", ...i } = e, l = j(R, e.__scopeTooltip);
381
+ return /* @__PURE__ */ d(Ue, { present: o || l.open, children: l.disableHoverableContent ? /* @__PURE__ */ d(be, { side: n, ...i, ref: r }) : /* @__PURE__ */ d(_t, { side: n, ...i, ref: r }) });
152
382
  }
153
- ), ve = s.forwardRef((e, o) => {
154
- const t = D(w, e.__scopeTooltip), r = I(w, e.__scopeTooltip), n = s.useRef(null), l = j(o, n), [i, v] = s.useState(null), { trigger: a, onClose: d } = t, c = n.current, { onPointerInTransitChange: f } = r, h = s.useCallback(() => {
155
- v(null), f(!1);
156
- }, [f]), u = s.useCallback(
157
- (y, C) => {
158
- const T = y.currentTarget, x = { x: y.clientX, y: y.clientY }, m = Ce(x, T.getBoundingClientRect()), b = me(x, m), E = xe(C.getBoundingClientRect()), R = we([...b, ...E]);
159
- v(R), f(!0);
383
+ ), _t = a.forwardRef((e, r) => {
384
+ const t = j(R, e.__scopeTooltip), o = X(R, e.__scopeTooltip), n = a.useRef(null), i = k(r, n), [l, h] = a.useState(null), { trigger: s, onClose: p } = t, c = n.current, { onPointerInTransitChange: f } = o, g = a.useCallback(() => {
385
+ h(null), f(!1);
386
+ }, [f]), u = a.useCallback(
387
+ (v, m) => {
388
+ const y = v.currentTarget, w = { x: v.clientX, y: v.clientY }, x = Dt(w, y.getBoundingClientRect()), b = Ht(w, x), C = It(m.getBoundingClientRect()), T = kt([...b, ...C]);
389
+ h(T), f(!0);
160
390
  },
161
391
  [f]
162
392
  );
163
- return s.useEffect(() => () => h(), [h]), s.useEffect(() => {
164
- if (a && c) {
165
- const y = (T) => u(T, c), C = (T) => u(T, a);
166
- return a.addEventListener("pointerleave", y), c.addEventListener("pointerleave", C), () => {
167
- a.removeEventListener("pointerleave", y), c.removeEventListener("pointerleave", C);
393
+ return a.useEffect(() => () => g(), [g]), a.useEffect(() => {
394
+ if (s && c) {
395
+ const v = (y) => u(y, c), m = (y) => u(y, s);
396
+ return s.addEventListener("pointerleave", v), c.addEventListener("pointerleave", m), () => {
397
+ s.removeEventListener("pointerleave", v), c.removeEventListener("pointerleave", m);
168
398
  };
169
399
  }
170
- }, [a, c, u, h]), s.useEffect(() => {
171
- if (i) {
172
- const y = (C) => {
173
- const T = C.target, x = { x: C.clientX, y: C.clientY }, m = (a == null ? void 0 : a.contains(T)) || (c == null ? void 0 : c.contains(T)), b = !ge(x, i);
174
- m ? h() : b && (h(), d());
400
+ }, [s, c, u, g]), a.useEffect(() => {
401
+ if (l) {
402
+ const v = (m) => {
403
+ const y = m.target, w = { x: m.clientX, y: m.clientY }, x = (s == null ? void 0 : s.contains(y)) || (c == null ? void 0 : c.contains(y)), b = !Lt(w, l);
404
+ x ? g() : b && (g(), p());
175
405
  };
176
- return document.addEventListener("pointermove", y), () => document.removeEventListener("pointermove", y);
406
+ return document.addEventListener("pointermove", v), () => document.removeEventListener("pointermove", v);
177
407
  }
178
- }, [a, c, i, d, h]), /* @__PURE__ */ p(W, { ...e, ref: l });
179
- }), [he, ye] = _(P, { isInside: !1 }), Te = Z("TooltipContent"), W = s.forwardRef(
180
- (e, o) => {
408
+ }, [s, c, l, p, g]), /* @__PURE__ */ d(be, { ...e, ref: i });
409
+ }), [Ot, St] = M(O, { isInside: !1 }), Nt = ze("TooltipContent"), be = a.forwardRef(
410
+ (e, r) => {
181
411
  const {
182
412
  __scopeTooltip: t,
183
- children: r,
413
+ children: o,
184
414
  "aria-label": n,
185
- onEscapeKeyDown: l,
186
- onPointerDownOutside: i,
187
- ...v
188
- } = e, a = D(w, t), d = A(t), { onClose: c } = a;
189
- return s.useEffect(() => (document.addEventListener(O, c), () => document.removeEventListener(O, c)), [c]), s.useEffect(() => {
190
- if (a.trigger) {
191
- const f = (h) => {
192
- const u = h.target;
193
- u != null && u.contains(a.trigger) && c();
415
+ onEscapeKeyDown: i,
416
+ onPointerDownOutside: l,
417
+ ...h
418
+ } = e, s = j(R, t), p = $(t), { onClose: c } = s;
419
+ return a.useEffect(() => (document.addEventListener(F, c), () => document.removeEventListener(F, c)), [c]), a.useEffect(() => {
420
+ if (s.trigger) {
421
+ const f = (g) => {
422
+ const u = g.target;
423
+ u != null && u.contains(s.trigger) && c();
194
424
  };
195
425
  return window.addEventListener("scroll", f, { capture: !0 }), () => window.removeEventListener("scroll", f, { capture: !0 });
196
426
  }
197
- }, [a.trigger, c]), /* @__PURE__ */ p(
198
- oe,
427
+ }, [s.trigger, c]), /* @__PURE__ */ d(
428
+ at,
199
429
  {
200
430
  asChild: !0,
201
431
  disableOutsidePointerEvents: !1,
202
- onEscapeKeyDown: l,
203
- onPointerDownOutside: i,
432
+ onEscapeKeyDown: i,
433
+ onPointerDownOutside: l,
204
434
  onFocusOutside: (f) => f.preventDefault(),
205
435
  onDismiss: c,
206
- children: /* @__PURE__ */ L(
207
- re,
436
+ children: /* @__PURE__ */ Y(
437
+ yt,
208
438
  {
209
- "data-state": a.stateAttribute,
210
- ...d,
211
- ...v,
212
- ref: o,
439
+ "data-state": s.stateAttribute,
440
+ ...p,
441
+ ...h,
442
+ ref: r,
213
443
  style: {
214
- ...v.style,
444
+ ...h.style,
215
445
  "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
216
446
  "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
217
447
  "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
@@ -219,8 +449,8 @@ var de = "TooltipPortal", [ke, fe] = _(de, {
219
449
  "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
220
450
  },
221
451
  children: [
222
- /* @__PURE__ */ p(Te, { children: r }),
223
- /* @__PURE__ */ p(he, { scope: t, isInside: !0, children: /* @__PURE__ */ p(le, { id: a.contentId, role: "tooltip", children: n || r }) })
452
+ /* @__PURE__ */ d(Nt, { children: o }),
453
+ /* @__PURE__ */ d(Ot, { scope: t, isInside: !0, children: /* @__PURE__ */ d(Pt, { id: s.contentId, role: "tooltip", children: n || o }) })
224
454
  ]
225
455
  }
226
456
  )
@@ -228,127 +458,127 @@ var de = "TooltipPortal", [ke, fe] = _(de, {
228
458
  );
229
459
  }
230
460
  );
231
- q.displayName = w;
232
- var X = "TooltipArrow", z = s.forwardRef(
233
- (e, o) => {
234
- const { __scopeTooltip: t, ...r } = e, n = A(t);
235
- return ye(
236
- X,
461
+ Pe.displayName = R;
462
+ var Te = "TooltipArrow", Ae = a.forwardRef(
463
+ (e, r) => {
464
+ const { __scopeTooltip: t, ...o } = e, n = $(t);
465
+ return St(
466
+ Te,
237
467
  t
238
- ).isInside ? null : /* @__PURE__ */ p(ne, { ...n, ...r, ref: o });
468
+ ).isInside ? null : /* @__PURE__ */ d(wt, { ...n, ...o, ref: r });
239
469
  }
240
470
  );
241
- z.displayName = X;
242
- function Ce(e, o) {
243
- const t = Math.abs(o.top - e.y), r = Math.abs(o.bottom - e.y), n = Math.abs(o.right - e.x), l = Math.abs(o.left - e.x);
244
- switch (Math.min(t, r, n, l)) {
245
- case l:
471
+ Ae.displayName = Te;
472
+ function Dt(e, r) {
473
+ const t = Math.abs(r.top - e.y), o = Math.abs(r.bottom - e.y), n = Math.abs(r.right - e.x), i = Math.abs(r.left - e.x);
474
+ switch (Math.min(t, o, n, i)) {
475
+ case i:
246
476
  return "left";
247
477
  case n:
248
478
  return "right";
249
479
  case t:
250
480
  return "top";
251
- case r:
481
+ case o:
252
482
  return "bottom";
253
483
  default:
254
484
  throw new Error("unreachable");
255
485
  }
256
486
  }
257
- function me(e, o, t = 5) {
258
- const r = [];
259
- switch (o) {
487
+ function Ht(e, r, t = 5) {
488
+ const o = [];
489
+ switch (r) {
260
490
  case "top":
261
- r.push(
491
+ o.push(
262
492
  { x: e.x - t, y: e.y + t },
263
493
  { x: e.x + t, y: e.y + t }
264
494
  );
265
495
  break;
266
496
  case "bottom":
267
- r.push(
497
+ o.push(
268
498
  { x: e.x - t, y: e.y - t },
269
499
  { x: e.x + t, y: e.y - t }
270
500
  );
271
501
  break;
272
502
  case "left":
273
- r.push(
503
+ o.push(
274
504
  { x: e.x + t, y: e.y - t },
275
505
  { x: e.x + t, y: e.y + t }
276
506
  );
277
507
  break;
278
508
  case "right":
279
- r.push(
509
+ o.push(
280
510
  { x: e.x - t, y: e.y - t },
281
511
  { x: e.x - t, y: e.y + t }
282
512
  );
283
513
  break;
284
514
  }
285
- return r;
515
+ return o;
286
516
  }
287
- function xe(e) {
288
- const { top: o, right: t, bottom: r, left: n } = e;
517
+ function It(e) {
518
+ const { top: r, right: t, bottom: o, left: n } = e;
289
519
  return [
290
- { x: n, y: o },
291
- { x: t, y: o },
520
+ { x: n, y: r },
292
521
  { x: t, y: r },
293
- { x: n, y: r }
522
+ { x: t, y: o },
523
+ { x: n, y: o }
294
524
  ];
295
525
  }
296
- function ge(e, o) {
297
- const { x: t, y: r } = e;
526
+ function Lt(e, r) {
527
+ const { x: t, y: o } = e;
298
528
  let n = !1;
299
- for (let l = 0, i = o.length - 1; l < o.length; i = l++) {
300
- const v = o[l], a = o[i], d = v.x, c = v.y, f = a.x, h = a.y;
301
- c > r != h > r && t < (f - d) * (r - c) / (h - c) + d && (n = !n);
529
+ for (let i = 0, l = r.length - 1; i < r.length; l = i++) {
530
+ const h = r[i], s = r[l], p = h.x, c = h.y, f = s.x, g = s.y;
531
+ c > o != g > o && t < (f - p) * (o - c) / (g - c) + p && (n = !n);
302
532
  }
303
533
  return n;
304
534
  }
305
- function we(e) {
306
- const o = e.slice();
307
- 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), be(o);
535
+ function kt(e) {
536
+ const r = e.slice();
537
+ 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), Mt(r);
308
538
  }
309
- function be(e) {
539
+ function Mt(e) {
310
540
  if (e.length <= 1)
311
541
  return e.slice();
312
- const o = [];
313
- for (let r = 0; r < e.length; r++) {
314
- const n = e[r];
315
- for (; o.length >= 2; ) {
316
- const l = o[o.length - 1], i = o[o.length - 2];
317
- if ((l.x - i.x) * (n.y - i.y) >= (l.y - i.y) * (n.x - i.x))
318
- o.pop();
542
+ const r = [];
543
+ for (let o = 0; o < e.length; o++) {
544
+ const n = e[o];
545
+ for (; r.length >= 2; ) {
546
+ const i = r[r.length - 1], l = r[r.length - 2];
547
+ if ((i.x - l.x) * (n.y - l.y) >= (i.y - l.y) * (n.x - l.x))
548
+ r.pop();
319
549
  else
320
550
  break;
321
551
  }
322
- o.push(n);
552
+ r.push(n);
323
553
  }
324
- o.pop();
554
+ r.pop();
325
555
  const t = [];
326
- for (let r = e.length - 1; r >= 0; r--) {
327
- const n = e[r];
556
+ for (let o = e.length - 1; o >= 0; o--) {
557
+ const n = e[o];
328
558
  for (; t.length >= 2; ) {
329
- const l = t[t.length - 1], i = t[t.length - 2];
330
- if ((l.x - i.x) * (n.y - i.y) >= (l.y - i.y) * (n.x - i.x))
559
+ const i = t[t.length - 1], l = t[t.length - 2];
560
+ if ((i.x - l.x) * (n.y - l.y) >= (i.y - l.y) * (n.x - l.x))
331
561
  t.pop();
332
562
  else
333
563
  break;
334
564
  }
335
565
  t.push(n);
336
566
  }
337
- 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);
567
+ 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);
338
568
  }
339
- const Ee = "_tooltipContent_12gjy_1", Re = "_tooltipArrow_12gjy_8", Pe = "_fadeIn_12gjy_1", H = {
340
- tooltipContent: Ee,
341
- tooltipArrow: Re,
342
- fadeIn: Pe
343
- }, Ie = se(
344
- ({ children: e, content: o, className: t, style: r }, n) => /* @__PURE__ */ p(Y, { children: /* @__PURE__ */ L(B, { delayDuration: 1e3, children: [
345
- /* @__PURE__ */ p(U, { asChild: !0, children: /* @__PURE__ */ p("div", { ref: n, className: t, style: r, children: e }) }),
346
- /* @__PURE__ */ L(q, { className: H.tooltipContent, sideOffset: 5, children: [
347
- /* @__PURE__ */ p(z, { className: H.tooltipArrow }),
348
- /* @__PURE__ */ p("span", { children: o })
569
+ const $t = "_tooltipContent_12gjy_1", jt = "_tooltipArrow_12gjy_8", Yt = "_fadeIn_12gjy_1", ne = {
570
+ tooltipContent: $t,
571
+ tooltipArrow: jt,
572
+ fadeIn: Yt
573
+ }, zt = st(
574
+ ({ children: e, content: r, className: t, style: o }, n) => /* @__PURE__ */ d(we, { children: /* @__PURE__ */ Y(xe, { delayDuration: 1e3, children: [
575
+ /* @__PURE__ */ d(Ce, { asChild: !0, children: /* @__PURE__ */ d("div", { ref: n, className: t, style: o, children: e }) }),
576
+ /* @__PURE__ */ Y(Pe, { className: ne.tooltipContent, sideOffset: 5, children: [
577
+ /* @__PURE__ */ d(Ae, { className: ne.tooltipArrow }),
578
+ /* @__PURE__ */ d("span", { children: r })
349
579
  ] })
350
580
  ] }) })
351
581
  );
352
582
  export {
353
- Ie as default
583
+ zt as default
354
584
  };