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