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