@fuma-content/studio 1.0.2 → 1.0.4

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 (109) hide show
  1. package/build/client/assets/{QueryClientProvider-DqiXnN2L.js → QueryClientProvider-BFSUF51X.js} +1 -1
  2. package/build/client/assets/actions-ByenKsIt.js +1 -0
  3. package/build/client/assets/actions-ClHPL1CP.js +1 -0
  4. package/build/client/assets/badge-BnhEE6iu.js +1 -0
  5. package/build/client/assets/{client-OSVRoCKH.js → client-BEKU4RIg.js} +148 -146
  6. package/build/client/assets/client-DBU2dkUR.js +1 -0
  7. package/build/client/assets/client-DvwvjHta.js +1 -0
  8. package/build/client/assets/client-wd2sce2I.js +8 -0
  9. package/build/client/assets/dropdown-menu-By_XeFX4.js +1 -0
  10. package/build/client/assets/entry.rsc-J_U0YQEr.js +1 -0
  11. package/build/client/assets/{index-BdrDVoE8.js → index-B5GacMxj.js} +1 -1
  12. package/build/client/assets/index-BTaHNKf7.js +1 -0
  13. package/build/client/assets/index-BgFxGtat.js +1 -0
  14. package/build/client/assets/index-CG_0cSZQ.js +1 -0
  15. package/build/client/assets/index-CfCSvolS.js +1 -0
  16. package/build/client/assets/{index-Bx93mXy1.js → index-D8KuzOxG.js} +1 -1
  17. package/build/client/assets/index-DrT4Adhh.js +41 -0
  18. package/build/client/assets/{index-BpILsqFO.js → index-El_a1Yhs.js} +1 -1
  19. package/build/client/assets/index-QYLIz8qa.js +1 -0
  20. package/build/client/assets/layout-BPVd8vtW.js +1 -0
  21. package/build/client/assets/{mdx-BNErtsK6.js → mdx-DBJIR6uw.js} +1 -1
  22. package/build/client/assets/page-BJL5nvn-.js +1 -0
  23. package/build/client/assets/page-eyuUZvVn.js +1 -0
  24. package/build/client/assets/popover-BowiFsDm.js +1 -0
  25. package/build/client/assets/{react-B8--K7an.js → react-CzFdRS7Y.js} +7 -7
  26. package/build/client/assets/root-7fvd-0uP.js +1 -0
  27. package/build/client/assets/root-B0B6-NU5.css +1 -0
  28. package/build/client/assets/{root-B_CXTQpA.js → root-jg-0qm8s.js} +1 -1
  29. package/build/client/assets/route-BLLsZ_zO.js +1 -0
  30. package/build/client/assets/{router-a9jyj9wf.js → router-QEl8O8lm.js} +1 -1
  31. package/build/client/assets/select-BI356bZ1.js +1 -0
  32. package/build/client/assets/separator-0kwG7IIM.js +1 -0
  33. package/build/client/assets/sidebar-ByyQE2QS.js +12 -0
  34. package/build/client/assets/{site-header-DQkKe-WA.js → site-header-iBpA4Sim.js} +1 -1
  35. package/build/client/assets/spinner-D35u7i0p.js +1 -0
  36. package/build/client/assets/tooltip-v-_I4rCw.js +16 -0
  37. package/build/client/assets/use-sync-yCWvjE_m.js +2 -0
  38. package/build/client/assets/{yaml-Cloe7OVn.js → yaml-BnQf_2Zt.js} +1 -1
  39. package/build/server/__ssr_build/__vite_rsc_assets_manifest.js +213 -133
  40. package/build/server/__ssr_build/assets/{actions-BFtCTvOL.js → actions-C5Kv8XYU.js} +2 -2
  41. package/build/server/__ssr_build/assets/{actions-B50-3n-a.js → actions-DQIBBM15.js} +4 -4
  42. package/build/server/__ssr_build/assets/{badge-DYFvBSp8.js → badge-B48L9yYO.js} +1 -1
  43. package/build/server/__ssr_build/assets/{client-CU90j0R8.js → client-AuWNsacU.js} +3 -3
  44. package/build/server/__ssr_build/assets/client-BHaLyky8.js +1162 -0
  45. package/build/server/__ssr_build/assets/{client--HXec13w.js → client-BogEWrwz.js} +10 -6
  46. package/build/server/__ssr_build/assets/{client-BqW9rGyi.js → client-DXOHI3cC.js} +2994 -4866
  47. package/build/server/__ssr_build/assets/{dropdown-menu-D2YyT3lP.js → dropdown-menu-CnDgV_JY.js} +7 -10
  48. package/build/server/__ssr_build/assets/{entry.rsc-Cg_DxYkh.js → entry.rsc-aOU-YPkj.js} +1 -1
  49. package/build/server/__ssr_build/assets/{index-PpqpVA51.js → index-B6ajh-UP.js} +1 -1
  50. package/build/server/__ssr_build/assets/index-BPd5y8T-.js +76 -0
  51. package/build/server/__ssr_build/assets/{button-C_-b_vqm.js → index-By9m5mBe.js} +3295 -3195
  52. package/build/server/__ssr_build/assets/index-Ch7b9Ofo.js +37 -0
  53. package/build/server/__ssr_build/assets/{index-B-gno69w.js → index-Cw6b1mnl.js} +8 -7
  54. package/build/server/__ssr_build/assets/{index-DBc0nhEL.js → index-kCa2P0Xn.js} +4 -75
  55. package/build/server/__ssr_build/assets/{index-Dtw6X3NW.js → index-tFzyztyE.js} +2 -2
  56. package/build/server/__ssr_build/assets/{layout-CPnSx9PI.js → layout-CC-HJHWR.js} +13 -11
  57. package/build/server/__ssr_build/assets/{mdx-bmeV1kyx.js → mdx-D9VFmsYC.js} +1 -1
  58. package/build/server/__ssr_build/assets/{page-BwoghW3K.js → page-BVUd9aDy.js} +10 -8
  59. package/build/server/__ssr_build/assets/{page-HxttullC.js → page-C_wQzy3_.js} +13 -11
  60. package/build/server/__ssr_build/assets/popover-CzQgoguQ.js +321 -0
  61. package/build/server/__ssr_build/assets/{root-CS7F-km4.js → root-BmMc6_zA.js} +1 -1
  62. package/build/server/__ssr_build/assets/route-CNYc37pV.js +860 -0
  63. package/build/server/__ssr_build/assets/{spinner-BXcLlTNs.js → select-B8QQSB6X.js} +10 -25
  64. package/build/server/__ssr_build/assets/{separator-8UA_ceSq.js → separator-C601eKPH.js} +2 -2
  65. package/build/server/__ssr_build/assets/{sidebar-BzNOZeBO.js → sidebar-C6fHDjcx.js} +237 -65
  66. package/build/server/__ssr_build/assets/{site-header-CXHKSzqk.js → site-header-Bmsr3a30.js} +2 -2
  67. package/build/server/__ssr_build/assets/spinner-D5zAJQcS.js +19 -0
  68. package/build/server/__ssr_build/assets/{tooltip-DZ4WdJt-.js → tooltip-B3A57zPO.js} +1211 -1214
  69. package/build/server/__ssr_build/assets/{use-sync-TRS0zL-Y.js → use-sync-DTZgOM1O.js} +259 -1498
  70. package/build/server/__ssr_build/assets/{yaml-BEdFfhvc.js → yaml-xJU1Ur4O.js} +1 -1
  71. package/build/server/__ssr_build/index.js +31 -15
  72. package/build/server/__vite_rsc_assets_manifest.js +213 -133
  73. package/build/server/assets/{actions-C92yn6jE.js → actions-BbMzIy5J.js} +2 -2
  74. package/build/server/assets/{actions-CWWFIcb1.js → actions-CjWBMAed.js} +2 -2
  75. package/build/server/assets/{actions-DZdN0IBq.js → actions-cRzXiMyR.js} +2 -2
  76. package/build/server/assets/{config-Cb909uq6.js → config-Dka4Bvz4.js} +10 -10
  77. package/build/server/assets/{layout-CRw_6FCt.js → layout-CIIfFN0v.js} +2 -2
  78. package/build/server/assets/{page-zlF_Ew1s.js → page-pyqagPXb.js} +2 -2
  79. package/build/server/assets/root-B0B6-NU5.css +1 -0
  80. package/build/server/assets/{root-CVOXO6T9.js → root-D1ebFoST.js} +1 -1
  81. package/build/server/assets/{route-o-6k10r9.js → route-C7QEArEP.js} +12571 -4431
  82. package/build/server/index.js +40 -15
  83. package/dist/bin.mjs +4 -4
  84. package/dist/package.mjs +1 -1
  85. package/package.json +36 -18
  86. package/build/client/assets/actions-DkbV2Z0p.js +0 -1
  87. package/build/client/assets/actions-DpkI7OTF.js +0 -1
  88. package/build/client/assets/badge-CZkdLoIP.js +0 -1
  89. package/build/client/assets/button-Bm94vje1.js +0 -41
  90. package/build/client/assets/client-BWBqEatf.js +0 -1
  91. package/build/client/assets/client-Crg-pMcu.js +0 -1
  92. package/build/client/assets/dropdown-menu-EF-sTINr.js +0 -1
  93. package/build/client/assets/entry.rsc-D51PwnQL.js +0 -1
  94. package/build/client/assets/index-CQRgqbuL.js +0 -1
  95. package/build/client/assets/index-DOs5iMXj.js +0 -1
  96. package/build/client/assets/index-DTzAH5JX.js +0 -1
  97. package/build/client/assets/layout-CnpYRqF0.js +0 -1
  98. package/build/client/assets/page-DOzl4Kpa.js +0 -1
  99. package/build/client/assets/page-uNpJU_rv.js +0 -1
  100. package/build/client/assets/root-D3NoAGI1.js +0 -1
  101. package/build/client/assets/root-z8crlXSh.css +0 -1
  102. package/build/client/assets/separator-tWFpvpUX.js +0 -1
  103. package/build/client/assets/sidebar-BBYit8gY.js +0 -12
  104. package/build/client/assets/spinner-BdPhtfsc.js +0 -1
  105. package/build/client/assets/tooltip-Dvh-iHDG.js +0 -16
  106. package/build/client/assets/use-sync-ZgcwUdu_.js +0 -9
  107. package/build/server/assets/root-z8crlXSh.css +0 -1
  108. /package/build/server/__ssr_build/assets/{root-D-Y-rGw5.js → root-S8l7oX7x.js} +0 -0
  109. /package/build/server/assets/{root-dGb6ch_9.js → root-DRYtk85G.js} +0 -0
@@ -1,912 +1,133 @@
1
- import { r as reactExports, j as jsxRuntimeExports, f as requireReact, g as getDefaultExportFromCjs, h as React, i as reactDomExports } from "../index.js";
2
- import { c as createLucideIcon, a as createContextScope, u as useComposedRefs, P as Primitive, b as composeEventHandlers, h as useControllableState, k as useId$1, g as Presence, l as Portal$2, m as hideOthers, n as ReactRemoveScroll, o as createSlot, p as useFocusGuards, F as FocusScope, D as DismissableLayer, G as createContext2, j as createPopperScope, R as Root2, A as Anchor, q as Arrow, C as Content$1, d as createSlottable, H as Root$1, I as isHTMLElement, J as isShadowRoot, K as floor, L as getNodeName, M as isNode, N as getWindow, O as getComputedStyle$1, t as isElement, Q as isLastTraversableNode, T as getParentNode, U as getOverflowAncestors, W as isWebKit$1, w as useFloating$1, Y as evaluate, Z as getPaddingObject, _ as getAlignmentAxis, $ as getAlignment, a0 as clamp, a1 as getAxisLength, a2 as hide$1, z as flip, y as offset, a3 as size, a4 as getSide, a5 as getSideAxis, x as autoUpdate, a6 as shift, a7 as limitShift, a8 as isOverflowElement, s as cn } from "./button-C_-b_vqm.js";
1
+ import { f as requireReact, g as getDefaultExportFromCjs, r as reactExports, j as jsxRuntimeExports, i as React, h as reactDomExports } from "../index.js";
2
+ import { m as useComposedRefs, P as Primitive, g as composeEventHandlers, f as useControllableState, u as useId$1, q as Presence, s as Portal$2, v as hideOthers, h as createContextScope, w as ReactRemoveScroll, y as useFocusGuards, F as FocusScope, D as DismissableLayer, x as createSlot, I as createContext2, J as isHTMLElement, K as isShadowRoot, L as floor, M as getNodeName, N as isNode, O as getWindow, Q as getComputedStyle$1, i as isElement, T as isLastTraversableNode, U as getParentNode, W as getOverflowAncestors, Y as isWebKit$1, k as useFloating$1, Z as evaluate, _ as getPaddingObject, $ as getAlignmentAxis, a0 as getAlignment, a1 as getAxisLength, a2 as clamp, a3 as hide$1, p as flip, a4 as size, a5 as getSide, a6 as getSideAxis, l as autoUpdate, o as offset, a7 as shift, a8 as limitShift, a9 as isOverflowElement, b as cn, C as ChevronRight, R as Root2, A as Anchor, E as Arrow, t as createPopperScope, z as Content$1, aa as Root$1, n as createSlottable } from "./index-By9m5mBe.js";
3
3
  import { cva } from "class-variance-authority";
4
- const __iconNode = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
5
- const ChevronRight = createLucideIcon("chevron-right", __iconNode);
6
- var DIALOG_NAME = "Dialog";
7
- var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
8
- var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
9
- var Dialog = (props) => {
10
- const {
11
- __scopeDialog,
12
- children,
13
- open: openProp,
14
- defaultOpen,
15
- onOpenChange,
16
- modal = true
17
- } = props;
18
- const triggerRef = reactExports.useRef(null);
19
- const contentRef = reactExports.useRef(null);
20
- const [open, setOpen] = useControllableState({
21
- prop: openProp,
22
- defaultProp: defaultOpen ?? false,
23
- onChange: onOpenChange,
24
- caller: DIALOG_NAME
25
- });
26
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
27
- DialogProvider,
28
- {
29
- scope: __scopeDialog,
30
- triggerRef,
31
- contentRef,
32
- contentId: useId$1(),
33
- titleId: useId$1(),
34
- descriptionId: useId$1(),
35
- open,
36
- onOpenChange: setOpen,
37
- onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
38
- modal,
39
- children
40
- }
41
- );
42
- };
43
- Dialog.displayName = DIALOG_NAME;
44
- var TRIGGER_NAME$1 = "DialogTrigger";
45
- var DialogTrigger = reactExports.forwardRef(
46
- (props, forwardedRef) => {
47
- const { __scopeDialog, ...triggerProps } = props;
48
- const context = useDialogContext(TRIGGER_NAME$1, __scopeDialog);
49
- const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
50
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
51
- Primitive.button,
52
- {
53
- type: "button",
54
- "aria-haspopup": "dialog",
55
- "aria-expanded": context.open,
56
- "aria-controls": context.contentId,
57
- "data-state": getState(context.open),
58
- ...triggerProps,
59
- ref: composedTriggerRef,
60
- onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
61
- }
62
- );
63
- }
64
- );
65
- DialogTrigger.displayName = TRIGGER_NAME$1;
66
- var PORTAL_NAME$1 = "DialogPortal";
67
- var [PortalProvider$1, usePortalContext$2] = createDialogContext(PORTAL_NAME$1, {
68
- forceMount: void 0
69
- });
70
- var DialogPortal = (props) => {
71
- const { __scopeDialog, forceMount, children, container } = props;
72
- const context = useDialogContext(PORTAL_NAME$1, __scopeDialog);
73
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$1, { scope: __scopeDialog, forceMount, children: reactExports.Children.map(children, (child) => /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children: child }) })) });
74
- };
75
- DialogPortal.displayName = PORTAL_NAME$1;
76
- var OVERLAY_NAME = "DialogOverlay";
77
- var DialogOverlay = reactExports.forwardRef(
78
- (props, forwardedRef) => {
79
- const portalContext = usePortalContext$2(OVERLAY_NAME, props.__scopeDialog);
80
- const { forceMount = portalContext.forceMount, ...overlayProps } = props;
81
- const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
82
- return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
83
- }
84
- );
85
- DialogOverlay.displayName = OVERLAY_NAME;
86
- var Slot = createSlot("DialogOverlay.RemoveScroll");
87
- var DialogOverlayImpl = reactExports.forwardRef(
88
- (props, forwardedRef) => {
89
- const { __scopeDialog, ...overlayProps } = props;
90
- const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
91
- return (
92
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
93
- // ie. when `Overlay` and `Content` are siblings
94
- /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
95
- Primitive.div,
96
- {
97
- "data-state": getState(context.open),
98
- ...overlayProps,
99
- ref: forwardedRef,
100
- style: { pointerEvents: "auto", ...overlayProps.style }
101
- }
102
- ) })
103
- );
104
- }
105
- );
106
- var CONTENT_NAME$1 = "DialogContent";
107
- var DialogContent = reactExports.forwardRef(
108
- (props, forwardedRef) => {
109
- const portalContext = usePortalContext$2(CONTENT_NAME$1, props.__scopeDialog);
110
- const { forceMount = portalContext.forceMount, ...contentProps } = props;
111
- const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
112
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
113
- }
114
- );
115
- DialogContent.displayName = CONTENT_NAME$1;
116
- var DialogContentModal = reactExports.forwardRef(
117
- (props, forwardedRef) => {
118
- const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
119
- const contentRef = reactExports.useRef(null);
120
- const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
121
- reactExports.useEffect(() => {
122
- const content = contentRef.current;
123
- if (content) return hideOthers(content);
124
- }, []);
125
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
126
- DialogContentImpl,
127
- {
128
- ...props,
129
- ref: composedRefs,
130
- trapFocus: context.open,
131
- disableOutsidePointerEvents: true,
132
- onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
133
- event.preventDefault();
134
- context.triggerRef.current?.focus();
135
- }),
136
- onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
137
- const originalEvent = event.detail.originalEvent;
138
- const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
139
- const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
140
- if (isRightClick) event.preventDefault();
141
- }),
142
- onFocusOutside: composeEventHandlers(
143
- props.onFocusOutside,
144
- (event) => event.preventDefault()
145
- )
146
- }
147
- );
148
- }
149
- );
150
- var DialogContentNonModal = reactExports.forwardRef(
151
- (props, forwardedRef) => {
152
- const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
153
- const hasInteractedOutsideRef = reactExports.useRef(false);
154
- const hasPointerDownOutsideRef = reactExports.useRef(false);
155
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
156
- DialogContentImpl,
157
- {
158
- ...props,
159
- ref: forwardedRef,
160
- trapFocus: false,
161
- disableOutsidePointerEvents: false,
162
- onCloseAutoFocus: (event) => {
163
- props.onCloseAutoFocus?.(event);
164
- if (!event.defaultPrevented) {
165
- if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
166
- event.preventDefault();
167
- }
168
- hasInteractedOutsideRef.current = false;
169
- hasPointerDownOutsideRef.current = false;
170
- },
171
- onInteractOutside: (event) => {
172
- props.onInteractOutside?.(event);
173
- if (!event.defaultPrevented) {
174
- hasInteractedOutsideRef.current = true;
175
- if (event.detail.originalEvent.type === "pointerdown") {
176
- hasPointerDownOutsideRef.current = true;
177
- }
178
- }
179
- const target = event.target;
180
- const targetIsTrigger = context.triggerRef.current?.contains(target);
181
- if (targetIsTrigger) event.preventDefault();
182
- if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
183
- event.preventDefault();
184
- }
185
- }
186
- }
187
- );
188
- }
189
- );
190
- var DialogContentImpl = reactExports.forwardRef(
191
- (props, forwardedRef) => {
192
- const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
193
- const context = useDialogContext(CONTENT_NAME$1, __scopeDialog);
194
- const contentRef = reactExports.useRef(null);
195
- const composedRefs = useComposedRefs(forwardedRef, contentRef);
196
- useFocusGuards();
197
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
198
- /* @__PURE__ */ jsxRuntimeExports.jsx(
199
- FocusScope,
200
- {
201
- asChild: true,
202
- loop: true,
203
- trapped: trapFocus,
204
- onMountAutoFocus: onOpenAutoFocus,
205
- onUnmountAutoFocus: onCloseAutoFocus,
206
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
207
- DismissableLayer,
208
- {
209
- role: "dialog",
210
- id: context.contentId,
211
- "aria-describedby": context.descriptionId,
212
- "aria-labelledby": context.titleId,
213
- "data-state": getState(context.open),
214
- ...contentProps,
215
- ref: composedRefs,
216
- onDismiss: () => context.onOpenChange(false)
217
- }
218
- )
219
- }
220
- ),
221
- /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
222
- /* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
223
- /* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
224
- ] })
225
- ] });
226
- }
227
- );
228
- var TITLE_NAME = "DialogTitle";
229
- var DialogTitle = reactExports.forwardRef(
230
- (props, forwardedRef) => {
231
- const { __scopeDialog, ...titleProps } = props;
232
- const context = useDialogContext(TITLE_NAME, __scopeDialog);
233
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
234
- }
235
- );
236
- DialogTitle.displayName = TITLE_NAME;
237
- var DESCRIPTION_NAME = "DialogDescription";
238
- var DialogDescription = reactExports.forwardRef(
239
- (props, forwardedRef) => {
240
- const { __scopeDialog, ...descriptionProps } = props;
241
- const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
242
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
243
- }
244
- );
245
- DialogDescription.displayName = DESCRIPTION_NAME;
246
- var CLOSE_NAME = "DialogClose";
247
- var DialogClose = reactExports.forwardRef(
248
- (props, forwardedRef) => {
249
- const { __scopeDialog, ...closeProps } = props;
250
- const context = useDialogContext(CLOSE_NAME, __scopeDialog);
251
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
252
- Primitive.button,
253
- {
254
- type: "button",
255
- ...closeProps,
256
- ref: forwardedRef,
257
- onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
258
- }
259
- );
260
- }
261
- );
262
- DialogClose.displayName = CLOSE_NAME;
263
- function getState(open) {
264
- return open ? "open" : "closed";
265
- }
266
- var TITLE_WARNING_NAME = "DialogTitleWarning";
267
- var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
268
- contentName: CONTENT_NAME$1,
269
- titleName: TITLE_NAME,
270
- docsSlug: "dialog"
271
- });
272
- var TitleWarning = ({ titleId }) => {
273
- const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
274
- const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
275
-
276
- If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
277
-
278
- For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
279
- reactExports.useEffect(() => {
280
- if (titleId) {
281
- const hasTitle = document.getElementById(titleId);
282
- if (!hasTitle) console.error(MESSAGE);
283
- }
284
- }, [MESSAGE, titleId]);
285
- return null;
286
- };
287
- var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
288
- var DescriptionWarning = ({ contentRef, descriptionId }) => {
289
- const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
290
- const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
291
- reactExports.useEffect(() => {
292
- const describedById = contentRef.current?.getAttribute("aria-describedby");
293
- if (descriptionId && describedById) {
294
- const hasDescription = document.getElementById(descriptionId);
295
- if (!hasDescription) console.warn(MESSAGE);
296
- }
297
- }, [MESSAGE, contentRef, descriptionId]);
298
- return null;
299
- };
300
- var Root = Dialog;
301
- var Trigger$1 = DialogTrigger;
302
- var Portal$1 = DialogPortal;
303
- var Overlay = DialogOverlay;
304
- var Content = DialogContent;
305
- var Title = DialogTitle;
306
- var Description = DialogDescription;
307
- var Close = DialogClose;
308
- var shim = { exports: {} };
309
- var useSyncExternalStoreShim_production = {};
310
- var hasRequiredUseSyncExternalStoreShim_production;
311
- function requireUseSyncExternalStoreShim_production() {
312
- if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
313
- hasRequiredUseSyncExternalStoreShim_production = 1;
314
- var React2 = requireReact();
315
- function is(x, y) {
316
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
317
- }
318
- var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
319
- function useSyncExternalStore$2(subscribe, getSnapshot) {
320
- var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
321
- useLayoutEffect(
322
- function() {
323
- inst.value = value;
324
- inst.getSnapshot = getSnapshot;
325
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
326
- },
327
- [subscribe, value, getSnapshot]
328
- );
329
- useEffect(
330
- function() {
331
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
332
- return subscribe(function() {
333
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
334
- });
335
- },
336
- [subscribe]
337
- );
338
- useDebugValue(value);
339
- return value;
340
- }
341
- function checkIfSnapshotChanged(inst) {
342
- var latestGetSnapshot = inst.getSnapshot;
343
- inst = inst.value;
344
- try {
345
- var nextValue = latestGetSnapshot();
346
- return !objectIs(inst, nextValue);
347
- } catch (error2) {
348
- return true;
349
- }
350
- }
351
- function useSyncExternalStore$1(subscribe, getSnapshot) {
352
- return getSnapshot();
353
- }
354
- var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
355
- useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
356
- return useSyncExternalStoreShim_production;
357
- }
358
- var useSyncExternalStoreShim_development = {};
359
- var hasRequiredUseSyncExternalStoreShim_development;
360
- function requireUseSyncExternalStoreShim_development() {
361
- if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
362
- hasRequiredUseSyncExternalStoreShim_development = 1;
363
- "production" !== process.env.NODE_ENV && (function() {
364
- function is(x, y) {
365
- return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
366
- }
367
- function useSyncExternalStore$2(subscribe, getSnapshot) {
368
- didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, console.error(
369
- "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
370
- ));
371
- var value = getSnapshot();
372
- if (!didWarnUncachedGetSnapshot) {
373
- var cachedValue = getSnapshot();
374
- objectIs(value, cachedValue) || (console.error(
375
- "The result of getSnapshot should be cached to avoid an infinite loop"
376
- ), didWarnUncachedGetSnapshot = true);
377
- }
378
- cachedValue = useState({
379
- inst: { value, getSnapshot }
380
- });
381
- var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
382
- useLayoutEffect(
383
- function() {
384
- inst.value = value;
385
- inst.getSnapshot = getSnapshot;
386
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
387
- },
388
- [subscribe, value, getSnapshot]
389
- );
390
- useEffect(
391
- function() {
392
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
393
- return subscribe(function() {
394
- checkIfSnapshotChanged(inst) && forceUpdate({ inst });
395
- });
396
- },
397
- [subscribe]
398
- );
399
- useDebugValue(value);
400
- return value;
401
- }
402
- function checkIfSnapshotChanged(inst) {
403
- var latestGetSnapshot = inst.getSnapshot;
404
- inst = inst.value;
405
- try {
406
- var nextValue = latestGetSnapshot();
407
- return !objectIs(inst, nextValue);
408
- } catch (error2) {
409
- return true;
410
- }
411
- }
412
- function useSyncExternalStore$1(subscribe, getSnapshot) {
413
- return getSnapshot();
414
- }
415
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
416
- var React2 = requireReact(), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
417
- useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
418
- "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
419
- })();
420
- return useSyncExternalStoreShim_development;
421
- }
422
- var hasRequiredShim;
423
- function requireShim() {
424
- if (hasRequiredShim) return shim.exports;
425
- hasRequiredShim = 1;
426
- if (process.env.NODE_ENV === "production") {
427
- shim.exports = requireUseSyncExternalStoreShim_production();
428
- } else {
429
- shim.exports = requireUseSyncExternalStoreShim_development();
430
- }
431
- return shim.exports;
432
- }
433
- var shimExports = requireShim();
434
- var [createTooltipContext] = createContextScope("Tooltip", [
435
- createPopperScope
436
- ]);
437
- var usePopperScope = createPopperScope();
438
- var PROVIDER_NAME = "TooltipProvider";
439
- var DEFAULT_DELAY_DURATION = 700;
440
- var TOOLTIP_OPEN = "tooltip.open";
441
- var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
442
- var TooltipProvider$1 = (props) => {
443
- const {
444
- __scopeTooltip,
445
- delayDuration = DEFAULT_DELAY_DURATION,
446
- skipDelayDuration = 300,
447
- disableHoverableContent = false,
448
- children
449
- } = props;
450
- const isOpenDelayedRef = reactExports.useRef(true);
451
- const isPointerInTransitRef = reactExports.useRef(false);
452
- const skipDelayTimerRef = reactExports.useRef(0);
453
- reactExports.useEffect(() => {
454
- const skipDelayTimer = skipDelayTimerRef.current;
455
- return () => window.clearTimeout(skipDelayTimer);
456
- }, []);
457
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
458
- TooltipProviderContextProvider,
459
- {
460
- scope: __scopeTooltip,
461
- isOpenDelayedRef,
462
- delayDuration,
463
- onOpen: reactExports.useCallback(() => {
464
- window.clearTimeout(skipDelayTimerRef.current);
465
- isOpenDelayedRef.current = false;
466
- }, []),
467
- onClose: reactExports.useCallback(() => {
468
- window.clearTimeout(skipDelayTimerRef.current);
469
- skipDelayTimerRef.current = window.setTimeout(
470
- () => isOpenDelayedRef.current = true,
471
- skipDelayDuration
472
- );
473
- }, [skipDelayDuration]),
474
- isPointerInTransitRef,
475
- onPointerInTransitChange: reactExports.useCallback((inTransit) => {
476
- isPointerInTransitRef.current = inTransit;
477
- }, []),
478
- disableHoverableContent,
479
- children
480
- }
481
- );
482
- };
483
- TooltipProvider$1.displayName = PROVIDER_NAME;
484
- var TOOLTIP_NAME = "Tooltip";
485
- var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
486
- var Tooltip$1 = (props) => {
487
- const {
488
- __scopeTooltip,
489
- children,
490
- open: openProp,
491
- defaultOpen,
492
- onOpenChange,
493
- disableHoverableContent: disableHoverableContentProp,
494
- delayDuration: delayDurationProp
495
- } = props;
496
- const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
497
- const popperScope = usePopperScope(__scopeTooltip);
498
- const [trigger, setTrigger] = reactExports.useState(null);
499
- const contentId = useId$1();
500
- const openTimerRef = reactExports.useRef(0);
501
- const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
502
- const delayDuration = delayDurationProp ?? providerContext.delayDuration;
503
- const wasOpenDelayedRef = reactExports.useRef(false);
504
- const [open, setOpen] = useControllableState({
505
- prop: openProp,
506
- defaultProp: defaultOpen ?? false,
507
- onChange: (open2) => {
508
- if (open2) {
509
- providerContext.onOpen();
510
- document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
511
- } else {
512
- providerContext.onClose();
513
- }
514
- onOpenChange?.(open2);
515
- },
516
- caller: TOOLTIP_NAME
517
- });
518
- const stateAttribute = reactExports.useMemo(() => {
519
- return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
520
- }, [open]);
521
- const handleOpen = reactExports.useCallback(() => {
522
- window.clearTimeout(openTimerRef.current);
523
- openTimerRef.current = 0;
524
- wasOpenDelayedRef.current = false;
525
- setOpen(true);
526
- }, [setOpen]);
527
- const handleClose = reactExports.useCallback(() => {
528
- window.clearTimeout(openTimerRef.current);
529
- openTimerRef.current = 0;
530
- setOpen(false);
531
- }, [setOpen]);
532
- const handleDelayedOpen = reactExports.useCallback(() => {
533
- window.clearTimeout(openTimerRef.current);
534
- openTimerRef.current = window.setTimeout(() => {
535
- wasOpenDelayedRef.current = true;
536
- setOpen(true);
537
- openTimerRef.current = 0;
538
- }, delayDuration);
539
- }, [delayDuration, setOpen]);
540
- reactExports.useEffect(() => {
541
- return () => {
542
- if (openTimerRef.current) {
543
- window.clearTimeout(openTimerRef.current);
544
- openTimerRef.current = 0;
545
- }
546
- };
547
- }, []);
548
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
549
- TooltipContextProvider,
550
- {
551
- scope: __scopeTooltip,
552
- contentId,
553
- open,
554
- stateAttribute,
555
- trigger,
556
- onTriggerChange: setTrigger,
557
- onTriggerEnter: reactExports.useCallback(() => {
558
- if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
559
- else handleOpen();
560
- }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
561
- onTriggerLeave: reactExports.useCallback(() => {
562
- if (disableHoverableContent) {
563
- handleClose();
564
- } else {
565
- window.clearTimeout(openTimerRef.current);
566
- openTimerRef.current = 0;
567
- }
568
- }, [handleClose, disableHoverableContent]),
569
- onOpen: handleOpen,
570
- onClose: handleClose,
571
- disableHoverableContent,
572
- children
573
- }
574
- ) });
575
- };
576
- Tooltip$1.displayName = TOOLTIP_NAME;
577
- var TRIGGER_NAME = "TooltipTrigger";
578
- var TooltipTrigger$1 = reactExports.forwardRef(
579
- (props, forwardedRef) => {
580
- const { __scopeTooltip, ...triggerProps } = props;
581
- const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
582
- const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
583
- const popperScope = usePopperScope(__scopeTooltip);
584
- const ref = reactExports.useRef(null);
585
- const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
586
- const isPointerDownRef = reactExports.useRef(false);
587
- const hasPointerMoveOpenedRef = reactExports.useRef(false);
588
- const handlePointerUp = reactExports.useCallback(() => isPointerDownRef.current = false, []);
589
- reactExports.useEffect(() => {
590
- return () => document.removeEventListener("pointerup", handlePointerUp);
591
- }, [handlePointerUp]);
592
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
593
- Primitive.button,
594
- {
595
- "aria-describedby": context.open ? context.contentId : void 0,
596
- "data-state": context.stateAttribute,
597
- ...triggerProps,
598
- ref: composedRefs,
599
- onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
600
- if (event.pointerType === "touch") return;
601
- if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
602
- context.onTriggerEnter();
603
- hasPointerMoveOpenedRef.current = true;
604
- }
605
- }),
606
- onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
607
- context.onTriggerLeave();
608
- hasPointerMoveOpenedRef.current = false;
609
- }),
610
- onPointerDown: composeEventHandlers(props.onPointerDown, () => {
611
- if (context.open) {
612
- context.onClose();
613
- }
614
- isPointerDownRef.current = true;
615
- document.addEventListener("pointerup", handlePointerUp, { once: true });
616
- }),
617
- onFocus: composeEventHandlers(props.onFocus, () => {
618
- if (!isPointerDownRef.current) context.onOpen();
619
- }),
620
- onBlur: composeEventHandlers(props.onBlur, context.onClose),
621
- onClick: composeEventHandlers(props.onClick, context.onClose)
622
- }
623
- ) });
624
- }
625
- );
626
- TooltipTrigger$1.displayName = TRIGGER_NAME;
627
- var PORTAL_NAME = "TooltipPortal";
628
- var [PortalProvider, usePortalContext$1] = createTooltipContext(PORTAL_NAME, {
629
- forceMount: void 0
630
- });
631
- var TooltipPortal = (props) => {
632
- const { __scopeTooltip, forceMount, children, container } = props;
633
- const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
634
- return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children }) }) });
635
- };
636
- TooltipPortal.displayName = PORTAL_NAME;
637
- var CONTENT_NAME = "TooltipContent";
638
- var TooltipContent$1 = reactExports.forwardRef(
639
- (props, forwardedRef) => {
640
- const portalContext = usePortalContext$1(CONTENT_NAME, props.__scopeTooltip);
641
- const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
642
- const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
643
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
644
- }
645
- );
646
- var TooltipContentHoverable = reactExports.forwardRef((props, forwardedRef) => {
647
- const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
648
- const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
649
- const ref = reactExports.useRef(null);
650
- const composedRefs = useComposedRefs(forwardedRef, ref);
651
- const [pointerGraceArea, setPointerGraceArea] = reactExports.useState(null);
652
- const { trigger, onClose } = context;
653
- const content = ref.current;
654
- const { onPointerInTransitChange } = providerContext;
655
- const handleRemoveGraceArea = reactExports.useCallback(() => {
656
- setPointerGraceArea(null);
657
- onPointerInTransitChange(false);
658
- }, [onPointerInTransitChange]);
659
- const handleCreateGraceArea = reactExports.useCallback(
660
- (event, hoverTarget) => {
661
- const currentTarget = event.currentTarget;
662
- const exitPoint = { x: event.clientX, y: event.clientY };
663
- const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
664
- const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
665
- const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
666
- const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
667
- setPointerGraceArea(graceArea);
668
- onPointerInTransitChange(true);
669
- },
670
- [onPointerInTransitChange]
671
- );
672
- reactExports.useEffect(() => {
673
- return () => handleRemoveGraceArea();
674
- }, [handleRemoveGraceArea]);
675
- reactExports.useEffect(() => {
676
- if (trigger && content) {
677
- const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
678
- const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
679
- trigger.addEventListener("pointerleave", handleTriggerLeave);
680
- content.addEventListener("pointerleave", handleContentLeave);
681
- return () => {
682
- trigger.removeEventListener("pointerleave", handleTriggerLeave);
683
- content.removeEventListener("pointerleave", handleContentLeave);
684
- };
685
- }
686
- }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
687
- reactExports.useEffect(() => {
688
- if (pointerGraceArea) {
689
- const handleTrackPointerGrace = (event) => {
690
- const target = event.target;
691
- const pointerPosition = { x: event.clientX, y: event.clientY };
692
- const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
693
- const isPointerOutsideGraceArea = !isPointInPolygon$1(pointerPosition, pointerGraceArea);
694
- if (hasEnteredTarget) {
695
- handleRemoveGraceArea();
696
- } else if (isPointerOutsideGraceArea) {
697
- handleRemoveGraceArea();
698
- onClose();
699
- }
700
- };
701
- document.addEventListener("pointermove", handleTrackPointerGrace);
702
- return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
703
- }
704
- }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
705
- return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
706
- });
707
- var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
708
- var Slottable = createSlottable("TooltipContent");
709
- var TooltipContentImpl = reactExports.forwardRef(
710
- (props, forwardedRef) => {
711
- const {
712
- __scopeTooltip,
713
- children,
714
- "aria-label": ariaLabel,
715
- onEscapeKeyDown,
716
- onPointerDownOutside,
717
- ...contentProps
718
- } = props;
719
- const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
720
- const popperScope = usePopperScope(__scopeTooltip);
721
- const { onClose } = context;
722
- reactExports.useEffect(() => {
723
- document.addEventListener(TOOLTIP_OPEN, onClose);
724
- return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
725
- }, [onClose]);
726
- reactExports.useEffect(() => {
727
- if (context.trigger) {
728
- const handleScroll = (event) => {
729
- const target = event.target;
730
- if (target?.contains(context.trigger)) onClose();
731
- };
732
- window.addEventListener("scroll", handleScroll, { capture: true });
733
- return () => window.removeEventListener("scroll", handleScroll, { capture: true });
734
- }
735
- }, [context.trigger, onClose]);
736
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
737
- DismissableLayer,
738
- {
739
- asChild: true,
740
- disableOutsidePointerEvents: false,
741
- onEscapeKeyDown,
742
- onPointerDownOutside,
743
- onFocusOutside: (event) => event.preventDefault(),
744
- onDismiss: onClose,
745
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
746
- Content$1,
747
- {
748
- "data-state": context.stateAttribute,
749
- ...popperScope,
750
- ...contentProps,
751
- ref: forwardedRef,
752
- style: {
753
- ...contentProps.style,
754
- // re-namespace exposed content custom properties
755
- ...{
756
- "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
757
- "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
758
- "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
759
- "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
760
- "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
761
- }
762
- },
763
- children: [
764
- /* @__PURE__ */ jsxRuntimeExports.jsx(Slottable, { children }),
765
- /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root$1, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
766
- ]
767
- }
768
- )
769
- }
770
- );
4
+ var withSelector = { exports: {} };
5
+ var withSelector_production = {};
6
+ var shim = { exports: {} };
7
+ var useSyncExternalStoreShim_production = {};
8
+ var hasRequiredUseSyncExternalStoreShim_production;
9
+ function requireUseSyncExternalStoreShim_production() {
10
+ if (hasRequiredUseSyncExternalStoreShim_production) return useSyncExternalStoreShim_production;
11
+ hasRequiredUseSyncExternalStoreShim_production = 1;
12
+ var React2 = requireReact();
13
+ function is(x, y) {
14
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
771
15
  }
772
- );
773
- TooltipContent$1.displayName = CONTENT_NAME;
774
- var ARROW_NAME = "TooltipArrow";
775
- var TooltipArrow = reactExports.forwardRef(
776
- (props, forwardedRef) => {
777
- const { __scopeTooltip, ...arrowProps } = props;
778
- const popperScope = usePopperScope(__scopeTooltip);
779
- const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
780
- ARROW_NAME,
781
- __scopeTooltip
16
+ var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue;
17
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
18
+ var value = getSnapshot(), _useState = useState({ inst: { value, getSnapshot } }), inst = _useState[0].inst, forceUpdate = _useState[1];
19
+ useLayoutEffect(
20
+ function() {
21
+ inst.value = value;
22
+ inst.getSnapshot = getSnapshot;
23
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
24
+ },
25
+ [subscribe, value, getSnapshot]
782
26
  );
783
- return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
27
+ useEffect(
28
+ function() {
29
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
30
+ return subscribe(function() {
31
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
32
+ });
33
+ },
34
+ [subscribe]
35
+ );
36
+ useDebugValue(value);
37
+ return value;
784
38
  }
785
- );
786
- TooltipArrow.displayName = ARROW_NAME;
787
- function getExitSideFromRect(point, rect) {
788
- const top = Math.abs(rect.top - point.y);
789
- const bottom = Math.abs(rect.bottom - point.y);
790
- const right = Math.abs(rect.right - point.x);
791
- const left = Math.abs(rect.left - point.x);
792
- switch (Math.min(top, bottom, right, left)) {
793
- case left:
794
- return "left";
795
- case right:
796
- return "right";
797
- case top:
798
- return "top";
799
- case bottom:
800
- return "bottom";
801
- default:
802
- throw new Error("unreachable");
39
+ function checkIfSnapshotChanged(inst) {
40
+ var latestGetSnapshot = inst.getSnapshot;
41
+ inst = inst.value;
42
+ try {
43
+ var nextValue = latestGetSnapshot();
44
+ return !objectIs(inst, nextValue);
45
+ } catch (error2) {
46
+ return true;
47
+ }
803
48
  }
49
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
50
+ return getSnapshot();
51
+ }
52
+ var shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
53
+ useSyncExternalStoreShim_production.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
54
+ return useSyncExternalStoreShim_production;
804
55
  }
805
- function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
806
- const paddedExitPoints = [];
807
- switch (exitSide) {
808
- case "top":
809
- paddedExitPoints.push(
810
- { x: exitPoint.x - padding, y: exitPoint.y + padding },
811
- { x: exitPoint.x + padding, y: exitPoint.y + padding }
812
- );
813
- break;
814
- case "bottom":
815
- paddedExitPoints.push(
816
- { x: exitPoint.x - padding, y: exitPoint.y - padding },
817
- { x: exitPoint.x + padding, y: exitPoint.y - padding }
818
- );
819
- break;
820
- case "left":
821
- paddedExitPoints.push(
822
- { x: exitPoint.x + padding, y: exitPoint.y - padding },
823
- { x: exitPoint.x + padding, y: exitPoint.y + padding }
56
+ var useSyncExternalStoreShim_development = {};
57
+ var hasRequiredUseSyncExternalStoreShim_development;
58
+ function requireUseSyncExternalStoreShim_development() {
59
+ if (hasRequiredUseSyncExternalStoreShim_development) return useSyncExternalStoreShim_development;
60
+ hasRequiredUseSyncExternalStoreShim_development = 1;
61
+ "production" !== process.env.NODE_ENV && (function() {
62
+ function is(x, y) {
63
+ return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
64
+ }
65
+ function useSyncExternalStore$2(subscribe, getSnapshot) {
66
+ didWarnOld18Alpha || void 0 === React2.startTransition || (didWarnOld18Alpha = true, console.error(
67
+ "You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."
68
+ ));
69
+ var value = getSnapshot();
70
+ if (!didWarnUncachedGetSnapshot) {
71
+ var cachedValue = getSnapshot();
72
+ objectIs(value, cachedValue) || (console.error(
73
+ "The result of getSnapshot should be cached to avoid an infinite loop"
74
+ ), didWarnUncachedGetSnapshot = true);
75
+ }
76
+ cachedValue = useState({
77
+ inst: { value, getSnapshot }
78
+ });
79
+ var inst = cachedValue[0].inst, forceUpdate = cachedValue[1];
80
+ useLayoutEffect(
81
+ function() {
82
+ inst.value = value;
83
+ inst.getSnapshot = getSnapshot;
84
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
85
+ },
86
+ [subscribe, value, getSnapshot]
824
87
  );
825
- break;
826
- case "right":
827
- paddedExitPoints.push(
828
- { x: exitPoint.x - padding, y: exitPoint.y - padding },
829
- { x: exitPoint.x - padding, y: exitPoint.y + padding }
88
+ useEffect(
89
+ function() {
90
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
91
+ return subscribe(function() {
92
+ checkIfSnapshotChanged(inst) && forceUpdate({ inst });
93
+ });
94
+ },
95
+ [subscribe]
830
96
  );
831
- break;
832
- }
833
- return paddedExitPoints;
834
- }
835
- function getPointsFromRect(rect) {
836
- const { top, right, bottom, left } = rect;
837
- return [
838
- { x: left, y: top },
839
- { x: right, y: top },
840
- { x: right, y: bottom },
841
- { x: left, y: bottom }
842
- ];
843
- }
844
- function isPointInPolygon$1(point, polygon) {
845
- const { x, y } = point;
846
- let inside = false;
847
- for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
848
- const ii = polygon[i];
849
- const jj = polygon[j];
850
- const xi = ii.x;
851
- const yi = ii.y;
852
- const xj = jj.x;
853
- const yj = jj.y;
854
- const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
855
- if (intersect) inside = !inside;
856
- }
857
- return inside;
858
- }
859
- function getHull(points) {
860
- const newPoints = points.slice();
861
- newPoints.sort((a, b) => {
862
- if (a.x < b.x) return -1;
863
- else if (a.x > b.x) return 1;
864
- else if (a.y < b.y) return -1;
865
- else if (a.y > b.y) return 1;
866
- else return 0;
867
- });
868
- return getHullPresorted(newPoints);
869
- }
870
- function getHullPresorted(points) {
871
- if (points.length <= 1) return points.slice();
872
- const upperHull = [];
873
- for (let i = 0; i < points.length; i++) {
874
- const p = points[i];
875
- while (upperHull.length >= 2) {
876
- const q = upperHull[upperHull.length - 1];
877
- const r = upperHull[upperHull.length - 2];
878
- if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
879
- else break;
97
+ useDebugValue(value);
98
+ return value;
880
99
  }
881
- upperHull.push(p);
882
- }
883
- upperHull.pop();
884
- const lowerHull = [];
885
- for (let i = points.length - 1; i >= 0; i--) {
886
- const p = points[i];
887
- while (lowerHull.length >= 2) {
888
- const q = lowerHull[lowerHull.length - 1];
889
- const r = lowerHull[lowerHull.length - 2];
890
- if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
891
- else break;
100
+ function checkIfSnapshotChanged(inst) {
101
+ var latestGetSnapshot = inst.getSnapshot;
102
+ inst = inst.value;
103
+ try {
104
+ var nextValue = latestGetSnapshot();
105
+ return !objectIs(inst, nextValue);
106
+ } catch (error2) {
107
+ return true;
108
+ }
892
109
  }
893
- lowerHull.push(p);
894
- }
895
- lowerHull.pop();
896
- if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
897
- return upperHull;
110
+ function useSyncExternalStore$1(subscribe, getSnapshot) {
111
+ return getSnapshot();
112
+ }
113
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
114
+ var React2 = requireReact(), objectIs = "function" === typeof Object.is ? Object.is : is, useState = React2.useState, useEffect = React2.useEffect, useLayoutEffect = React2.useLayoutEffect, useDebugValue = React2.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim2 = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2;
115
+ useSyncExternalStoreShim_development.useSyncExternalStore = void 0 !== React2.useSyncExternalStore ? React2.useSyncExternalStore : shim2;
116
+ "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
117
+ })();
118
+ return useSyncExternalStoreShim_development;
119
+ }
120
+ var hasRequiredShim;
121
+ function requireShim() {
122
+ if (hasRequiredShim) return shim.exports;
123
+ hasRequiredShim = 1;
124
+ if (process.env.NODE_ENV === "production") {
125
+ shim.exports = requireUseSyncExternalStoreShim_production();
898
126
  } else {
899
- return upperHull.concat(lowerHull);
127
+ shim.exports = requireUseSyncExternalStoreShim_development();
900
128
  }
129
+ return shim.exports;
901
130
  }
902
- var Provider = TooltipProvider$1;
903
- var Root3 = Tooltip$1;
904
- var Trigger = TooltipTrigger$1;
905
- var Portal = TooltipPortal;
906
- var Content2 = TooltipContent$1;
907
- var Arrow2 = TooltipArrow;
908
- var withSelector = { exports: {} };
909
- var withSelector_production = {};
910
131
  var hasRequiredWithSelector_production;
911
132
  function requireWithSelector_production() {
912
133
  if (hasRequiredWithSelector_production) return withSelector_production;
@@ -1045,10 +266,313 @@ function requireWithSelector() {
1045
266
  } else {
1046
267
  withSelector.exports = requireWithSelector_development();
1047
268
  }
1048
- return withSelector.exports;
269
+ return withSelector.exports;
270
+ }
271
+ var withSelectorExports = requireWithSelector();
272
+ const useSyncExternalStoreExports = /* @__PURE__ */ getDefaultExportFromCjs(withSelectorExports);
273
+ var DIALOG_NAME = "Dialog";
274
+ var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
275
+ var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
276
+ var Dialog = (props) => {
277
+ const {
278
+ __scopeDialog,
279
+ children,
280
+ open: openProp,
281
+ defaultOpen,
282
+ onOpenChange,
283
+ modal = true
284
+ } = props;
285
+ const triggerRef = reactExports.useRef(null);
286
+ const contentRef = reactExports.useRef(null);
287
+ const [open, setOpen] = useControllableState({
288
+ prop: openProp,
289
+ defaultProp: defaultOpen ?? false,
290
+ onChange: onOpenChange,
291
+ caller: DIALOG_NAME
292
+ });
293
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
294
+ DialogProvider,
295
+ {
296
+ scope: __scopeDialog,
297
+ triggerRef,
298
+ contentRef,
299
+ contentId: useId$1(),
300
+ titleId: useId$1(),
301
+ descriptionId: useId$1(),
302
+ open,
303
+ onOpenChange: setOpen,
304
+ onOpenToggle: reactExports.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
305
+ modal,
306
+ children
307
+ }
308
+ );
309
+ };
310
+ Dialog.displayName = DIALOG_NAME;
311
+ var TRIGGER_NAME$1 = "DialogTrigger";
312
+ var DialogTrigger = reactExports.forwardRef(
313
+ (props, forwardedRef) => {
314
+ const { __scopeDialog, ...triggerProps } = props;
315
+ const context = useDialogContext(TRIGGER_NAME$1, __scopeDialog);
316
+ const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
317
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
318
+ Primitive.button,
319
+ {
320
+ type: "button",
321
+ "aria-haspopup": "dialog",
322
+ "aria-expanded": context.open,
323
+ "aria-controls": context.contentId,
324
+ "data-state": getState(context.open),
325
+ ...triggerProps,
326
+ ref: composedTriggerRef,
327
+ onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
328
+ }
329
+ );
330
+ }
331
+ );
332
+ DialogTrigger.displayName = TRIGGER_NAME$1;
333
+ var PORTAL_NAME$1 = "DialogPortal";
334
+ var [PortalProvider$1, usePortalContext$2] = createDialogContext(PORTAL_NAME$1, {
335
+ forceMount: void 0
336
+ });
337
+ var DialogPortal = (props) => {
338
+ const { __scopeDialog, forceMount, children, container } = props;
339
+ const context = useDialogContext(PORTAL_NAME$1, __scopeDialog);
340
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider$1, { scope: __scopeDialog, forceMount, children: reactExports.Children.map(children, (child) => /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children: child }) })) });
341
+ };
342
+ DialogPortal.displayName = PORTAL_NAME$1;
343
+ var OVERLAY_NAME = "DialogOverlay";
344
+ var DialogOverlay = reactExports.forwardRef(
345
+ (props, forwardedRef) => {
346
+ const portalContext = usePortalContext$2(OVERLAY_NAME, props.__scopeDialog);
347
+ const { forceMount = portalContext.forceMount, ...overlayProps } = props;
348
+ const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
349
+ return context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DialogOverlayImpl, { ...overlayProps, ref: forwardedRef }) }) : null;
350
+ }
351
+ );
352
+ DialogOverlay.displayName = OVERLAY_NAME;
353
+ var Slot = createSlot("DialogOverlay.RemoveScroll");
354
+ var DialogOverlayImpl = reactExports.forwardRef(
355
+ (props, forwardedRef) => {
356
+ const { __scopeDialog, ...overlayProps } = props;
357
+ const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
358
+ return (
359
+ // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
360
+ // ie. when `Overlay` and `Content` are siblings
361
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ReactRemoveScroll, { as: Slot, allowPinchZoom: true, shards: [context.contentRef], children: /* @__PURE__ */ jsxRuntimeExports.jsx(
362
+ Primitive.div,
363
+ {
364
+ "data-state": getState(context.open),
365
+ ...overlayProps,
366
+ ref: forwardedRef,
367
+ style: { pointerEvents: "auto", ...overlayProps.style }
368
+ }
369
+ ) })
370
+ );
371
+ }
372
+ );
373
+ var CONTENT_NAME$1 = "DialogContent";
374
+ var DialogContent = reactExports.forwardRef(
375
+ (props, forwardedRef) => {
376
+ const portalContext = usePortalContext$2(CONTENT_NAME$1, props.__scopeDialog);
377
+ const { forceMount = portalContext.forceMount, ...contentProps } = props;
378
+ const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
379
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(DialogContentNonModal, { ...contentProps, ref: forwardedRef }) });
380
+ }
381
+ );
382
+ DialogContent.displayName = CONTENT_NAME$1;
383
+ var DialogContentModal = reactExports.forwardRef(
384
+ (props, forwardedRef) => {
385
+ const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
386
+ const contentRef = reactExports.useRef(null);
387
+ const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
388
+ reactExports.useEffect(() => {
389
+ const content = contentRef.current;
390
+ if (content) return hideOthers(content);
391
+ }, []);
392
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
393
+ DialogContentImpl,
394
+ {
395
+ ...props,
396
+ ref: composedRefs,
397
+ trapFocus: context.open,
398
+ disableOutsidePointerEvents: true,
399
+ onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
400
+ event.preventDefault();
401
+ context.triggerRef.current?.focus();
402
+ }),
403
+ onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
404
+ const originalEvent = event.detail.originalEvent;
405
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
406
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
407
+ if (isRightClick) event.preventDefault();
408
+ }),
409
+ onFocusOutside: composeEventHandlers(
410
+ props.onFocusOutside,
411
+ (event) => event.preventDefault()
412
+ )
413
+ }
414
+ );
415
+ }
416
+ );
417
+ var DialogContentNonModal = reactExports.forwardRef(
418
+ (props, forwardedRef) => {
419
+ const context = useDialogContext(CONTENT_NAME$1, props.__scopeDialog);
420
+ const hasInteractedOutsideRef = reactExports.useRef(false);
421
+ const hasPointerDownOutsideRef = reactExports.useRef(false);
422
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
423
+ DialogContentImpl,
424
+ {
425
+ ...props,
426
+ ref: forwardedRef,
427
+ trapFocus: false,
428
+ disableOutsidePointerEvents: false,
429
+ onCloseAutoFocus: (event) => {
430
+ props.onCloseAutoFocus?.(event);
431
+ if (!event.defaultPrevented) {
432
+ if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
433
+ event.preventDefault();
434
+ }
435
+ hasInteractedOutsideRef.current = false;
436
+ hasPointerDownOutsideRef.current = false;
437
+ },
438
+ onInteractOutside: (event) => {
439
+ props.onInteractOutside?.(event);
440
+ if (!event.defaultPrevented) {
441
+ hasInteractedOutsideRef.current = true;
442
+ if (event.detail.originalEvent.type === "pointerdown") {
443
+ hasPointerDownOutsideRef.current = true;
444
+ }
445
+ }
446
+ const target = event.target;
447
+ const targetIsTrigger = context.triggerRef.current?.contains(target);
448
+ if (targetIsTrigger) event.preventDefault();
449
+ if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
450
+ event.preventDefault();
451
+ }
452
+ }
453
+ }
454
+ );
455
+ }
456
+ );
457
+ var DialogContentImpl = reactExports.forwardRef(
458
+ (props, forwardedRef) => {
459
+ const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, ...contentProps } = props;
460
+ const context = useDialogContext(CONTENT_NAME$1, __scopeDialog);
461
+ const contentRef = reactExports.useRef(null);
462
+ const composedRefs = useComposedRefs(forwardedRef, contentRef);
463
+ useFocusGuards();
464
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
465
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
466
+ FocusScope,
467
+ {
468
+ asChild: true,
469
+ loop: true,
470
+ trapped: trapFocus,
471
+ onMountAutoFocus: onOpenAutoFocus,
472
+ onUnmountAutoFocus: onCloseAutoFocus,
473
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
474
+ DismissableLayer,
475
+ {
476
+ role: "dialog",
477
+ id: context.contentId,
478
+ "aria-describedby": context.descriptionId,
479
+ "aria-labelledby": context.titleId,
480
+ "data-state": getState(context.open),
481
+ ...contentProps,
482
+ ref: composedRefs,
483
+ onDismiss: () => context.onOpenChange(false)
484
+ }
485
+ )
486
+ }
487
+ ),
488
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
489
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TitleWarning, { titleId: context.titleId }),
490
+ /* @__PURE__ */ jsxRuntimeExports.jsx(DescriptionWarning, { contentRef, descriptionId: context.descriptionId })
491
+ ] })
492
+ ] });
493
+ }
494
+ );
495
+ var TITLE_NAME = "DialogTitle";
496
+ var DialogTitle = reactExports.forwardRef(
497
+ (props, forwardedRef) => {
498
+ const { __scopeDialog, ...titleProps } = props;
499
+ const context = useDialogContext(TITLE_NAME, __scopeDialog);
500
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.h2, { id: context.titleId, ...titleProps, ref: forwardedRef });
501
+ }
502
+ );
503
+ DialogTitle.displayName = TITLE_NAME;
504
+ var DESCRIPTION_NAME = "DialogDescription";
505
+ var DialogDescription = reactExports.forwardRef(
506
+ (props, forwardedRef) => {
507
+ const { __scopeDialog, ...descriptionProps } = props;
508
+ const context = useDialogContext(DESCRIPTION_NAME, __scopeDialog);
509
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.p, { id: context.descriptionId, ...descriptionProps, ref: forwardedRef });
510
+ }
511
+ );
512
+ DialogDescription.displayName = DESCRIPTION_NAME;
513
+ var CLOSE_NAME = "DialogClose";
514
+ var DialogClose = reactExports.forwardRef(
515
+ (props, forwardedRef) => {
516
+ const { __scopeDialog, ...closeProps } = props;
517
+ const context = useDialogContext(CLOSE_NAME, __scopeDialog);
518
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
519
+ Primitive.button,
520
+ {
521
+ type: "button",
522
+ ...closeProps,
523
+ ref: forwardedRef,
524
+ onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
525
+ }
526
+ );
527
+ }
528
+ );
529
+ DialogClose.displayName = CLOSE_NAME;
530
+ function getState(open) {
531
+ return open ? "open" : "closed";
1049
532
  }
1050
- var withSelectorExports = requireWithSelector();
1051
- const useSyncExternalStoreExports = /* @__PURE__ */ getDefaultExportFromCjs(withSelectorExports);
533
+ var TITLE_WARNING_NAME = "DialogTitleWarning";
534
+ var [WarningProvider, useWarningContext] = createContext2(TITLE_WARNING_NAME, {
535
+ contentName: CONTENT_NAME$1,
536
+ titleName: TITLE_NAME,
537
+ docsSlug: "dialog"
538
+ });
539
+ var TitleWarning = ({ titleId }) => {
540
+ const titleWarningContext = useWarningContext(TITLE_WARNING_NAME);
541
+ const MESSAGE = `\`${titleWarningContext.contentName}\` requires a \`${titleWarningContext.titleName}\` for the component to be accessible for screen reader users.
542
+
543
+ If you want to hide the \`${titleWarningContext.titleName}\`, you can wrap it with our VisuallyHidden component.
544
+
545
+ For more information, see https://radix-ui.com/primitives/docs/components/${titleWarningContext.docsSlug}`;
546
+ reactExports.useEffect(() => {
547
+ if (titleId) {
548
+ const hasTitle = document.getElementById(titleId);
549
+ if (!hasTitle) console.error(MESSAGE);
550
+ }
551
+ }, [MESSAGE, titleId]);
552
+ return null;
553
+ };
554
+ var DESCRIPTION_WARNING_NAME = "DialogDescriptionWarning";
555
+ var DescriptionWarning = ({ contentRef, descriptionId }) => {
556
+ const descriptionWarningContext = useWarningContext(DESCRIPTION_WARNING_NAME);
557
+ const MESSAGE = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${descriptionWarningContext.contentName}}.`;
558
+ reactExports.useEffect(() => {
559
+ const describedById = contentRef.current?.getAttribute("aria-describedby");
560
+ if (descriptionId && describedById) {
561
+ const hasDescription = document.getElementById(descriptionId);
562
+ if (!hasDescription) console.warn(MESSAGE);
563
+ }
564
+ }, [MESSAGE, contentRef, descriptionId]);
565
+ return null;
566
+ };
567
+ var Root = Dialog;
568
+ var Trigger$1 = DialogTrigger;
569
+ var Portal$1 = DialogPortal;
570
+ var Overlay = DialogOverlay;
571
+ var Content = DialogContent;
572
+ var Title = DialogTitle;
573
+ var Description = DialogDescription;
574
+ var Close = DialogClose;
575
+ var shimExports = requireShim();
1052
576
  const SafeReact = {
1053
577
  ...React
1054
578
  };
@@ -3514,7 +3038,7 @@ function markOthers(avoidElements, ariaHidden = false, inert = false) {
3514
3038
  }
3515
3039
  const PortalContext = /* @__PURE__ */ reactExports.createContext(null);
3516
3040
  if (process.env.NODE_ENV !== "production") PortalContext.displayName = "PortalContext";
3517
- const usePortalContext = () => reactExports.useContext(PortalContext);
3041
+ const usePortalContext$1 = () => reactExports.useContext(PortalContext);
3518
3042
  const attr = createAttribute("portal");
3519
3043
  function useFloatingPortalNode(props = {}) {
3520
3044
  const {
@@ -3525,7 +3049,7 @@ function useFloatingPortalNode(props = {}) {
3525
3049
  elementState
3526
3050
  } = props;
3527
3051
  const uniqueId = useId();
3528
- const portalContext = usePortalContext();
3052
+ const portalContext = usePortalContext$1();
3529
3053
  const parentPortalNode = portalContext?.portalNode;
3530
3054
  const [containerElement, setContainerElement] = reactExports.useState(null);
3531
3055
  const [portalNode, setPortalNode] = reactExports.useState(null);
@@ -3783,7 +3307,7 @@ function FloatingFocusManager(props) {
3783
3307
  const returnFocusRef = useValueAsRef(returnFocus);
3784
3308
  const openInteractionTypeRef = useValueAsRef(openInteractionType);
3785
3309
  const tree = useFloatingTree(externalTree);
3786
- const portalContext = usePortalContext();
3310
+ const portalContext = usePortalContext$1();
3787
3311
  const startDismissButtonRef = reactExports.useRef(null);
3788
3312
  const endDismissButtonRef = reactExports.useRef(null);
3789
3313
  const preventReturnFocusRef = reactExports.useRef(false);
@@ -7164,7 +6688,7 @@ function useTypeahead(context, props) {
7164
6688
  floating
7165
6689
  } : {}, [enabled, reference, floating]);
7166
6690
  }
7167
- function isPointInPolygon(point, polygon) {
6691
+ function isPointInPolygon$1(point, polygon) {
7168
6692
  const [x, y] = point;
7169
6693
  let isInsideValue = false;
7170
6694
  const length = polygon.length;
@@ -7318,7 +6842,7 @@ function safePolygon(options = {}) {
7318
6842
  return [];
7319
6843
  }
7320
6844
  }
7321
- if (isPointInPolygon([clientX, clientY], rectPoly)) {
6845
+ if (isPointInPolygon$1([clientX, clientY], rectPoly)) {
7322
6846
  return void 0;
7323
6847
  }
7324
6848
  if (hasLanded && !isOverReferenceRect) {
@@ -7331,7 +6855,7 @@ function safePolygon(options = {}) {
7331
6855
  return close();
7332
6856
  }
7333
6857
  }
7334
- if (!isPointInPolygon([clientX, clientY], getPolygon([x, y]))) {
6858
+ if (!isPointInPolygon$1([clientX, clientY], getPolygon([x, y]))) {
7335
6859
  close();
7336
6860
  } else if (!hasLanded && requireIntent) {
7337
6861
  timeout.start(40, close);
@@ -9167,265 +8691,739 @@ const MenuSubmenuTrigger = /* @__PURE__ */ reactExports.forwardRef(function Subm
9167
8691
  });
9168
8692
  return element;
9169
8693
  });
9170
- if (process.env.NODE_ENV !== "production") MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
9171
- function ContextMenuRoot(props) {
9172
- const [anchor, setAnchor] = reactExports.useState({
9173
- getBoundingClientRect() {
9174
- return DOMRect.fromRect({
9175
- width: 0,
9176
- height: 0,
9177
- x: 0,
9178
- y: 0
9179
- });
8694
+ if (process.env.NODE_ENV !== "production") MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger";
8695
+ function ContextMenuRoot(props) {
8696
+ const [anchor, setAnchor] = reactExports.useState({
8697
+ getBoundingClientRect() {
8698
+ return DOMRect.fromRect({
8699
+ width: 0,
8700
+ height: 0,
8701
+ x: 0,
8702
+ y: 0
8703
+ });
8704
+ }
8705
+ });
8706
+ const backdropRef = reactExports.useRef(null);
8707
+ const internalBackdropRef = reactExports.useRef(null);
8708
+ const actionsRef = reactExports.useRef(null);
8709
+ const positionerRef = reactExports.useRef(null);
8710
+ const allowMouseUpTriggerRef = reactExports.useRef(true);
8711
+ const initialCursorPointRef = reactExports.useRef(null);
8712
+ const id = useId();
8713
+ const contextValue = reactExports.useMemo(() => ({
8714
+ anchor,
8715
+ setAnchor,
8716
+ actionsRef,
8717
+ backdropRef,
8718
+ internalBackdropRef,
8719
+ positionerRef,
8720
+ allowMouseUpTriggerRef,
8721
+ initialCursorPointRef,
8722
+ rootId: id
8723
+ }), [anchor, id]);
8724
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRootContext.Provider, {
8725
+ value: contextValue,
8726
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRootContext.Provider, {
8727
+ value: void 0,
8728
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRoot, {
8729
+ ...props
8730
+ })
8731
+ })
8732
+ });
8733
+ }
8734
+ const LONG_PRESS_DELAY = 500;
8735
+ const ContextMenuTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(function ContextMenuTrigger(componentProps, forwardedRef) {
8736
+ const {
8737
+ render,
8738
+ className,
8739
+ ...elementProps
8740
+ } = componentProps;
8741
+ const {
8742
+ setAnchor,
8743
+ actionsRef,
8744
+ internalBackdropRef,
8745
+ backdropRef,
8746
+ positionerRef,
8747
+ allowMouseUpTriggerRef,
8748
+ initialCursorPointRef,
8749
+ rootId
8750
+ } = useContextMenuRootContext(false);
8751
+ const {
8752
+ store
8753
+ } = useMenuRootContext(false);
8754
+ const open = store.useState("open");
8755
+ const triggerRef = reactExports.useRef(null);
8756
+ const touchPositionRef = reactExports.useRef(null);
8757
+ const longPressTimeout = useTimeout();
8758
+ const allowMouseUpTimeout = useTimeout();
8759
+ const allowMouseUpRef = reactExports.useRef(false);
8760
+ function handleLongPress(x, y, event) {
8761
+ const isTouchEvent = event.type.startsWith("touch");
8762
+ initialCursorPointRef.current = {
8763
+ x,
8764
+ y
8765
+ };
8766
+ setAnchor({
8767
+ getBoundingClientRect() {
8768
+ return DOMRect.fromRect({
8769
+ width: isTouchEvent ? 10 : 0,
8770
+ height: isTouchEvent ? 10 : 0,
8771
+ x,
8772
+ y
8773
+ });
8774
+ }
8775
+ });
8776
+ allowMouseUpRef.current = false;
8777
+ actionsRef.current?.setOpen(true, createChangeEventDetails(triggerPress, event));
8778
+ allowMouseUpTimeout.start(LONG_PRESS_DELAY, () => {
8779
+ allowMouseUpRef.current = true;
8780
+ });
8781
+ }
8782
+ function handleContextMenu(event) {
8783
+ allowMouseUpTriggerRef.current = true;
8784
+ stopEvent(event);
8785
+ handleLongPress(event.clientX, event.clientY, event.nativeEvent);
8786
+ const doc = ownerDocument(triggerRef.current);
8787
+ doc.addEventListener("mouseup", (mouseEvent) => {
8788
+ allowMouseUpTriggerRef.current = false;
8789
+ if (!allowMouseUpRef.current) {
8790
+ return;
8791
+ }
8792
+ allowMouseUpTimeout.clear();
8793
+ allowMouseUpRef.current = false;
8794
+ const mouseUpTarget = getTarget(mouseEvent);
8795
+ if (contains(positionerRef.current, mouseUpTarget)) {
8796
+ return;
8797
+ }
8798
+ if (rootId && mouseUpTarget && findRootOwnerId(mouseUpTarget) === rootId) {
8799
+ return;
8800
+ }
8801
+ actionsRef.current?.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
8802
+ }, {
8803
+ once: true
8804
+ });
8805
+ }
8806
+ function handleTouchStart(event) {
8807
+ allowMouseUpTriggerRef.current = false;
8808
+ if (event.touches.length === 1) {
8809
+ event.stopPropagation();
8810
+ const touch = event.touches[0];
8811
+ touchPositionRef.current = {
8812
+ x: touch.clientX,
8813
+ y: touch.clientY
8814
+ };
8815
+ longPressTimeout.start(LONG_PRESS_DELAY, () => {
8816
+ if (touchPositionRef.current) {
8817
+ handleLongPress(touchPositionRef.current.x, touchPositionRef.current.y, event.nativeEvent);
8818
+ }
8819
+ });
8820
+ }
8821
+ }
8822
+ function handleTouchMove(event) {
8823
+ if (longPressTimeout.isStarted() && touchPositionRef.current && event.touches.length === 1) {
8824
+ const touch = event.touches[0];
8825
+ const moveThreshold = 10;
8826
+ const deltaX = Math.abs(touch.clientX - touchPositionRef.current.x);
8827
+ const deltaY = Math.abs(touch.clientY - touchPositionRef.current.y);
8828
+ if (deltaX > moveThreshold || deltaY > moveThreshold) {
8829
+ longPressTimeout.clear();
8830
+ }
8831
+ }
8832
+ }
8833
+ function handleTouchEnd() {
8834
+ longPressTimeout.clear();
8835
+ touchPositionRef.current = null;
8836
+ }
8837
+ reactExports.useEffect(() => {
8838
+ function handleDocumentContextMenu(event) {
8839
+ const target = getTarget(event);
8840
+ const targetElement = target;
8841
+ if (contains(triggerRef.current, targetElement) || contains(internalBackdropRef.current, targetElement) || contains(backdropRef.current, targetElement)) {
8842
+ event.preventDefault();
8843
+ }
8844
+ }
8845
+ const doc = ownerDocument(triggerRef.current);
8846
+ doc.addEventListener("contextmenu", handleDocumentContextMenu);
8847
+ return () => {
8848
+ doc.removeEventListener("contextmenu", handleDocumentContextMenu);
8849
+ };
8850
+ }, [backdropRef, internalBackdropRef]);
8851
+ const state = reactExports.useMemo(() => ({
8852
+ open
8853
+ }), [open]);
8854
+ const element = useRenderElement("div", componentProps, {
8855
+ state,
8856
+ ref: [triggerRef, forwardedRef],
8857
+ props: [{
8858
+ onContextMenu: handleContextMenu,
8859
+ onTouchStart: handleTouchStart,
8860
+ onTouchMove: handleTouchMove,
8861
+ onTouchEnd: handleTouchEnd,
8862
+ onTouchCancel: handleTouchEnd,
8863
+ style: {
8864
+ WebkitTouchCallout: "none"
8865
+ }
8866
+ }, elementProps],
8867
+ stateAttributesMapping: pressableTriggerOpenStateMapping
8868
+ });
8869
+ return element;
8870
+ });
8871
+ if (process.env.NODE_ENV !== "production") ContextMenuTrigger$1.displayName = "ContextMenuTrigger";
8872
+ function ContextMenu({ ...props }) {
8873
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRoot, { ...props });
8874
+ }
8875
+ function ContextMenuTrigger2(props) {
8876
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger$1, { ...props });
8877
+ }
8878
+ const menuVariants = cva(
8879
+ "min-w-50 origin-(--transform-origin) rounded-md bg-popover p-1 text-popover-foreground shadow-lg border transition-opacity data-ending-style:opacity-0"
8880
+ );
8881
+ function ContextMenuContent({
8882
+ className,
8883
+ align = "start",
8884
+ alignOffset = 4,
8885
+ side = "right",
8886
+ sideOffset = 0,
8887
+ ...props
8888
+ }) {
8889
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
8890
+ MenuPositioner,
8891
+ {
8892
+ className: "outline-none z-40",
8893
+ align,
8894
+ alignOffset,
8895
+ side,
8896
+ sideOffset,
8897
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPopup, { className: cn(menuVariants(), className), ...props })
9180
8898
  }
9181
- });
9182
- const backdropRef = reactExports.useRef(null);
9183
- const internalBackdropRef = reactExports.useRef(null);
9184
- const actionsRef = reactExports.useRef(null);
9185
- const positionerRef = reactExports.useRef(null);
9186
- const allowMouseUpTriggerRef = reactExports.useRef(true);
9187
- const initialCursorPointRef = reactExports.useRef(null);
9188
- const id = useId();
9189
- const contextValue = reactExports.useMemo(() => ({
9190
- anchor,
9191
- setAnchor,
9192
- actionsRef,
9193
- backdropRef,
9194
- internalBackdropRef,
9195
- positionerRef,
9196
- allowMouseUpTriggerRef,
9197
- initialCursorPointRef,
9198
- rootId: id
9199
- }), [anchor, id]);
9200
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRootContext.Provider, {
9201
- value: contextValue,
9202
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRootContext.Provider, {
9203
- value: void 0,
9204
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuRoot, {
9205
- ...props
9206
- })
9207
- })
9208
- });
8899
+ ) });
9209
8900
  }
9210
- const LONG_PRESS_DELAY = 500;
9211
- const ContextMenuTrigger$1 = /* @__PURE__ */ reactExports.forwardRef(function ContextMenuTrigger(componentProps, forwardedRef) {
9212
- const {
9213
- render,
9214
- className,
9215
- ...elementProps
9216
- } = componentProps;
8901
+ function ContextMenuGroup({ ...props }) {
8902
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuGroup, { ...props });
8903
+ }
8904
+ const menuItemVariants = cva(
8905
+ "flex group/context-menu-item gap-2 items-center font-medium px-3 py-2 text-sm leading-4 rounded-lg outline-none select-none [&_svg]:shrink-0 [&_svg]:size-4",
8906
+ {
8907
+ variants: {
8908
+ variant: {
8909
+ destructive: "text-destructive data-highlighted:bg-destructive/20",
8910
+ default: "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
8911
+ }
8912
+ },
8913
+ defaultVariants: {
8914
+ variant: "default"
8915
+ }
8916
+ }
8917
+ );
8918
+ function ContextMenuItem({
8919
+ className,
8920
+ inset,
8921
+ variant = "default",
8922
+ ...props
8923
+ }) {
8924
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
8925
+ MenuItem,
8926
+ {
8927
+ "data-inset": inset,
8928
+ "data-variant": variant,
8929
+ className: cn(menuItemVariants({ variant }), className),
8930
+ ...props
8931
+ }
8932
+ );
8933
+ }
8934
+ function ContextMenuSub({ ...props }) {
8935
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSubmenuRoot, { ...props });
8936
+ }
8937
+ function ContextMenuSubTrigger({
8938
+ className,
8939
+ children,
8940
+ ...props
8941
+ }) {
8942
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSubmenuTrigger, { className: cn(menuItemVariants(), className), ...props, children: [
8943
+ children,
8944
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "ms-auto text-muted-foreground" })
8945
+ ] });
8946
+ }
8947
+ function ContextMenuSubContent({
8948
+ className,
8949
+ ...props
8950
+ }) {
8951
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuContent, { className: cn(menuVariants(), className), ...props });
8952
+ }
8953
+ var [createTooltipContext] = createContextScope("Tooltip", [
8954
+ createPopperScope
8955
+ ]);
8956
+ var usePopperScope = createPopperScope();
8957
+ var PROVIDER_NAME = "TooltipProvider";
8958
+ var DEFAULT_DELAY_DURATION = 700;
8959
+ var TOOLTIP_OPEN = "tooltip.open";
8960
+ var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
8961
+ var TooltipProvider$1 = (props) => {
9217
8962
  const {
9218
- setAnchor,
9219
- actionsRef,
9220
- internalBackdropRef,
9221
- backdropRef,
9222
- positionerRef,
9223
- allowMouseUpTriggerRef,
9224
- initialCursorPointRef,
9225
- rootId
9226
- } = useContextMenuRootContext(false);
8963
+ __scopeTooltip,
8964
+ delayDuration = DEFAULT_DELAY_DURATION,
8965
+ skipDelayDuration = 300,
8966
+ disableHoverableContent = false,
8967
+ children
8968
+ } = props;
8969
+ const isOpenDelayedRef = reactExports.useRef(true);
8970
+ const isPointerInTransitRef = reactExports.useRef(false);
8971
+ const skipDelayTimerRef = reactExports.useRef(0);
8972
+ reactExports.useEffect(() => {
8973
+ const skipDelayTimer = skipDelayTimerRef.current;
8974
+ return () => window.clearTimeout(skipDelayTimer);
8975
+ }, []);
8976
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
8977
+ TooltipProviderContextProvider,
8978
+ {
8979
+ scope: __scopeTooltip,
8980
+ isOpenDelayedRef,
8981
+ delayDuration,
8982
+ onOpen: reactExports.useCallback(() => {
8983
+ window.clearTimeout(skipDelayTimerRef.current);
8984
+ isOpenDelayedRef.current = false;
8985
+ }, []),
8986
+ onClose: reactExports.useCallback(() => {
8987
+ window.clearTimeout(skipDelayTimerRef.current);
8988
+ skipDelayTimerRef.current = window.setTimeout(
8989
+ () => isOpenDelayedRef.current = true,
8990
+ skipDelayDuration
8991
+ );
8992
+ }, [skipDelayDuration]),
8993
+ isPointerInTransitRef,
8994
+ onPointerInTransitChange: reactExports.useCallback((inTransit) => {
8995
+ isPointerInTransitRef.current = inTransit;
8996
+ }, []),
8997
+ disableHoverableContent,
8998
+ children
8999
+ }
9000
+ );
9001
+ };
9002
+ TooltipProvider$1.displayName = PROVIDER_NAME;
9003
+ var TOOLTIP_NAME = "Tooltip";
9004
+ var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
9005
+ var Tooltip$1 = (props) => {
9227
9006
  const {
9228
- store
9229
- } = useMenuRootContext(false);
9230
- const open = store.useState("open");
9231
- const triggerRef = reactExports.useRef(null);
9232
- const touchPositionRef = reactExports.useRef(null);
9233
- const longPressTimeout = useTimeout();
9234
- const allowMouseUpTimeout = useTimeout();
9235
- const allowMouseUpRef = reactExports.useRef(false);
9236
- function handleLongPress(x, y, event) {
9237
- const isTouchEvent = event.type.startsWith("touch");
9238
- initialCursorPointRef.current = {
9239
- x,
9240
- y
9007
+ __scopeTooltip,
9008
+ children,
9009
+ open: openProp,
9010
+ defaultOpen,
9011
+ onOpenChange,
9012
+ disableHoverableContent: disableHoverableContentProp,
9013
+ delayDuration: delayDurationProp
9014
+ } = props;
9015
+ const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
9016
+ const popperScope = usePopperScope(__scopeTooltip);
9017
+ const [trigger, setTrigger] = reactExports.useState(null);
9018
+ const contentId = useId$1();
9019
+ const openTimerRef = reactExports.useRef(0);
9020
+ const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
9021
+ const delayDuration = delayDurationProp ?? providerContext.delayDuration;
9022
+ const wasOpenDelayedRef = reactExports.useRef(false);
9023
+ const [open, setOpen] = useControllableState({
9024
+ prop: openProp,
9025
+ defaultProp: defaultOpen ?? false,
9026
+ onChange: (open2) => {
9027
+ if (open2) {
9028
+ providerContext.onOpen();
9029
+ document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
9030
+ } else {
9031
+ providerContext.onClose();
9032
+ }
9033
+ onOpenChange?.(open2);
9034
+ },
9035
+ caller: TOOLTIP_NAME
9036
+ });
9037
+ const stateAttribute = reactExports.useMemo(() => {
9038
+ return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
9039
+ }, [open]);
9040
+ const handleOpen = reactExports.useCallback(() => {
9041
+ window.clearTimeout(openTimerRef.current);
9042
+ openTimerRef.current = 0;
9043
+ wasOpenDelayedRef.current = false;
9044
+ setOpen(true);
9045
+ }, [setOpen]);
9046
+ const handleClose = reactExports.useCallback(() => {
9047
+ window.clearTimeout(openTimerRef.current);
9048
+ openTimerRef.current = 0;
9049
+ setOpen(false);
9050
+ }, [setOpen]);
9051
+ const handleDelayedOpen = reactExports.useCallback(() => {
9052
+ window.clearTimeout(openTimerRef.current);
9053
+ openTimerRef.current = window.setTimeout(() => {
9054
+ wasOpenDelayedRef.current = true;
9055
+ setOpen(true);
9056
+ openTimerRef.current = 0;
9057
+ }, delayDuration);
9058
+ }, [delayDuration, setOpen]);
9059
+ reactExports.useEffect(() => {
9060
+ return () => {
9061
+ if (openTimerRef.current) {
9062
+ window.clearTimeout(openTimerRef.current);
9063
+ openTimerRef.current = 0;
9064
+ }
9241
9065
  };
9242
- setAnchor({
9243
- getBoundingClientRect() {
9244
- return DOMRect.fromRect({
9245
- width: isTouchEvent ? 10 : 0,
9246
- height: isTouchEvent ? 10 : 0,
9247
- x,
9248
- y
9249
- });
9066
+ }, []);
9067
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
9068
+ TooltipContextProvider,
9069
+ {
9070
+ scope: __scopeTooltip,
9071
+ contentId,
9072
+ open,
9073
+ stateAttribute,
9074
+ trigger,
9075
+ onTriggerChange: setTrigger,
9076
+ onTriggerEnter: reactExports.useCallback(() => {
9077
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
9078
+ else handleOpen();
9079
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
9080
+ onTriggerLeave: reactExports.useCallback(() => {
9081
+ if (disableHoverableContent) {
9082
+ handleClose();
9083
+ } else {
9084
+ window.clearTimeout(openTimerRef.current);
9085
+ openTimerRef.current = 0;
9086
+ }
9087
+ }, [handleClose, disableHoverableContent]),
9088
+ onOpen: handleOpen,
9089
+ onClose: handleClose,
9090
+ disableHoverableContent,
9091
+ children
9092
+ }
9093
+ ) });
9094
+ };
9095
+ Tooltip$1.displayName = TOOLTIP_NAME;
9096
+ var TRIGGER_NAME = "TooltipTrigger";
9097
+ var TooltipTrigger$1 = reactExports.forwardRef(
9098
+ (props, forwardedRef) => {
9099
+ const { __scopeTooltip, ...triggerProps } = props;
9100
+ const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
9101
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
9102
+ const popperScope = usePopperScope(__scopeTooltip);
9103
+ const ref = reactExports.useRef(null);
9104
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
9105
+ const isPointerDownRef = reactExports.useRef(false);
9106
+ const hasPointerMoveOpenedRef = reactExports.useRef(false);
9107
+ const handlePointerUp = reactExports.useCallback(() => isPointerDownRef.current = false, []);
9108
+ reactExports.useEffect(() => {
9109
+ return () => document.removeEventListener("pointerup", handlePointerUp);
9110
+ }, [handlePointerUp]);
9111
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
9112
+ Primitive.button,
9113
+ {
9114
+ "aria-describedby": context.open ? context.contentId : void 0,
9115
+ "data-state": context.stateAttribute,
9116
+ ...triggerProps,
9117
+ ref: composedRefs,
9118
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
9119
+ if (event.pointerType === "touch") return;
9120
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
9121
+ context.onTriggerEnter();
9122
+ hasPointerMoveOpenedRef.current = true;
9123
+ }
9124
+ }),
9125
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
9126
+ context.onTriggerLeave();
9127
+ hasPointerMoveOpenedRef.current = false;
9128
+ }),
9129
+ onPointerDown: composeEventHandlers(props.onPointerDown, () => {
9130
+ if (context.open) {
9131
+ context.onClose();
9132
+ }
9133
+ isPointerDownRef.current = true;
9134
+ document.addEventListener("pointerup", handlePointerUp, { once: true });
9135
+ }),
9136
+ onFocus: composeEventHandlers(props.onFocus, () => {
9137
+ if (!isPointerDownRef.current) context.onOpen();
9138
+ }),
9139
+ onBlur: composeEventHandlers(props.onBlur, context.onClose),
9140
+ onClick: composeEventHandlers(props.onClick, context.onClose)
9250
9141
  }
9251
- });
9252
- allowMouseUpRef.current = false;
9253
- actionsRef.current?.setOpen(true, createChangeEventDetails(triggerPress, event));
9254
- allowMouseUpTimeout.start(LONG_PRESS_DELAY, () => {
9255
- allowMouseUpRef.current = true;
9256
- });
9142
+ ) });
9257
9143
  }
9258
- function handleContextMenu(event) {
9259
- allowMouseUpTriggerRef.current = true;
9260
- stopEvent(event);
9261
- handleLongPress(event.clientX, event.clientY, event.nativeEvent);
9262
- const doc = ownerDocument(triggerRef.current);
9263
- doc.addEventListener("mouseup", (mouseEvent) => {
9264
- allowMouseUpTriggerRef.current = false;
9265
- if (!allowMouseUpRef.current) {
9266
- return;
9267
- }
9268
- allowMouseUpTimeout.clear();
9269
- allowMouseUpRef.current = false;
9270
- const mouseUpTarget = getTarget(mouseEvent);
9271
- if (contains(positionerRef.current, mouseUpTarget)) {
9272
- return;
9273
- }
9274
- if (rootId && mouseUpTarget && findRootOwnerId(mouseUpTarget) === rootId) {
9275
- return;
9276
- }
9277
- actionsRef.current?.setOpen(false, createChangeEventDetails(cancelOpen, mouseEvent));
9278
- }, {
9279
- once: true
9280
- });
9144
+ );
9145
+ TooltipTrigger$1.displayName = TRIGGER_NAME;
9146
+ var PORTAL_NAME = "TooltipPortal";
9147
+ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
9148
+ forceMount: void 0
9149
+ });
9150
+ var TooltipPortal = (props) => {
9151
+ const { __scopeTooltip, forceMount, children, container } = props;
9152
+ const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
9153
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$2, { asChild: true, container, children }) }) });
9154
+ };
9155
+ TooltipPortal.displayName = PORTAL_NAME;
9156
+ var CONTENT_NAME = "TooltipContent";
9157
+ var TooltipContent$1 = reactExports.forwardRef(
9158
+ (props, forwardedRef) => {
9159
+ const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
9160
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
9161
+ const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
9162
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
9281
9163
  }
9282
- function handleTouchStart(event) {
9283
- allowMouseUpTriggerRef.current = false;
9284
- if (event.touches.length === 1) {
9285
- event.stopPropagation();
9286
- const touch = event.touches[0];
9287
- touchPositionRef.current = {
9288
- x: touch.clientX,
9289
- y: touch.clientY
9164
+ );
9165
+ var TooltipContentHoverable = reactExports.forwardRef((props, forwardedRef) => {
9166
+ const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
9167
+ const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
9168
+ const ref = reactExports.useRef(null);
9169
+ const composedRefs = useComposedRefs(forwardedRef, ref);
9170
+ const [pointerGraceArea, setPointerGraceArea] = reactExports.useState(null);
9171
+ const { trigger, onClose } = context;
9172
+ const content = ref.current;
9173
+ const { onPointerInTransitChange } = providerContext;
9174
+ const handleRemoveGraceArea = reactExports.useCallback(() => {
9175
+ setPointerGraceArea(null);
9176
+ onPointerInTransitChange(false);
9177
+ }, [onPointerInTransitChange]);
9178
+ const handleCreateGraceArea = reactExports.useCallback(
9179
+ (event, hoverTarget) => {
9180
+ const currentTarget = event.currentTarget;
9181
+ const exitPoint = { x: event.clientX, y: event.clientY };
9182
+ const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
9183
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
9184
+ const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
9185
+ const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
9186
+ setPointerGraceArea(graceArea);
9187
+ onPointerInTransitChange(true);
9188
+ },
9189
+ [onPointerInTransitChange]
9190
+ );
9191
+ reactExports.useEffect(() => {
9192
+ return () => handleRemoveGraceArea();
9193
+ }, [handleRemoveGraceArea]);
9194
+ reactExports.useEffect(() => {
9195
+ if (trigger && content) {
9196
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
9197
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
9198
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
9199
+ content.addEventListener("pointerleave", handleContentLeave);
9200
+ return () => {
9201
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
9202
+ content.removeEventListener("pointerleave", handleContentLeave);
9290
9203
  };
9291
- longPressTimeout.start(LONG_PRESS_DELAY, () => {
9292
- if (touchPositionRef.current) {
9293
- handleLongPress(touchPositionRef.current.x, touchPositionRef.current.y, event.nativeEvent);
9204
+ }
9205
+ }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
9206
+ reactExports.useEffect(() => {
9207
+ if (pointerGraceArea) {
9208
+ const handleTrackPointerGrace = (event) => {
9209
+ const target = event.target;
9210
+ const pointerPosition = { x: event.clientX, y: event.clientY };
9211
+ const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
9212
+ const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
9213
+ if (hasEnteredTarget) {
9214
+ handleRemoveGraceArea();
9215
+ } else if (isPointerOutsideGraceArea) {
9216
+ handleRemoveGraceArea();
9217
+ onClose();
9294
9218
  }
9295
- });
9219
+ };
9220
+ document.addEventListener("pointermove", handleTrackPointerGrace);
9221
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
9296
9222
  }
9297
- }
9298
- function handleTouchMove(event) {
9299
- if (longPressTimeout.isStarted() && touchPositionRef.current && event.touches.length === 1) {
9300
- const touch = event.touches[0];
9301
- const moveThreshold = 10;
9302
- const deltaX = Math.abs(touch.clientX - touchPositionRef.current.x);
9303
- const deltaY = Math.abs(touch.clientY - touchPositionRef.current.y);
9304
- if (deltaX > moveThreshold || deltaY > moveThreshold) {
9305
- longPressTimeout.clear();
9223
+ }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
9224
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
9225
+ });
9226
+ var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
9227
+ var Slottable = createSlottable("TooltipContent");
9228
+ var TooltipContentImpl = reactExports.forwardRef(
9229
+ (props, forwardedRef) => {
9230
+ const {
9231
+ __scopeTooltip,
9232
+ children,
9233
+ "aria-label": ariaLabel,
9234
+ onEscapeKeyDown,
9235
+ onPointerDownOutside,
9236
+ ...contentProps
9237
+ } = props;
9238
+ const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
9239
+ const popperScope = usePopperScope(__scopeTooltip);
9240
+ const { onClose } = context;
9241
+ reactExports.useEffect(() => {
9242
+ document.addEventListener(TOOLTIP_OPEN, onClose);
9243
+ return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
9244
+ }, [onClose]);
9245
+ reactExports.useEffect(() => {
9246
+ if (context.trigger) {
9247
+ const handleScroll = (event) => {
9248
+ const target = event.target;
9249
+ if (target?.contains(context.trigger)) onClose();
9250
+ };
9251
+ window.addEventListener("scroll", handleScroll, { capture: true });
9252
+ return () => window.removeEventListener("scroll", handleScroll, { capture: true });
9253
+ }
9254
+ }, [context.trigger, onClose]);
9255
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
9256
+ DismissableLayer,
9257
+ {
9258
+ asChild: true,
9259
+ disableOutsidePointerEvents: false,
9260
+ onEscapeKeyDown,
9261
+ onPointerDownOutside,
9262
+ onFocusOutside: (event) => event.preventDefault(),
9263
+ onDismiss: onClose,
9264
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
9265
+ Content$1,
9266
+ {
9267
+ "data-state": context.stateAttribute,
9268
+ ...popperScope,
9269
+ ...contentProps,
9270
+ ref: forwardedRef,
9271
+ style: {
9272
+ ...contentProps.style,
9273
+ // re-namespace exposed content custom properties
9274
+ ...{
9275
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
9276
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
9277
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
9278
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
9279
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
9280
+ }
9281
+ },
9282
+ children: [
9283
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Slottable, { children }),
9284
+ /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root$1, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
9285
+ ]
9286
+ }
9287
+ )
9306
9288
  }
9307
- }
9289
+ );
9308
9290
  }
9309
- function handleTouchEnd() {
9310
- longPressTimeout.clear();
9311
- touchPositionRef.current = null;
9291
+ );
9292
+ TooltipContent$1.displayName = CONTENT_NAME;
9293
+ var ARROW_NAME = "TooltipArrow";
9294
+ var TooltipArrow = reactExports.forwardRef(
9295
+ (props, forwardedRef) => {
9296
+ const { __scopeTooltip, ...arrowProps } = props;
9297
+ const popperScope = usePopperScope(__scopeTooltip);
9298
+ const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
9299
+ ARROW_NAME,
9300
+ __scopeTooltip
9301
+ );
9302
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
9303
+ }
9304
+ );
9305
+ TooltipArrow.displayName = ARROW_NAME;
9306
+ function getExitSideFromRect(point, rect) {
9307
+ const top = Math.abs(rect.top - point.y);
9308
+ const bottom = Math.abs(rect.bottom - point.y);
9309
+ const right = Math.abs(rect.right - point.x);
9310
+ const left = Math.abs(rect.left - point.x);
9311
+ switch (Math.min(top, bottom, right, left)) {
9312
+ case left:
9313
+ return "left";
9314
+ case right:
9315
+ return "right";
9316
+ case top:
9317
+ return "top";
9318
+ case bottom:
9319
+ return "bottom";
9320
+ default:
9321
+ throw new Error("unreachable");
9312
9322
  }
9313
- reactExports.useEffect(() => {
9314
- function handleDocumentContextMenu(event) {
9315
- const target = getTarget(event);
9316
- const targetElement = target;
9317
- if (contains(triggerRef.current, targetElement) || contains(internalBackdropRef.current, targetElement) || contains(backdropRef.current, targetElement)) {
9318
- event.preventDefault();
9319
- }
9320
- }
9321
- const doc = ownerDocument(triggerRef.current);
9322
- doc.addEventListener("contextmenu", handleDocumentContextMenu);
9323
- return () => {
9324
- doc.removeEventListener("contextmenu", handleDocumentContextMenu);
9325
- };
9326
- }, [backdropRef, internalBackdropRef]);
9327
- const state = reactExports.useMemo(() => ({
9328
- open
9329
- }), [open]);
9330
- const element = useRenderElement("div", componentProps, {
9331
- state,
9332
- ref: [triggerRef, forwardedRef],
9333
- props: [{
9334
- onContextMenu: handleContextMenu,
9335
- onTouchStart: handleTouchStart,
9336
- onTouchMove: handleTouchMove,
9337
- onTouchEnd: handleTouchEnd,
9338
- onTouchCancel: handleTouchEnd,
9339
- style: {
9340
- WebkitTouchCallout: "none"
9341
- }
9342
- }, elementProps],
9343
- stateAttributesMapping: pressableTriggerOpenStateMapping
9344
- });
9345
- return element;
9346
- });
9347
- if (process.env.NODE_ENV !== "production") ContextMenuTrigger$1.displayName = "ContextMenuTrigger";
9348
- function ContextMenu({ ...props }) {
9349
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuRoot, { ...props });
9350
9323
  }
9351
- function ContextMenuTrigger2(props) {
9352
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuTrigger$1, { ...props });
9324
+ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
9325
+ const paddedExitPoints = [];
9326
+ switch (exitSide) {
9327
+ case "top":
9328
+ paddedExitPoints.push(
9329
+ { x: exitPoint.x - padding, y: exitPoint.y + padding },
9330
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
9331
+ );
9332
+ break;
9333
+ case "bottom":
9334
+ paddedExitPoints.push(
9335
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
9336
+ { x: exitPoint.x + padding, y: exitPoint.y - padding }
9337
+ );
9338
+ break;
9339
+ case "left":
9340
+ paddedExitPoints.push(
9341
+ { x: exitPoint.x + padding, y: exitPoint.y - padding },
9342
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
9343
+ );
9344
+ break;
9345
+ case "right":
9346
+ paddedExitPoints.push(
9347
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
9348
+ { x: exitPoint.x - padding, y: exitPoint.y + padding }
9349
+ );
9350
+ break;
9351
+ }
9352
+ return paddedExitPoints;
9353
9353
  }
9354
- const menuVariants = cva(
9355
- "min-w-50 origin-(--transform-origin) rounded-md bg-popover p-1 text-popover-foreground shadow-lg border transition-opacity data-ending-style:opacity-0"
9356
- );
9357
- function ContextMenuContent({
9358
- className,
9359
- align = "start",
9360
- alignOffset = 4,
9361
- side = "right",
9362
- sideOffset = 0,
9363
- ...props
9364
- }) {
9365
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPortal, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
9366
- MenuPositioner,
9367
- {
9368
- className: "outline-none z-40",
9369
- align,
9370
- alignOffset,
9371
- side,
9372
- sideOffset,
9373
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuPopup, { className: cn(menuVariants(), className), ...props })
9374
- }
9375
- ) });
9354
+ function getPointsFromRect(rect) {
9355
+ const { top, right, bottom, left } = rect;
9356
+ return [
9357
+ { x: left, y: top },
9358
+ { x: right, y: top },
9359
+ { x: right, y: bottom },
9360
+ { x: left, y: bottom }
9361
+ ];
9376
9362
  }
9377
- function ContextMenuGroup({ ...props }) {
9378
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuGroup, { ...props });
9363
+ function isPointInPolygon(point, polygon) {
9364
+ const { x, y } = point;
9365
+ let inside = false;
9366
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
9367
+ const ii = polygon[i];
9368
+ const jj = polygon[j];
9369
+ const xi = ii.x;
9370
+ const yi = ii.y;
9371
+ const xj = jj.x;
9372
+ const yj = jj.y;
9373
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
9374
+ if (intersect) inside = !inside;
9375
+ }
9376
+ return inside;
9379
9377
  }
9380
- const menuItemVariants = cva(
9381
- "flex group/context-menu-item gap-2 items-center font-medium px-3 py-2 text-sm leading-4 rounded-lg outline-none select-none [&_svg]:shrink-0 [&_svg]:size-4",
9382
- {
9383
- variants: {
9384
- variant: {
9385
- destructive: "text-destructive data-highlighted:bg-destructive/20",
9386
- default: "data-highlighted:bg-accent data-highlighted:text-accent-foreground"
9387
- }
9388
- },
9389
- defaultVariants: {
9390
- variant: "default"
9378
+ function getHull(points) {
9379
+ const newPoints = points.slice();
9380
+ newPoints.sort((a, b) => {
9381
+ if (a.x < b.x) return -1;
9382
+ else if (a.x > b.x) return 1;
9383
+ else if (a.y < b.y) return -1;
9384
+ else if (a.y > b.y) return 1;
9385
+ else return 0;
9386
+ });
9387
+ return getHullPresorted(newPoints);
9388
+ }
9389
+ function getHullPresorted(points) {
9390
+ if (points.length <= 1) return points.slice();
9391
+ const upperHull = [];
9392
+ for (let i = 0; i < points.length; i++) {
9393
+ const p = points[i];
9394
+ while (upperHull.length >= 2) {
9395
+ const q = upperHull[upperHull.length - 1];
9396
+ const r = upperHull[upperHull.length - 2];
9397
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
9398
+ else break;
9391
9399
  }
9400
+ upperHull.push(p);
9392
9401
  }
9393
- );
9394
- function ContextMenuItem({
9395
- className,
9396
- inset,
9397
- variant = "default",
9398
- ...props
9399
- }) {
9400
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
9401
- MenuItem,
9402
- {
9403
- "data-inset": inset,
9404
- "data-variant": variant,
9405
- className: cn(menuItemVariants({ variant }), className),
9406
- ...props
9402
+ upperHull.pop();
9403
+ const lowerHull = [];
9404
+ for (let i = points.length - 1; i >= 0; i--) {
9405
+ const p = points[i];
9406
+ while (lowerHull.length >= 2) {
9407
+ const q = lowerHull[lowerHull.length - 1];
9408
+ const r = lowerHull[lowerHull.length - 2];
9409
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
9410
+ else break;
9407
9411
  }
9408
- );
9409
- }
9410
- function ContextMenuSub({ ...props }) {
9411
- return /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSubmenuRoot, { ...props });
9412
- }
9413
- function ContextMenuSubTrigger({
9414
- className,
9415
- children,
9416
- ...props
9417
- }) {
9418
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSubmenuTrigger, { className: cn(menuItemVariants(), className), ...props, children: [
9419
- children,
9420
- /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "ms-auto text-muted-foreground" })
9421
- ] });
9422
- }
9423
- function ContextMenuSubContent({
9424
- className,
9425
- ...props
9426
- }) {
9427
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ContextMenuContent, { className: cn(menuVariants(), className), ...props });
9412
+ lowerHull.push(p);
9413
+ }
9414
+ lowerHull.pop();
9415
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
9416
+ return upperHull;
9417
+ } else {
9418
+ return upperHull.concat(lowerHull);
9419
+ }
9428
9420
  }
9421
+ var Provider = TooltipProvider$1;
9422
+ var Root3 = Tooltip$1;
9423
+ var Trigger = TooltipTrigger$1;
9424
+ var Portal = TooltipPortal;
9425
+ var Content2 = TooltipContent$1;
9426
+ var Arrow2 = TooltipArrow;
9429
9427
  function TooltipProvider({
9430
9428
  delayDuration = 0,
9431
9429
  ...props
@@ -9469,85 +9467,84 @@ function TooltipContent({
9469
9467
  ) });
9470
9468
  }
9471
9469
  export {
9472
- contains as $,
9473
- useStore as A,
9474
- useValueAsRef as B,
9470
+ pressableTriggerOpenStateMapping as $,
9471
+ createGenericEventDetails as A,
9472
+ inputClear as B,
9475
9473
  Content as C,
9476
- Description as D,
9474
+ inputChange as D,
9477
9475
  EMPTY_OBJECT as E,
9478
- useTransitionStatus as F,
9479
- useOpenInteractionType as G,
9480
- createGenericEventDetails as H,
9481
- inputClear as I,
9482
- inputChange as J,
9483
- createChangeEventDetails as K,
9484
- focusOut as L,
9485
- outsidePress as M,
9476
+ createChangeEventDetails as F,
9477
+ focusOut as G,
9478
+ outsidePress as H,
9479
+ getTarget as I,
9480
+ itemPress as J,
9481
+ none as K,
9482
+ useOpenChangeComplete as L,
9483
+ useFloatingRootContext as M,
9486
9484
  NOOP as N,
9487
9485
  Overlay as O,
9488
9486
  Portal$1 as P,
9489
- getTarget as Q,
9487
+ useClick as Q,
9490
9488
  Root as R,
9491
9489
  Store as S,
9492
- Title as T,
9493
- itemPress as U,
9494
- none as V,
9495
- WarningProvider as W,
9496
- useOpenChangeComplete as X,
9497
- useFloatingRootContext as Y,
9498
- useClick as Z,
9499
- useDismiss as _,
9500
- Close as a,
9501
- useListNavigation as a0,
9502
- useInteractions as a1,
9503
- useMergedRefs as a2,
9504
- visuallyHiddenInput as a3,
9505
- visuallyHidden as a4,
9506
- pressableTriggerOpenStateMapping as a5,
9507
- useDirection as a6,
9508
- useRenderElement as a7,
9509
- stopEvent as a8,
9510
- isFirefox as a9,
9511
- escapeKey as aa,
9512
- isAndroid as ab,
9513
- CompositeList as ac,
9514
- FloatingPortal as ad,
9515
- DROPDOWN_COLLISION_AVOIDANCE as ae,
9516
- useAnchorPositioning as af,
9517
- useScrollLock as ag,
9518
- InternalBackdrop as ah,
9519
- inertValue as ai,
9520
- popupStateMapping as aj,
9521
- FloatingFocusManager as ak,
9522
- transitionStatusMapping as al,
9523
- getDisabledMountTransitionStyles as am,
9524
- useCompositeListItem as an,
9525
- IndexGuessBehavior as ao,
9526
- useButton as ap,
9527
- ChevronRight as aq,
9528
- Trigger$1 as b,
9529
- createDialogScope as c,
9530
- ContextMenu as d,
9531
- ContextMenuTrigger2 as e,
9532
- ContextMenuContent as f,
9533
- ContextMenuGroup as g,
9534
- ContextMenuItem as h,
9535
- ContextMenuSub as i,
9536
- ContextMenuSubTrigger as j,
9537
- ContextMenuSubContent as k,
9538
- Tooltip as l,
9539
- TooltipTrigger as m,
9540
- Portal as n,
9541
- Content2 as o,
9542
- TooltipProvider as p,
9543
- TooltipContent as q,
9544
- formatErrorMessage as r,
9490
+ Tooltip as T,
9491
+ useDismiss as U,
9492
+ contains as V,
9493
+ useListNavigation as W,
9494
+ useInteractions as X,
9495
+ useMergedRefs as Y,
9496
+ visuallyHiddenInput as Z,
9497
+ visuallyHidden as _,
9498
+ ContextMenu as a,
9499
+ useDirection as a0,
9500
+ useRenderElement as a1,
9501
+ stopEvent as a2,
9502
+ isFirefox as a3,
9503
+ escapeKey as a4,
9504
+ isAndroid as a5,
9505
+ CompositeList as a6,
9506
+ FloatingPortal as a7,
9507
+ DROPDOWN_COLLISION_AVOIDANCE as a8,
9508
+ useAnchorPositioning as a9,
9509
+ useScrollLock as aa,
9510
+ InternalBackdrop as ab,
9511
+ inertValue as ac,
9512
+ popupStateMapping as ad,
9513
+ FloatingFocusManager as ae,
9514
+ transitionStatusMapping as af,
9515
+ getDisabledMountTransitionStyles as ag,
9516
+ useCompositeListItem as ah,
9517
+ IndexGuessBehavior as ai,
9518
+ useButton as aj,
9519
+ WarningProvider as ak,
9520
+ createDialogScope as al,
9521
+ Title as am,
9522
+ Description as an,
9523
+ Close as ao,
9524
+ Trigger$1 as ap,
9525
+ ContextMenuTrigger2 as b,
9526
+ ContextMenuContent as c,
9527
+ ContextMenuGroup as d,
9528
+ ContextMenuItem as e,
9529
+ ContextMenuSub as f,
9530
+ ContextMenuSubTrigger as g,
9531
+ ContextMenuSubContent as h,
9532
+ TooltipTrigger as i,
9533
+ Portal as j,
9534
+ Content2 as k,
9535
+ TooltipProvider as l,
9536
+ TooltipContent as m,
9537
+ formatErrorMessage as n,
9538
+ createSelector as o,
9539
+ useStableCallback as p,
9540
+ useIsoLayoutEffect as q,
9541
+ useBaseUiId as r,
9545
9542
  shimExports as s,
9546
- createSelector as t,
9543
+ EMPTY_ARRAY as t,
9547
9544
  useSyncExternalStoreExports as u,
9548
- useStableCallback as v,
9549
- useIsoLayoutEffect as w,
9550
- useBaseUiId as x,
9551
- EMPTY_ARRAY as y,
9552
- useRefWithInit as z
9545
+ useRefWithInit as v,
9546
+ useStore as w,
9547
+ useValueAsRef as x,
9548
+ useTransitionStatus as y,
9549
+ useOpenInteractionType as z
9553
9550
  };