@brickkit/cli 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +13 -3
  2. package/dashboard-dist/{CollapsiblePanel-DM8J3g8m.js → CollapsiblePanel-a54TwMKb.js} +1 -1
  3. package/dashboard-dist/{PopoverPopup-B6eMOlOC.js → PopoverPopup-BLzjTqsi.js} +1 -1
  4. package/dashboard-dist/{api-reference-wTdT1AVt.js → api-reference-r893F8zi.js} +2 -2
  5. package/dashboard-dist/app.css +1 -1
  6. package/dashboard-dist/app.js +13 -13
  7. package/dashboard-dist/core-BWAwhSFf.js +1 -0
  8. package/dashboard-dist/{docs-DflzpIIh.js → docs-CkMy3Y5i.js} +1 -1
  9. package/dashboard-dist/{preload-helper-CVJ-D494.js → preload-helper-CjQDFR0M.js} +1 -1
  10. package/dist/app-entry2.js +8 -1
  11. package/dist/app-entry2.js.map +1 -1
  12. package/dist/bin.js +6 -2
  13. package/dist/bin.js.map +1 -1
  14. package/dist/build.js +18 -5
  15. package/dist/build.js.map +1 -1
  16. package/dist/dev-telemetry-store.js +148 -5
  17. package/dist/dev-telemetry-store.js.map +1 -1
  18. package/dist/dev-telemetry.js.map +1 -1
  19. package/dist/dev-worker.js +19 -2
  20. package/dist/dev-worker.js.map +1 -1
  21. package/dist/index.d.ts +14 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +2 -2
  24. package/dist/runner.js +69 -3
  25. package/dist/runner.js.map +1 -1
  26. package/dist/workflows.d.ts +61 -0
  27. package/dist/workflows.d.ts.map +1 -0
  28. package/dist/workflows.js +1 -0
  29. package/dist/workflows2.js +298 -0
  30. package/dist/workflows2.js.map +1 -0
  31. package/inspector-dist/LICENSE.md +201 -0
  32. package/inspector-dist/NOTICE +20 -0
  33. package/inspector-dist/client/assets/api.rpc-l0sNRNKZ.js +1 -0
  34. package/inspector-dist/client/assets/api.stream._streamId-l0sNRNKZ.js +1 -0
  35. package/inspector-dist/client/assets/app-CY7CQBRo.css +1 -0
  36. package/inspector-dist/client/assets/entry.client-BJ6G3n5t.js +11697 -0
  37. package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-C-3wZnxf.js +19 -0
  38. package/inspector-dist/client/assets/home-CSKAS4P2.js +4979 -0
  39. package/inspector-dist/client/assets/index-DECCyMR0.js +4482 -0
  40. package/inspector-dist/client/assets/index-Dot7CgrA.js +9837 -0
  41. package/inspector-dist/client/assets/index-HqNj_XIX.js +200 -0
  42. package/inspector-dist/client/assets/manifest-4baa7c6f.js +1 -0
  43. package/inspector-dist/client/assets/mermaid-3ZIDBTTL-DC0K8uTy.js +58626 -0
  44. package/inspector-dist/client/assets/mermaid-3ZIDBTTL-F88p7PFX.css +1 -0
  45. package/inspector-dist/client/assets/root-Bmn5n3jF.js +305 -0
  46. package/inspector-dist/client/assets/root-CfCr265_.css +1 -0
  47. package/inspector-dist/client/assets/run-detail-CWoGxu_0.css +1 -0
  48. package/inspector-dist/client/assets/run-detail-Cc7tSGNq.js +6237 -0
  49. package/inspector-dist/client/assets/world-config-context-BAD1QCrR.js +26 -0
  50. package/inspector-dist/client/assets/zstd-B5R2yJjB.wasm +0 -0
  51. package/inspector-dist/client/assets/zstd-browser-decoder-BQoRpP7L.js +28 -0
  52. package/inspector-dist/server/assets/app-C-ZVJtic.js +174880 -0
  53. package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-C8sq8F_D.js +71 -0
  54. package/inspector-dist/server/assets/index-BfLBLRRi.js +204 -0
  55. package/inspector-dist/server/assets/index-BzrGWk7J.js +1164 -0
  56. package/inspector-dist/server/assets/index-CWJr34WJ.js +1296 -0
  57. package/inspector-dist/server/assets/index-CYlmUaKx.js +191 -0
  58. package/inspector-dist/server/assets/mermaid-3ZIDBTTL-Dv5rjfMN.js +58 -0
  59. package/inspector-dist/server/assets/token-DnLp3wBO.js +95 -0
  60. package/inspector-dist/server/assets/token-util-Bpfp-B0w.js +33 -0
  61. package/inspector-dist/server/assets/wrapper-D5LIcZ_u.js +67 -0
  62. package/inspector-dist/server/assets/zstd-browser-decoder-BM8GpVB8.js +77 -0
  63. package/inspector-dist/server/index.js +58 -0
  64. package/package.json +12 -4
  65. package/dashboard-dist/core-CHWYtApw.js +0 -1
@@ -0,0 +1,4482 @@
1
+ import { r as reactExports, j as jsxRuntimeExports, o as reactDomExports, C as React2, D as ReactDOM, R as React2$1 } from "./index-Dot7CgrA.js";
2
+ function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
3
+ return function handleEvent(event) {
4
+ originalEventHandler?.(event);
5
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) {
6
+ return ourEventHandler?.(event);
7
+ }
8
+ };
9
+ }
10
+ function setRef(ref, value) {
11
+ if (typeof ref === "function") {
12
+ return ref(value);
13
+ } else if (ref !== null && ref !== void 0) {
14
+ ref.current = value;
15
+ }
16
+ }
17
+ function composeRefs(...refs) {
18
+ return (node) => {
19
+ let hasCleanup = false;
20
+ const cleanups = refs.map((ref) => {
21
+ const cleanup = setRef(ref, node);
22
+ if (!hasCleanup && typeof cleanup == "function") {
23
+ hasCleanup = true;
24
+ }
25
+ return cleanup;
26
+ });
27
+ if (hasCleanup) {
28
+ return () => {
29
+ for (let i = 0; i < cleanups.length; i++) {
30
+ const cleanup = cleanups[i];
31
+ if (typeof cleanup == "function") {
32
+ cleanup();
33
+ } else {
34
+ setRef(refs[i], null);
35
+ }
36
+ }
37
+ };
38
+ }
39
+ };
40
+ }
41
+ function useComposedRefs(...refs) {
42
+ return reactExports.useCallback(composeRefs(...refs), refs);
43
+ }
44
+ function createContextScope(scopeName, createContextScopeDeps = []) {
45
+ let defaultContexts = [];
46
+ function createContext3(rootComponentName, defaultContext) {
47
+ const BaseContext = reactExports.createContext(defaultContext);
48
+ const index2 = defaultContexts.length;
49
+ defaultContexts = [...defaultContexts, defaultContext];
50
+ const Provider2 = (props) => {
51
+ const { scope, children, ...context } = props;
52
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
53
+ const value = reactExports.useMemo(() => context, Object.values(context));
54
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Context.Provider, { value, children });
55
+ };
56
+ Provider2.displayName = rootComponentName + "Provider";
57
+ function useContext2(consumerName, scope) {
58
+ const Context = scope?.[scopeName]?.[index2] || BaseContext;
59
+ const context = reactExports.useContext(Context);
60
+ if (context) return context;
61
+ if (defaultContext !== void 0) return defaultContext;
62
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
63
+ }
64
+ return [Provider2, useContext2];
65
+ }
66
+ const createScope = () => {
67
+ const scopeContexts = defaultContexts.map((defaultContext) => {
68
+ return reactExports.createContext(defaultContext);
69
+ });
70
+ return function useScope(scope) {
71
+ const contexts = scope?.[scopeName] || scopeContexts;
72
+ return reactExports.useMemo(
73
+ () => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
74
+ [scope, contexts]
75
+ );
76
+ };
77
+ };
78
+ createScope.scopeName = scopeName;
79
+ return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
80
+ }
81
+ function composeContextScopes(...scopes) {
82
+ const baseScope = scopes[0];
83
+ if (scopes.length === 1) return baseScope;
84
+ const createScope = () => {
85
+ const scopeHooks = scopes.map((createScope2) => ({
86
+ useScope: createScope2(),
87
+ scopeName: createScope2.scopeName
88
+ }));
89
+ return function useComposedScopes(overrideScopes) {
90
+ const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
91
+ const scopeProps = useScope(overrideScopes);
92
+ const currentScope = scopeProps[`__scope${scopeName}`];
93
+ return { ...nextScopes2, ...currentScope };
94
+ }, {});
95
+ return reactExports.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
96
+ };
97
+ };
98
+ createScope.scopeName = baseScope.scopeName;
99
+ return createScope;
100
+ }
101
+ // @__NO_SIDE_EFFECTS__
102
+ function createSlot(ownerName) {
103
+ const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
104
+ const Slot2 = reactExports.forwardRef((props, forwardedRef) => {
105
+ const { children, ...slotProps } = props;
106
+ const childrenArray = reactExports.Children.toArray(children);
107
+ const slottable = childrenArray.find(isSlottable);
108
+ if (slottable) {
109
+ const newElement = slottable.props.children;
110
+ const newChildren = childrenArray.map((child) => {
111
+ if (child === slottable) {
112
+ if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
113
+ return reactExports.isValidElement(newElement) ? newElement.props.children : null;
114
+ } else {
115
+ return child;
116
+ }
117
+ });
118
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
119
+ }
120
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
121
+ });
122
+ Slot2.displayName = `${ownerName}.Slot`;
123
+ return Slot2;
124
+ }
125
+ // @__NO_SIDE_EFFECTS__
126
+ function createSlotClone(ownerName) {
127
+ const SlotClone = reactExports.forwardRef((props, forwardedRef) => {
128
+ const { children, ...slotProps } = props;
129
+ if (reactExports.isValidElement(children)) {
130
+ const childrenRef = getElementRef$1(children);
131
+ const props2 = mergeProps(slotProps, children.props);
132
+ if (children.type !== reactExports.Fragment) {
133
+ props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
134
+ }
135
+ return reactExports.cloneElement(children, props2);
136
+ }
137
+ return reactExports.Children.count(children) > 1 ? reactExports.Children.only(null) : null;
138
+ });
139
+ SlotClone.displayName = `${ownerName}.SlotClone`;
140
+ return SlotClone;
141
+ }
142
+ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
143
+ // @__NO_SIDE_EFFECTS__
144
+ function createSlottable(ownerName) {
145
+ const Slottable2 = ({ children }) => {
146
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
147
+ };
148
+ Slottable2.displayName = `${ownerName}.Slottable`;
149
+ Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
150
+ return Slottable2;
151
+ }
152
+ function isSlottable(child) {
153
+ return reactExports.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
154
+ }
155
+ function mergeProps(slotProps, childProps) {
156
+ const overrideProps = { ...childProps };
157
+ for (const propName in childProps) {
158
+ const slotPropValue = slotProps[propName];
159
+ const childPropValue = childProps[propName];
160
+ const isHandler = /^on[A-Z]/.test(propName);
161
+ if (isHandler) {
162
+ if (slotPropValue && childPropValue) {
163
+ overrideProps[propName] = (...args) => {
164
+ const result = childPropValue(...args);
165
+ slotPropValue(...args);
166
+ return result;
167
+ };
168
+ } else if (slotPropValue) {
169
+ overrideProps[propName] = slotPropValue;
170
+ }
171
+ } else if (propName === "style") {
172
+ overrideProps[propName] = { ...slotPropValue, ...childPropValue };
173
+ } else if (propName === "className") {
174
+ overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
175
+ }
176
+ }
177
+ return { ...slotProps, ...overrideProps };
178
+ }
179
+ function getElementRef$1(element) {
180
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
181
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
182
+ if (mayWarn) {
183
+ return element.ref;
184
+ }
185
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
186
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
187
+ if (mayWarn) {
188
+ return element.props.ref;
189
+ }
190
+ return element.props.ref || element.ref;
191
+ }
192
+ var NODES = [
193
+ "a",
194
+ "button",
195
+ "div",
196
+ "form",
197
+ "h2",
198
+ "h3",
199
+ "img",
200
+ "input",
201
+ "label",
202
+ "li",
203
+ "nav",
204
+ "ol",
205
+ "p",
206
+ "select",
207
+ "span",
208
+ "svg",
209
+ "ul"
210
+ ];
211
+ var Primitive = NODES.reduce((primitive, node) => {
212
+ const Slot = /* @__PURE__ */ createSlot(`Primitive.${node}`);
213
+ const Node2 = reactExports.forwardRef((props, forwardedRef) => {
214
+ const { asChild, ...primitiveProps } = props;
215
+ const Comp = asChild ? Slot : node;
216
+ if (typeof window !== "undefined") {
217
+ window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
218
+ }
219
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, { ...primitiveProps, ref: forwardedRef });
220
+ });
221
+ Node2.displayName = `Primitive.${node}`;
222
+ return { ...primitive, [node]: Node2 };
223
+ }, {});
224
+ function dispatchDiscreteCustomEvent(target, event) {
225
+ if (target) reactDomExports.flushSync(() => target.dispatchEvent(event));
226
+ }
227
+ function useCallbackRef(callback) {
228
+ const callbackRef = reactExports.useRef(callback);
229
+ reactExports.useEffect(() => {
230
+ callbackRef.current = callback;
231
+ });
232
+ return reactExports.useMemo(() => (...args) => callbackRef.current?.(...args), []);
233
+ }
234
+ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.document) {
235
+ const onEscapeKeyDown = useCallbackRef(onEscapeKeyDownProp);
236
+ reactExports.useEffect(() => {
237
+ const handleKeyDown = (event) => {
238
+ if (event.key === "Escape") {
239
+ onEscapeKeyDown(event);
240
+ }
241
+ };
242
+ ownerDocument.addEventListener("keydown", handleKeyDown, { capture: true });
243
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown, { capture: true });
244
+ }, [onEscapeKeyDown, ownerDocument]);
245
+ }
246
+ var DISMISSABLE_LAYER_NAME = "DismissableLayer";
247
+ var CONTEXT_UPDATE = "dismissableLayer.update";
248
+ var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
249
+ var FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
250
+ var originalBodyPointerEvents;
251
+ var DismissableLayerContext = reactExports.createContext({
252
+ layers: /* @__PURE__ */ new Set(),
253
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
254
+ branches: /* @__PURE__ */ new Set()
255
+ });
256
+ var DismissableLayer = reactExports.forwardRef(
257
+ (props, forwardedRef) => {
258
+ const {
259
+ disableOutsidePointerEvents = false,
260
+ onEscapeKeyDown,
261
+ onPointerDownOutside,
262
+ onFocusOutside,
263
+ onInteractOutside,
264
+ onDismiss,
265
+ ...layerProps
266
+ } = props;
267
+ const context = reactExports.useContext(DismissableLayerContext);
268
+ const [node, setNode] = reactExports.useState(null);
269
+ const ownerDocument = node?.ownerDocument ?? globalThis?.document;
270
+ const [, force] = reactExports.useState({});
271
+ const composedRefs = useComposedRefs(forwardedRef, (node2) => setNode(node2));
272
+ const layers = Array.from(context.layers);
273
+ const [highestLayerWithOutsidePointerEventsDisabled] = [...context.layersWithOutsidePointerEventsDisabled].slice(-1);
274
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
275
+ const index2 = node ? layers.indexOf(node) : -1;
276
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
277
+ const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
278
+ const pointerDownOutside = usePointerDownOutside((event) => {
279
+ const target = event.target;
280
+ const isPointerDownOnBranch = [...context.branches].some((branch) => branch.contains(target));
281
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
282
+ onPointerDownOutside?.(event);
283
+ onInteractOutside?.(event);
284
+ if (!event.defaultPrevented) onDismiss?.();
285
+ }, ownerDocument);
286
+ const focusOutside = useFocusOutside((event) => {
287
+ const target = event.target;
288
+ const isFocusInBranch = [...context.branches].some((branch) => branch.contains(target));
289
+ if (isFocusInBranch) return;
290
+ onFocusOutside?.(event);
291
+ onInteractOutside?.(event);
292
+ if (!event.defaultPrevented) onDismiss?.();
293
+ }, ownerDocument);
294
+ useEscapeKeydown((event) => {
295
+ const isHighestLayer = index2 === context.layers.size - 1;
296
+ if (!isHighestLayer) return;
297
+ onEscapeKeyDown?.(event);
298
+ if (!event.defaultPrevented && onDismiss) {
299
+ event.preventDefault();
300
+ onDismiss();
301
+ }
302
+ }, ownerDocument);
303
+ reactExports.useEffect(() => {
304
+ if (!node) return;
305
+ if (disableOutsidePointerEvents) {
306
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
307
+ originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
308
+ ownerDocument.body.style.pointerEvents = "none";
309
+ }
310
+ context.layersWithOutsidePointerEventsDisabled.add(node);
311
+ }
312
+ context.layers.add(node);
313
+ dispatchUpdate();
314
+ return () => {
315
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) {
316
+ ownerDocument.body.style.pointerEvents = originalBodyPointerEvents;
317
+ }
318
+ };
319
+ }, [node, ownerDocument, disableOutsidePointerEvents, context]);
320
+ reactExports.useEffect(() => {
321
+ return () => {
322
+ if (!node) return;
323
+ context.layers.delete(node);
324
+ context.layersWithOutsidePointerEventsDisabled.delete(node);
325
+ dispatchUpdate();
326
+ };
327
+ }, [node, context]);
328
+ reactExports.useEffect(() => {
329
+ const handleUpdate = () => force({});
330
+ document.addEventListener(CONTEXT_UPDATE, handleUpdate);
331
+ return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
332
+ }, []);
333
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
334
+ Primitive.div,
335
+ {
336
+ ...layerProps,
337
+ ref: composedRefs,
338
+ style: {
339
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
340
+ ...props.style
341
+ },
342
+ onFocusCapture: composeEventHandlers(props.onFocusCapture, focusOutside.onFocusCapture),
343
+ onBlurCapture: composeEventHandlers(props.onBlurCapture, focusOutside.onBlurCapture),
344
+ onPointerDownCapture: composeEventHandlers(
345
+ props.onPointerDownCapture,
346
+ pointerDownOutside.onPointerDownCapture
347
+ )
348
+ }
349
+ );
350
+ }
351
+ );
352
+ DismissableLayer.displayName = DISMISSABLE_LAYER_NAME;
353
+ var BRANCH_NAME = "DismissableLayerBranch";
354
+ var DismissableLayerBranch = reactExports.forwardRef((props, forwardedRef) => {
355
+ const context = reactExports.useContext(DismissableLayerContext);
356
+ const ref = reactExports.useRef(null);
357
+ const composedRefs = useComposedRefs(forwardedRef, ref);
358
+ reactExports.useEffect(() => {
359
+ const node = ref.current;
360
+ if (node) {
361
+ context.branches.add(node);
362
+ return () => {
363
+ context.branches.delete(node);
364
+ };
365
+ }
366
+ }, [context.branches]);
367
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...props, ref: composedRefs });
368
+ });
369
+ DismissableLayerBranch.displayName = BRANCH_NAME;
370
+ function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
371
+ const handlePointerDownOutside = useCallbackRef(onPointerDownOutside);
372
+ const isPointerInsideReactTreeRef = reactExports.useRef(false);
373
+ const handleClickRef = reactExports.useRef(() => {
374
+ });
375
+ reactExports.useEffect(() => {
376
+ const handlePointerDown = (event) => {
377
+ if (event.target && !isPointerInsideReactTreeRef.current) {
378
+ let handleAndDispatchPointerDownOutsideEvent2 = function() {
379
+ handleAndDispatchCustomEvent(
380
+ POINTER_DOWN_OUTSIDE,
381
+ handlePointerDownOutside,
382
+ eventDetail,
383
+ { discrete: true }
384
+ );
385
+ };
386
+ const eventDetail = { originalEvent: event };
387
+ if (event.pointerType === "touch") {
388
+ ownerDocument.removeEventListener("click", handleClickRef.current);
389
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent2;
390
+ ownerDocument.addEventListener("click", handleClickRef.current, { once: true });
391
+ } else {
392
+ handleAndDispatchPointerDownOutsideEvent2();
393
+ }
394
+ } else {
395
+ ownerDocument.removeEventListener("click", handleClickRef.current);
396
+ }
397
+ isPointerInsideReactTreeRef.current = false;
398
+ };
399
+ const timerId = window.setTimeout(() => {
400
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
401
+ }, 0);
402
+ return () => {
403
+ window.clearTimeout(timerId);
404
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
405
+ ownerDocument.removeEventListener("click", handleClickRef.current);
406
+ };
407
+ }, [ownerDocument, handlePointerDownOutside]);
408
+ return {
409
+ // ensures we check React component tree (not just DOM tree)
410
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
411
+ };
412
+ }
413
+ function useFocusOutside(onFocusOutside, ownerDocument = globalThis?.document) {
414
+ const handleFocusOutside = useCallbackRef(onFocusOutside);
415
+ const isFocusInsideReactTreeRef = reactExports.useRef(false);
416
+ reactExports.useEffect(() => {
417
+ const handleFocus = (event) => {
418
+ if (event.target && !isFocusInsideReactTreeRef.current) {
419
+ const eventDetail = { originalEvent: event };
420
+ handleAndDispatchCustomEvent(FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
421
+ discrete: false
422
+ });
423
+ }
424
+ };
425
+ ownerDocument.addEventListener("focusin", handleFocus);
426
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
427
+ }, [ownerDocument, handleFocusOutside]);
428
+ return {
429
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
430
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
431
+ };
432
+ }
433
+ function dispatchUpdate() {
434
+ const event = new CustomEvent(CONTEXT_UPDATE);
435
+ document.dispatchEvent(event);
436
+ }
437
+ function handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
438
+ const target = detail.originalEvent.target;
439
+ const event = new CustomEvent(name, { bubbles: false, cancelable: true, detail });
440
+ if (handler) target.addEventListener(name, handler, { once: true });
441
+ if (discrete) {
442
+ dispatchDiscreteCustomEvent(target, event);
443
+ } else {
444
+ target.dispatchEvent(event);
445
+ }
446
+ }
447
+ var useLayoutEffect2 = globalThis?.document ? reactExports.useLayoutEffect : () => {
448
+ };
449
+ var useReactId = React2[" useId ".trim().toString()] || (() => void 0);
450
+ var count = 0;
451
+ function useId(deterministicId) {
452
+ const [id, setId] = reactExports.useState(useReactId());
453
+ useLayoutEffect2(() => {
454
+ setId((reactId) => reactId ?? String(count++));
455
+ }, [deterministicId]);
456
+ return id ? `radix-${id}` : "";
457
+ }
458
+ const sides = ["top", "right", "bottom", "left"];
459
+ const min = Math.min;
460
+ const max = Math.max;
461
+ const round = Math.round;
462
+ const floor = Math.floor;
463
+ const createCoords = (v) => ({
464
+ x: v,
465
+ y: v
466
+ });
467
+ const oppositeSideMap = {
468
+ left: "right",
469
+ right: "left",
470
+ bottom: "top",
471
+ top: "bottom"
472
+ };
473
+ function clamp(start, value, end) {
474
+ return max(start, min(value, end));
475
+ }
476
+ function evaluate(value, param) {
477
+ return typeof value === "function" ? value(param) : value;
478
+ }
479
+ function getSide(placement) {
480
+ return placement.split("-")[0];
481
+ }
482
+ function getAlignment(placement) {
483
+ return placement.split("-")[1];
484
+ }
485
+ function getOppositeAxis(axis) {
486
+ return axis === "x" ? "y" : "x";
487
+ }
488
+ function getAxisLength(axis) {
489
+ return axis === "y" ? "height" : "width";
490
+ }
491
+ function getSideAxis(placement) {
492
+ const firstChar = placement[0];
493
+ return firstChar === "t" || firstChar === "b" ? "y" : "x";
494
+ }
495
+ function getAlignmentAxis(placement) {
496
+ return getOppositeAxis(getSideAxis(placement));
497
+ }
498
+ function getAlignmentSides(placement, rects, rtl) {
499
+ if (rtl === void 0) {
500
+ rtl = false;
501
+ }
502
+ const alignment = getAlignment(placement);
503
+ const alignmentAxis = getAlignmentAxis(placement);
504
+ const length = getAxisLength(alignmentAxis);
505
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
506
+ if (rects.reference[length] > rects.floating[length]) {
507
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
508
+ }
509
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
510
+ }
511
+ function getExpandedPlacements(placement) {
512
+ const oppositePlacement = getOppositePlacement(placement);
513
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
514
+ }
515
+ function getOppositeAlignmentPlacement(placement) {
516
+ return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
517
+ }
518
+ const lrPlacement = ["left", "right"];
519
+ const rlPlacement = ["right", "left"];
520
+ const tbPlacement = ["top", "bottom"];
521
+ const btPlacement = ["bottom", "top"];
522
+ function getSideList(side, isStart, rtl) {
523
+ switch (side) {
524
+ case "top":
525
+ case "bottom":
526
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
527
+ return isStart ? lrPlacement : rlPlacement;
528
+ case "left":
529
+ case "right":
530
+ return isStart ? tbPlacement : btPlacement;
531
+ default:
532
+ return [];
533
+ }
534
+ }
535
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
536
+ const alignment = getAlignment(placement);
537
+ let list = getSideList(getSide(placement), direction === "start", rtl);
538
+ if (alignment) {
539
+ list = list.map((side) => side + "-" + alignment);
540
+ if (flipAlignment) {
541
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
542
+ }
543
+ }
544
+ return list;
545
+ }
546
+ function getOppositePlacement(placement) {
547
+ const side = getSide(placement);
548
+ return oppositeSideMap[side] + placement.slice(side.length);
549
+ }
550
+ function expandPaddingObject(padding) {
551
+ var _padding$top, _padding$right, _padding$bottom, _padding$left;
552
+ return {
553
+ top: (_padding$top = padding.top) != null ? _padding$top : 0,
554
+ right: (_padding$right = padding.right) != null ? _padding$right : 0,
555
+ bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0,
556
+ left: (_padding$left = padding.left) != null ? _padding$left : 0
557
+ };
558
+ }
559
+ function getPaddingObject(padding) {
560
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
561
+ top: padding,
562
+ right: padding,
563
+ bottom: padding,
564
+ left: padding
565
+ };
566
+ }
567
+ function rectToClientRect(rect) {
568
+ const {
569
+ x,
570
+ y,
571
+ width,
572
+ height
573
+ } = rect;
574
+ return {
575
+ width,
576
+ height,
577
+ top: y,
578
+ left: x,
579
+ right: x + width,
580
+ bottom: y + height,
581
+ x,
582
+ y
583
+ };
584
+ }
585
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
586
+ let {
587
+ reference,
588
+ floating
589
+ } = _ref;
590
+ const sideAxis = getSideAxis(placement);
591
+ const alignmentAxis = getAlignmentAxis(placement);
592
+ const alignLength = getAxisLength(alignmentAxis);
593
+ const side = getSide(placement);
594
+ const isVertical = sideAxis === "y";
595
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
596
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
597
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
598
+ let coords;
599
+ switch (side) {
600
+ case "top":
601
+ coords = {
602
+ x: commonX,
603
+ y: reference.y - floating.height
604
+ };
605
+ break;
606
+ case "bottom":
607
+ coords = {
608
+ x: commonX,
609
+ y: reference.y + reference.height
610
+ };
611
+ break;
612
+ case "right":
613
+ coords = {
614
+ x: reference.x + reference.width,
615
+ y: commonY
616
+ };
617
+ break;
618
+ case "left":
619
+ coords = {
620
+ x: reference.x - floating.width,
621
+ y: commonY
622
+ };
623
+ break;
624
+ default:
625
+ coords = {
626
+ x: reference.x,
627
+ y: reference.y
628
+ };
629
+ }
630
+ const alignment = getAlignment(placement);
631
+ if (alignment) {
632
+ coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1);
633
+ }
634
+ return coords;
635
+ }
636
+ async function detectOverflow(state, options) {
637
+ var _await$platform$isEle;
638
+ if (options === void 0) {
639
+ options = {};
640
+ }
641
+ const {
642
+ x,
643
+ y,
644
+ platform: platform2,
645
+ rects,
646
+ elements,
647
+ strategy
648
+ } = state;
649
+ const {
650
+ boundary = "clippingAncestors",
651
+ rootBoundary = "viewport",
652
+ elementContext = "floating",
653
+ altBoundary = false,
654
+ padding = 0
655
+ } = evaluate(options, state);
656
+ const paddingObject = getPaddingObject(padding);
657
+ const altContext = elementContext === "floating" ? "reference" : "floating";
658
+ const element = elements[altBoundary ? altContext : elementContext];
659
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
660
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
661
+ boundary,
662
+ rootBoundary,
663
+ strategy
664
+ }));
665
+ const rect = elementContext === "floating" ? {
666
+ x,
667
+ y,
668
+ width: rects.floating.width,
669
+ height: rects.floating.height
670
+ } : rects.reference;
671
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
672
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) && await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
673
+ x: 1,
674
+ y: 1
675
+ };
676
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
677
+ elements,
678
+ rect,
679
+ offsetParent,
680
+ strategy
681
+ }) : rect);
682
+ return {
683
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
684
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
685
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
686
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
687
+ };
688
+ }
689
+ const MAX_RESET_COUNT = 50;
690
+ const computePosition$1 = async (reference, floating, config) => {
691
+ const {
692
+ placement = "bottom",
693
+ strategy = "absolute",
694
+ middleware = [],
695
+ platform: platform2
696
+ } = config;
697
+ const platformWithDetectOverflow = platform2.detectOverflow ? platform2 : {
698
+ ...platform2,
699
+ detectOverflow
700
+ };
701
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
702
+ let rects = await platform2.getElementRects({
703
+ reference,
704
+ floating,
705
+ strategy
706
+ });
707
+ let {
708
+ x,
709
+ y
710
+ } = computeCoordsFromPlacement(rects, placement, rtl);
711
+ let statefulPlacement = placement;
712
+ let resetCount = 0;
713
+ const middlewareData = {};
714
+ for (let i = 0; i < middleware.length; i++) {
715
+ const currentMiddleware = middleware[i];
716
+ if (!currentMiddleware) {
717
+ continue;
718
+ }
719
+ const {
720
+ name,
721
+ fn
722
+ } = currentMiddleware;
723
+ const {
724
+ x: nextX,
725
+ y: nextY,
726
+ data,
727
+ reset
728
+ } = await fn({
729
+ x,
730
+ y,
731
+ initialPlacement: placement,
732
+ placement: statefulPlacement,
733
+ strategy,
734
+ middlewareData,
735
+ rects,
736
+ platform: platformWithDetectOverflow,
737
+ elements: {
738
+ reference,
739
+ floating
740
+ }
741
+ });
742
+ x = nextX != null ? nextX : x;
743
+ y = nextY != null ? nextY : y;
744
+ middlewareData[name] = {
745
+ ...middlewareData[name],
746
+ ...data
747
+ };
748
+ if (reset && resetCount < MAX_RESET_COUNT) {
749
+ resetCount++;
750
+ if (typeof reset === "object") {
751
+ if (reset.placement) {
752
+ statefulPlacement = reset.placement;
753
+ }
754
+ if (reset.rects) {
755
+ rects = reset.rects === true ? await platform2.getElementRects({
756
+ reference,
757
+ floating,
758
+ strategy
759
+ }) : reset.rects;
760
+ }
761
+ ({
762
+ x,
763
+ y
764
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
765
+ }
766
+ i = -1;
767
+ }
768
+ }
769
+ return {
770
+ x,
771
+ y,
772
+ placement: statefulPlacement,
773
+ strategy,
774
+ middlewareData
775
+ };
776
+ };
777
+ const arrow$3 = (options) => ({
778
+ name: "arrow",
779
+ options,
780
+ async fn(state) {
781
+ const {
782
+ x,
783
+ y,
784
+ placement,
785
+ rects,
786
+ platform: platform2,
787
+ elements,
788
+ middlewareData
789
+ } = state;
790
+ const {
791
+ element,
792
+ padding = 0
793
+ } = evaluate(options, state) || {};
794
+ if (element == null) {
795
+ return {};
796
+ }
797
+ const paddingObject = getPaddingObject(padding);
798
+ const coords = {
799
+ x,
800
+ y
801
+ };
802
+ const axis = getAlignmentAxis(placement);
803
+ const length = getAxisLength(axis);
804
+ const arrowDimensions = await platform2.getDimensions(element);
805
+ const isYAxis = axis === "y";
806
+ const minProp = isYAxis ? "top" : "left";
807
+ const maxProp = isYAxis ? "bottom" : "right";
808
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
809
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
810
+ const startDiff = coords[axis] - rects.reference[axis];
811
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
812
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
813
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
814
+ clientSize = elements.floating[clientProp] || rects.floating[length];
815
+ }
816
+ const centerToReference = endDiff / 2 - startDiff / 2;
817
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
818
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
819
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
820
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
821
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
822
+ const offset2 = clamp(minPadding, center, max2);
823
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < minPadding ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
824
+ const alignmentOffset = shouldAddOffset ? center < minPadding ? center - minPadding : center - max2 : 0;
825
+ return {
826
+ [axis]: coords[axis] + alignmentOffset,
827
+ data: {
828
+ [axis]: offset2,
829
+ centerOffset: center - offset2 - alignmentOffset,
830
+ ...shouldAddOffset && {
831
+ alignmentOffset
832
+ }
833
+ },
834
+ reset: shouldAddOffset
835
+ };
836
+ }
837
+ });
838
+ const flip$2 = function(options) {
839
+ if (options === void 0) {
840
+ options = {};
841
+ }
842
+ return {
843
+ name: "flip",
844
+ options,
845
+ async fn(state) {
846
+ var _middlewareData$arrow, _middlewareData$flip;
847
+ const {
848
+ placement,
849
+ middlewareData,
850
+ rects,
851
+ initialPlacement,
852
+ platform: platform2,
853
+ elements
854
+ } = state;
855
+ const {
856
+ mainAxis: checkMainAxis = true,
857
+ crossAxis: checkCrossAxis = true,
858
+ fallbackPlacements: specifiedFallbackPlacements,
859
+ fallbackStrategy = "bestFit",
860
+ fallbackAxisSideDirection = "none",
861
+ flipAlignment = true,
862
+ ...detectOverflowOptions
863
+ } = evaluate(options, state);
864
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
865
+ return {};
866
+ }
867
+ const side = getSide(placement);
868
+ const initialSideAxis = getSideAxis(initialPlacement);
869
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
870
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
871
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
872
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
873
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
874
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
875
+ }
876
+ const placements = [initialPlacement, ...fallbackPlacements];
877
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
878
+ const overflows = [];
879
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
880
+ if (checkMainAxis) {
881
+ overflows.push(overflow[side]);
882
+ }
883
+ if (checkCrossAxis) {
884
+ const sides2 = getAlignmentSides(placement, rects, rtl);
885
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
886
+ }
887
+ overflowsData = [...overflowsData, {
888
+ placement,
889
+ overflows
890
+ }];
891
+ if (!overflows.every((side2) => side2 <= 0)) {
892
+ var _middlewareData$flip2, _overflowsData$filter;
893
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
894
+ const nextPlacement = placements[nextIndex];
895
+ if (nextPlacement) {
896
+ const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
897
+ if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
898
+ // overflows the main axis.
899
+ overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
900
+ return {
901
+ data: {
902
+ index: nextIndex,
903
+ overflows: overflowsData
904
+ },
905
+ reset: {
906
+ placement: nextPlacement
907
+ }
908
+ };
909
+ }
910
+ }
911
+ let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
912
+ if (!resetPlacement) {
913
+ switch (fallbackStrategy) {
914
+ case "bestFit": {
915
+ var _overflowsData$filter2;
916
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
917
+ if (hasFallbackAxisSideDirection) {
918
+ const currentSideAxis = getSideAxis(d.placement);
919
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
920
+ // reading directions favoring greater width.
921
+ currentSideAxis === "y";
922
+ }
923
+ return true;
924
+ }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
925
+ if (placement2) {
926
+ resetPlacement = placement2;
927
+ }
928
+ break;
929
+ }
930
+ case "initialPlacement":
931
+ resetPlacement = initialPlacement;
932
+ break;
933
+ }
934
+ }
935
+ if (placement !== resetPlacement) {
936
+ return {
937
+ reset: {
938
+ placement: resetPlacement
939
+ }
940
+ };
941
+ }
942
+ }
943
+ return {};
944
+ }
945
+ };
946
+ };
947
+ function getSideOffsets(overflow, rect) {
948
+ return {
949
+ top: overflow.top - rect.height,
950
+ right: overflow.right - rect.width,
951
+ bottom: overflow.bottom - rect.height,
952
+ left: overflow.left - rect.width
953
+ };
954
+ }
955
+ function isAnySideFullyClipped(overflow) {
956
+ return sides.some((side) => overflow[side] >= 0);
957
+ }
958
+ const hide$2 = function(options) {
959
+ if (options === void 0) {
960
+ options = {};
961
+ }
962
+ return {
963
+ name: "hide",
964
+ options,
965
+ async fn(state) {
966
+ const {
967
+ rects,
968
+ platform: platform2
969
+ } = state;
970
+ const {
971
+ strategy = "referenceHidden",
972
+ ...detectOverflowOptions
973
+ } = evaluate(options, state);
974
+ switch (strategy) {
975
+ case "referenceHidden": {
976
+ const overflow = await platform2.detectOverflow(state, {
977
+ ...detectOverflowOptions,
978
+ elementContext: "reference"
979
+ });
980
+ const offsets = getSideOffsets(overflow, rects.reference);
981
+ return {
982
+ data: {
983
+ referenceHiddenOffsets: offsets,
984
+ referenceHidden: isAnySideFullyClipped(offsets)
985
+ }
986
+ };
987
+ }
988
+ case "escaped": {
989
+ const overflow = await platform2.detectOverflow(state, {
990
+ ...detectOverflowOptions,
991
+ altBoundary: true
992
+ });
993
+ const offsets = getSideOffsets(overflow, rects.floating);
994
+ return {
995
+ data: {
996
+ escapedOffsets: offsets,
997
+ escaped: isAnySideFullyClipped(offsets)
998
+ }
999
+ };
1000
+ }
1001
+ default: {
1002
+ return {};
1003
+ }
1004
+ }
1005
+ }
1006
+ };
1007
+ };
1008
+ const originSides = /* @__PURE__ */ new Set(["left", "top"]);
1009
+ async function convertValueToCoords(state, options) {
1010
+ const {
1011
+ placement,
1012
+ platform: platform2,
1013
+ elements
1014
+ } = state;
1015
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1016
+ const side = getSide(placement);
1017
+ const alignment = getAlignment(placement);
1018
+ const isVertical = getSideAxis(placement) === "y";
1019
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
1020
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1021
+ const rawValue = evaluate(options, state);
1022
+ let {
1023
+ mainAxis,
1024
+ crossAxis,
1025
+ alignmentAxis
1026
+ } = typeof rawValue === "number" ? {
1027
+ mainAxis: rawValue,
1028
+ crossAxis: 0,
1029
+ alignmentAxis: null
1030
+ } : {
1031
+ mainAxis: rawValue.mainAxis || 0,
1032
+ crossAxis: rawValue.crossAxis || 0,
1033
+ alignmentAxis: rawValue.alignmentAxis
1034
+ };
1035
+ if (alignment && typeof alignmentAxis === "number") {
1036
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1037
+ }
1038
+ return isVertical ? {
1039
+ x: crossAxis * crossAxisMulti,
1040
+ y: mainAxis * mainAxisMulti
1041
+ } : {
1042
+ x: mainAxis * mainAxisMulti,
1043
+ y: crossAxis * crossAxisMulti
1044
+ };
1045
+ }
1046
+ const offset$2 = function(options) {
1047
+ if (options === void 0) {
1048
+ options = 0;
1049
+ }
1050
+ return {
1051
+ name: "offset",
1052
+ options,
1053
+ async fn(state) {
1054
+ var _middlewareData$offse, _middlewareData$arrow;
1055
+ const {
1056
+ x,
1057
+ y,
1058
+ placement,
1059
+ middlewareData
1060
+ } = state;
1061
+ const diffCoords = await convertValueToCoords(state, options);
1062
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1063
+ return {};
1064
+ }
1065
+ return {
1066
+ x: x + diffCoords.x,
1067
+ y: y + diffCoords.y,
1068
+ data: {
1069
+ ...diffCoords,
1070
+ placement
1071
+ }
1072
+ };
1073
+ }
1074
+ };
1075
+ };
1076
+ const shift$2 = function(options) {
1077
+ if (options === void 0) {
1078
+ options = {};
1079
+ }
1080
+ return {
1081
+ name: "shift",
1082
+ options,
1083
+ async fn(state) {
1084
+ const {
1085
+ x,
1086
+ y,
1087
+ placement,
1088
+ platform: platform2
1089
+ } = state;
1090
+ const {
1091
+ mainAxis: checkMainAxis = true,
1092
+ crossAxis: checkCrossAxis = false,
1093
+ limiter = {
1094
+ fn: (_ref) => {
1095
+ let {
1096
+ x: x2,
1097
+ y: y2
1098
+ } = _ref;
1099
+ return {
1100
+ x: x2,
1101
+ y: y2
1102
+ };
1103
+ }
1104
+ },
1105
+ ...detectOverflowOptions
1106
+ } = evaluate(options, state);
1107
+ const coords = {
1108
+ x,
1109
+ y
1110
+ };
1111
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1112
+ const crossAxis = getSideAxis(placement);
1113
+ const mainAxis = getOppositeAxis(crossAxis);
1114
+ let mainAxisCoord = coords[mainAxis];
1115
+ let crossAxisCoord = coords[crossAxis];
1116
+ const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]);
1117
+ if (checkMainAxis) {
1118
+ mainAxisCoord = clampCoord(mainAxis, mainAxisCoord);
1119
+ }
1120
+ if (checkCrossAxis) {
1121
+ crossAxisCoord = clampCoord(crossAxis, crossAxisCoord);
1122
+ }
1123
+ const limitedCoords = limiter.fn({
1124
+ ...state,
1125
+ [mainAxis]: mainAxisCoord,
1126
+ [crossAxis]: crossAxisCoord
1127
+ });
1128
+ return {
1129
+ ...limitedCoords,
1130
+ data: {
1131
+ x: limitedCoords.x - x,
1132
+ y: limitedCoords.y - y,
1133
+ enabled: {
1134
+ [mainAxis]: checkMainAxis,
1135
+ [crossAxis]: checkCrossAxis
1136
+ }
1137
+ }
1138
+ };
1139
+ }
1140
+ };
1141
+ };
1142
+ const limitShift$2 = function(options) {
1143
+ if (options === void 0) {
1144
+ options = {};
1145
+ }
1146
+ return {
1147
+ options,
1148
+ fn(state) {
1149
+ var _rawOffset$mainAxis, _rawOffset$crossAxis;
1150
+ const {
1151
+ x,
1152
+ y,
1153
+ placement,
1154
+ rects,
1155
+ middlewareData
1156
+ } = state;
1157
+ const {
1158
+ offset: offset2 = 0,
1159
+ mainAxis: checkMainAxis = true,
1160
+ crossAxis: checkCrossAxis = true
1161
+ } = evaluate(options, state);
1162
+ const coords = {
1163
+ x,
1164
+ y
1165
+ };
1166
+ const crossAxis = getSideAxis(placement);
1167
+ const mainAxis = getOppositeAxis(crossAxis);
1168
+ let mainAxisCoord = coords[mainAxis];
1169
+ let crossAxisCoord = coords[crossAxis];
1170
+ const rawOffset = evaluate(offset2, state);
1171
+ const computedOffset = typeof rawOffset === "number" ? {
1172
+ mainAxis: rawOffset,
1173
+ crossAxis: 0
1174
+ } : {
1175
+ mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0,
1176
+ crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0
1177
+ };
1178
+ if (checkMainAxis) {
1179
+ const len = mainAxis === "y" ? "height" : "width";
1180
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1181
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1182
+ if (mainAxisCoord < limitMin) {
1183
+ mainAxisCoord = limitMin;
1184
+ } else if (mainAxisCoord > limitMax) {
1185
+ mainAxisCoord = limitMax;
1186
+ }
1187
+ }
1188
+ if (checkCrossAxis) {
1189
+ var _middlewareData$offse, _middlewareData$offse2;
1190
+ const len = mainAxis === "y" ? "width" : "height";
1191
+ const isOriginSide = originSides.has(getSide(placement));
1192
+ const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1193
+ const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1194
+ if (crossAxisCoord < limitMin) {
1195
+ crossAxisCoord = limitMin;
1196
+ } else if (crossAxisCoord > limitMax) {
1197
+ crossAxisCoord = limitMax;
1198
+ }
1199
+ }
1200
+ return {
1201
+ [mainAxis]: mainAxisCoord,
1202
+ [crossAxis]: crossAxisCoord
1203
+ };
1204
+ }
1205
+ };
1206
+ };
1207
+ const size$2 = function(options) {
1208
+ if (options === void 0) {
1209
+ options = {};
1210
+ }
1211
+ return {
1212
+ name: "size",
1213
+ options,
1214
+ async fn(state) {
1215
+ const {
1216
+ placement,
1217
+ rects,
1218
+ platform: platform2,
1219
+ elements
1220
+ } = state;
1221
+ const {
1222
+ apply = () => {
1223
+ },
1224
+ ...detectOverflowOptions
1225
+ } = evaluate(options, state);
1226
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1227
+ const side = getSide(placement);
1228
+ const alignment = getAlignment(placement);
1229
+ const isYAxis = getSideAxis(placement) === "y";
1230
+ const {
1231
+ width,
1232
+ height
1233
+ } = rects.floating;
1234
+ let heightSide;
1235
+ let widthSide;
1236
+ if (side === "top" || side === "bottom") {
1237
+ heightSide = side;
1238
+ widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
1239
+ } else {
1240
+ widthSide = side;
1241
+ heightSide = alignment === "end" ? "top" : "bottom";
1242
+ }
1243
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
1244
+ const maximumClippingWidth = width - overflow.left - overflow.right;
1245
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1246
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1247
+ const shiftData = state.middlewareData.shift;
1248
+ const noShift = !shiftData;
1249
+ let availableHeight = overflowAvailableHeight;
1250
+ let availableWidth = overflowAvailableWidth;
1251
+ if (shiftData != null && shiftData.enabled.x) {
1252
+ availableWidth = maximumClippingWidth;
1253
+ }
1254
+ if (shiftData != null && shiftData.enabled.y) {
1255
+ availableHeight = maximumClippingHeight;
1256
+ }
1257
+ if (noShift && !alignment) {
1258
+ if (isYAxis) {
1259
+ availableWidth = width - 2 * max(overflow.left, overflow.right);
1260
+ } else {
1261
+ availableHeight = height - 2 * max(overflow.top, overflow.bottom);
1262
+ }
1263
+ }
1264
+ await apply({
1265
+ ...state,
1266
+ availableWidth,
1267
+ availableHeight
1268
+ });
1269
+ const nextDimensions = await platform2.getDimensions(elements.floating);
1270
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
1271
+ return {
1272
+ reset: {
1273
+ rects: true
1274
+ }
1275
+ };
1276
+ }
1277
+ return {};
1278
+ }
1279
+ };
1280
+ };
1281
+ function hasWindow() {
1282
+ return typeof window !== "undefined";
1283
+ }
1284
+ function getNodeName(node) {
1285
+ if (isNode(node)) {
1286
+ return (node.nodeName || "").toLowerCase();
1287
+ }
1288
+ return "#document";
1289
+ }
1290
+ function getWindow(node) {
1291
+ var _node$ownerDocument;
1292
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1293
+ }
1294
+ function getDocumentElement(node) {
1295
+ var _ref;
1296
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1297
+ }
1298
+ function isNode(value) {
1299
+ if (!hasWindow()) {
1300
+ return false;
1301
+ }
1302
+ return value instanceof Node || value instanceof getWindow(value).Node;
1303
+ }
1304
+ function isElement(value) {
1305
+ if (!hasWindow()) {
1306
+ return false;
1307
+ }
1308
+ return value instanceof Element || value instanceof getWindow(value).Element;
1309
+ }
1310
+ function isHTMLElement(value) {
1311
+ if (!hasWindow()) {
1312
+ return false;
1313
+ }
1314
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1315
+ }
1316
+ function isShadowRoot(value) {
1317
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
1318
+ return false;
1319
+ }
1320
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1321
+ }
1322
+ function isOverflowElement(element) {
1323
+ const {
1324
+ overflow,
1325
+ overflowX,
1326
+ overflowY,
1327
+ display
1328
+ } = getComputedStyle$1(element);
1329
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
1330
+ }
1331
+ function isTableElement(element) {
1332
+ return /^(table|td|th)$/.test(getNodeName(element));
1333
+ }
1334
+ function isTopLayer(element) {
1335
+ try {
1336
+ if (element.matches(":popover-open")) {
1337
+ return true;
1338
+ }
1339
+ } catch (_e) {
1340
+ }
1341
+ try {
1342
+ return element.matches(":modal");
1343
+ } catch (_e) {
1344
+ return false;
1345
+ }
1346
+ }
1347
+ const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
1348
+ const containRe = /paint|layout|strict|content/;
1349
+ const isNotNone = (value) => !!value && value !== "none";
1350
+ let isWebKitValue;
1351
+ function isContainingBlock(elementOrCss) {
1352
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1353
+ return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
1354
+ }
1355
+ function getContainingBlock(element) {
1356
+ let currentNode = getParentNode(element);
1357
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1358
+ if (isContainingBlock(currentNode)) {
1359
+ return currentNode;
1360
+ } else if (isTopLayer(currentNode)) {
1361
+ return null;
1362
+ }
1363
+ currentNode = getParentNode(currentNode);
1364
+ }
1365
+ return null;
1366
+ }
1367
+ function isWebKit() {
1368
+ if (isWebKitValue == null) {
1369
+ isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
1370
+ }
1371
+ return isWebKitValue;
1372
+ }
1373
+ function isLastTraversableNode(node) {
1374
+ return /^(html|body|#document)$/.test(getNodeName(node));
1375
+ }
1376
+ function getComputedStyle$1(element) {
1377
+ return getWindow(element).getComputedStyle(element);
1378
+ }
1379
+ function getNodeScroll(element) {
1380
+ if (isElement(element)) {
1381
+ return {
1382
+ scrollLeft: element.scrollLeft,
1383
+ scrollTop: element.scrollTop
1384
+ };
1385
+ }
1386
+ return {
1387
+ scrollLeft: element.scrollX,
1388
+ scrollTop: element.scrollY
1389
+ };
1390
+ }
1391
+ function getParentNode(node) {
1392
+ if (getNodeName(node) === "html") {
1393
+ return node;
1394
+ }
1395
+ const result = (
1396
+ // Step into the shadow DOM of the parent of a slotted node.
1397
+ node.assignedSlot || // DOM Element detected.
1398
+ node.parentNode || // ShadowRoot detected.
1399
+ isShadowRoot(node) && node.host || // Fallback.
1400
+ getDocumentElement(node)
1401
+ );
1402
+ return isShadowRoot(result) ? result.host : result;
1403
+ }
1404
+ function getNearestOverflowAncestor(node) {
1405
+ const parentNode = getParentNode(node);
1406
+ if (isLastTraversableNode(parentNode)) {
1407
+ return (node.ownerDocument || node).body;
1408
+ }
1409
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1410
+ return parentNode;
1411
+ }
1412
+ return getNearestOverflowAncestor(parentNode);
1413
+ }
1414
+ function getOverflowAncestors(node, list, traverseIframes) {
1415
+ var _node$ownerDocument2;
1416
+ if (list === void 0) {
1417
+ list = [];
1418
+ }
1419
+ if (traverseIframes === void 0) {
1420
+ traverseIframes = true;
1421
+ }
1422
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1423
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1424
+ const win = getWindow(scrollableAncestor);
1425
+ if (isBody) {
1426
+ const frameElement = getFrameElement(win);
1427
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1428
+ } else {
1429
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1430
+ }
1431
+ }
1432
+ function getFrameElement(win) {
1433
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1434
+ }
1435
+ function getCssDimensions(element) {
1436
+ const css = getComputedStyle$1(element);
1437
+ let width = parseFloat(css.width) || 0;
1438
+ let height = parseFloat(css.height) || 0;
1439
+ const hasOffset = isHTMLElement(element);
1440
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1441
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1442
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1443
+ if (shouldFallback) {
1444
+ width = offsetWidth;
1445
+ height = offsetHeight;
1446
+ }
1447
+ return {
1448
+ width,
1449
+ height,
1450
+ $: shouldFallback
1451
+ };
1452
+ }
1453
+ function unwrapElement(element) {
1454
+ return !isElement(element) ? element.contextElement : element;
1455
+ }
1456
+ function getScale(element) {
1457
+ const domElement = unwrapElement(element);
1458
+ if (!isHTMLElement(domElement)) {
1459
+ return createCoords(1);
1460
+ }
1461
+ const rect = domElement.getBoundingClientRect();
1462
+ const {
1463
+ width,
1464
+ height,
1465
+ $
1466
+ } = getCssDimensions(domElement);
1467
+ let x = ($ ? round(rect.width) : rect.width) / width;
1468
+ let y = ($ ? round(rect.height) : rect.height) / height;
1469
+ if (!x || !Number.isFinite(x)) {
1470
+ x = 1;
1471
+ }
1472
+ if (!y || !Number.isFinite(y)) {
1473
+ y = 1;
1474
+ }
1475
+ return {
1476
+ x,
1477
+ y
1478
+ };
1479
+ }
1480
+ const noOffsets = /* @__PURE__ */ createCoords(0);
1481
+ function getVisualOffsets(element) {
1482
+ const win = getWindow(element);
1483
+ if (!isWebKit() || !win.visualViewport) {
1484
+ return noOffsets;
1485
+ }
1486
+ return {
1487
+ x: win.visualViewport.offsetLeft,
1488
+ y: win.visualViewport.offsetTop
1489
+ };
1490
+ }
1491
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1492
+ if (isFixed === void 0) {
1493
+ isFixed = false;
1494
+ }
1495
+ return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element);
1496
+ }
1497
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1498
+ if (includeScale === void 0) {
1499
+ includeScale = false;
1500
+ }
1501
+ if (isFixedStrategy === void 0) {
1502
+ isFixedStrategy = false;
1503
+ }
1504
+ const clientRect = element.getBoundingClientRect();
1505
+ const domElement = unwrapElement(element);
1506
+ let scale = createCoords(1);
1507
+ if (includeScale) {
1508
+ if (offsetParent) {
1509
+ if (isElement(offsetParent)) {
1510
+ scale = getScale(offsetParent);
1511
+ }
1512
+ } else {
1513
+ scale = getScale(element);
1514
+ }
1515
+ }
1516
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1517
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1518
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1519
+ let width = clientRect.width / scale.x;
1520
+ let height = clientRect.height / scale.y;
1521
+ if (domElement && offsetParent) {
1522
+ const win = getWindow(domElement);
1523
+ const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1524
+ let currentWin = win;
1525
+ let currentIFrame = getFrameElement(currentWin);
1526
+ while (currentIFrame && offsetWin !== currentWin) {
1527
+ const iframeScale = getScale(currentIFrame);
1528
+ const iframeRect = currentIFrame.getBoundingClientRect();
1529
+ const css = getComputedStyle$1(currentIFrame);
1530
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1531
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1532
+ x *= iframeScale.x;
1533
+ y *= iframeScale.y;
1534
+ width *= iframeScale.x;
1535
+ height *= iframeScale.y;
1536
+ x += left;
1537
+ y += top;
1538
+ currentWin = getWindow(currentIFrame);
1539
+ currentIFrame = getFrameElement(currentWin);
1540
+ }
1541
+ }
1542
+ return rectToClientRect({
1543
+ width,
1544
+ height,
1545
+ x,
1546
+ y
1547
+ });
1548
+ }
1549
+ function getWindowScrollBarX(element, rect) {
1550
+ const leftScroll = getNodeScroll(element).scrollLeft;
1551
+ if (!rect) {
1552
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1553
+ }
1554
+ return rect.left + leftScroll;
1555
+ }
1556
+ function getHTMLOffset(documentElement, scroll) {
1557
+ const htmlRect = documentElement.getBoundingClientRect();
1558
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1559
+ const y = htmlRect.top + scroll.scrollTop;
1560
+ return {
1561
+ x,
1562
+ y
1563
+ };
1564
+ }
1565
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1566
+ let {
1567
+ elements,
1568
+ rect,
1569
+ offsetParent,
1570
+ strategy
1571
+ } = _ref;
1572
+ const isFixed = strategy === "fixed";
1573
+ const documentElement = getDocumentElement(offsetParent);
1574
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1575
+ if (offsetParent === documentElement || topLayer && isFixed) {
1576
+ return rect;
1577
+ }
1578
+ let scroll = {
1579
+ scrollLeft: 0,
1580
+ scrollTop: 0
1581
+ };
1582
+ let scale = createCoords(1);
1583
+ const offsets = createCoords(0);
1584
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1585
+ if (isOffsetParentAnElement || !isFixed) {
1586
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1587
+ scroll = getNodeScroll(offsetParent);
1588
+ }
1589
+ if (isOffsetParentAnElement) {
1590
+ const offsetRect = getBoundingClientRect(offsetParent);
1591
+ scale = getScale(offsetParent);
1592
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1593
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1594
+ }
1595
+ }
1596
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1597
+ return {
1598
+ width: rect.width * scale.x,
1599
+ height: rect.height * scale.y,
1600
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1601
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1602
+ };
1603
+ }
1604
+ function getClientRects(element) {
1605
+ return element.getClientRects ? Array.from(element.getClientRects()) : [];
1606
+ }
1607
+ function getDocumentRect(html) {
1608
+ const scroll = getNodeScroll(html);
1609
+ const body = html.ownerDocument.body;
1610
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1611
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1612
+ let x = -scroll.scrollLeft + getWindowScrollBarX(html);
1613
+ const y = -scroll.scrollTop;
1614
+ if (getComputedStyle$1(body).direction === "rtl") {
1615
+ x += max(html.clientWidth, body.clientWidth) - width;
1616
+ }
1617
+ return {
1618
+ width,
1619
+ height,
1620
+ x,
1621
+ y
1622
+ };
1623
+ }
1624
+ const SCROLLBAR_MAX = 25;
1625
+ function getViewportRect(element, strategy, rootBoundary) {
1626
+ if (rootBoundary === void 0) {
1627
+ rootBoundary = "viewport";
1628
+ }
1629
+ const isLayoutViewport = rootBoundary === "layoutViewport";
1630
+ const win = getWindow(element);
1631
+ const html = getDocumentElement(element);
1632
+ const visualViewport = win.visualViewport;
1633
+ let width = html.clientWidth;
1634
+ let height = html.clientHeight;
1635
+ let x = 0;
1636
+ let y = 0;
1637
+ if (visualViewport) {
1638
+ const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed";
1639
+ if (isLayoutViewport) {
1640
+ if (!layoutRelativeClientCoords) {
1641
+ x = -visualViewport.offsetLeft;
1642
+ y = -visualViewport.offsetTop;
1643
+ }
1644
+ } else {
1645
+ width = visualViewport.width;
1646
+ height = visualViewport.height;
1647
+ if (layoutRelativeClientCoords) {
1648
+ x = visualViewport.offsetLeft;
1649
+ y = visualViewport.offsetTop;
1650
+ }
1651
+ }
1652
+ }
1653
+ const windowScrollbarX = getWindowScrollBarX(html);
1654
+ if (windowScrollbarX <= 0) {
1655
+ const doc = html.ownerDocument;
1656
+ const body = doc.body;
1657
+ const bodyStyles = getComputedStyle(body);
1658
+ const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1659
+ const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1660
+ const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth;
1661
+ if (gutter <= SCROLLBAR_MAX) {
1662
+ width -= gutter;
1663
+ }
1664
+ }
1665
+ return {
1666
+ width,
1667
+ height,
1668
+ x,
1669
+ y
1670
+ };
1671
+ }
1672
+ function getInnerBoundingClientRect(element, strategy) {
1673
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1674
+ const top = clientRect.top + element.clientTop;
1675
+ const left = clientRect.left + element.clientLeft;
1676
+ const scale = getScale(element);
1677
+ const width = element.clientWidth * scale.x;
1678
+ const height = element.clientHeight * scale.y;
1679
+ const x = left * scale.x;
1680
+ const y = top * scale.y;
1681
+ return {
1682
+ width,
1683
+ height,
1684
+ x,
1685
+ y
1686
+ };
1687
+ }
1688
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1689
+ let rect;
1690
+ if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") {
1691
+ rect = getViewportRect(element, strategy, clippingAncestor);
1692
+ } else if (clippingAncestor === "document") {
1693
+ rect = getDocumentRect(getDocumentElement(element));
1694
+ } else if (isElement(clippingAncestor)) {
1695
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1696
+ } else {
1697
+ const visualOffsets = getVisualOffsets(element);
1698
+ rect = {
1699
+ x: clippingAncestor.x - visualOffsets.x,
1700
+ y: clippingAncestor.y - visualOffsets.y,
1701
+ width: clippingAncestor.width,
1702
+ height: clippingAncestor.height
1703
+ };
1704
+ }
1705
+ return rectToClientRect(rect);
1706
+ }
1707
+ function getClippingElementAncestors(element, cache) {
1708
+ const cachedResult = cache.get(element);
1709
+ if (cachedResult) {
1710
+ return cachedResult;
1711
+ }
1712
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
1713
+ let lastKeptComputedStyle = null;
1714
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
1715
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1716
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1717
+ const computedStyle = getComputedStyle$1(currentNode);
1718
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1719
+ const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : "";
1720
+ const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static");
1721
+ if (shouldDropCurrentNode) {
1722
+ result = result.filter((ancestor) => ancestor !== currentNode);
1723
+ } else {
1724
+ lastKeptComputedStyle = computedStyle;
1725
+ }
1726
+ currentNode = getParentNode(currentNode);
1727
+ }
1728
+ cache.set(element, result);
1729
+ return result;
1730
+ }
1731
+ function getClippingRect(_ref) {
1732
+ let {
1733
+ element,
1734
+ boundary,
1735
+ rootBoundary,
1736
+ strategy
1737
+ } = _ref;
1738
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1739
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1740
+ const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
1741
+ let top = firstRect.top;
1742
+ let right = firstRect.right;
1743
+ let bottom = firstRect.bottom;
1744
+ let left = firstRect.left;
1745
+ for (let i = 1; i < clippingAncestors.length; i++) {
1746
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
1747
+ top = max(rect.top, top);
1748
+ right = min(rect.right, right);
1749
+ bottom = min(rect.bottom, bottom);
1750
+ left = max(rect.left, left);
1751
+ }
1752
+ return {
1753
+ width: right - left,
1754
+ height: bottom - top,
1755
+ x: left,
1756
+ y: top
1757
+ };
1758
+ }
1759
+ function getDimensions(element) {
1760
+ const {
1761
+ width,
1762
+ height
1763
+ } = getCssDimensions(element);
1764
+ return {
1765
+ width,
1766
+ height
1767
+ };
1768
+ }
1769
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1770
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1771
+ const documentElement = getDocumentElement(offsetParent);
1772
+ const isFixed = strategy === "fixed";
1773
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1774
+ let scroll = {
1775
+ scrollLeft: 0,
1776
+ scrollTop: 0
1777
+ };
1778
+ const offsets = createCoords(0);
1779
+ if (isOffsetParentAnElement || !isFixed) {
1780
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1781
+ scroll = getNodeScroll(offsetParent);
1782
+ }
1783
+ if (isOffsetParentAnElement) {
1784
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1785
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1786
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1787
+ }
1788
+ }
1789
+ if (!isOffsetParentAnElement && documentElement) {
1790
+ offsets.x = getWindowScrollBarX(documentElement);
1791
+ }
1792
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1793
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1794
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1795
+ return {
1796
+ x,
1797
+ y,
1798
+ width: rect.width,
1799
+ height: rect.height
1800
+ };
1801
+ }
1802
+ function isStaticPositioned(element) {
1803
+ return getComputedStyle$1(element).position === "static";
1804
+ }
1805
+ function getTrueOffsetParent(element, polyfill) {
1806
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
1807
+ return null;
1808
+ }
1809
+ if (polyfill) {
1810
+ return polyfill(element);
1811
+ }
1812
+ let rawOffsetParent = element.offsetParent;
1813
+ if (getDocumentElement(element) === rawOffsetParent) {
1814
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1815
+ }
1816
+ return rawOffsetParent;
1817
+ }
1818
+ function getOffsetParent(element, polyfill) {
1819
+ const win = getWindow(element);
1820
+ if (isTopLayer(element)) {
1821
+ return win;
1822
+ }
1823
+ if (!isHTMLElement(element)) {
1824
+ let svgOffsetParent = getParentNode(element);
1825
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1826
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1827
+ return svgOffsetParent;
1828
+ }
1829
+ svgOffsetParent = getParentNode(svgOffsetParent);
1830
+ }
1831
+ return win;
1832
+ }
1833
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1834
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1835
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1836
+ }
1837
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1838
+ return win;
1839
+ }
1840
+ return offsetParent || getContainingBlock(element) || win;
1841
+ }
1842
+ const getElementRects = async function(data) {
1843
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1844
+ const getDimensionsFn = this.getDimensions;
1845
+ const floatingDimensions = await getDimensionsFn(data.floating);
1846
+ return {
1847
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1848
+ floating: {
1849
+ x: 0,
1850
+ y: 0,
1851
+ width: floatingDimensions.width,
1852
+ height: floatingDimensions.height
1853
+ }
1854
+ };
1855
+ };
1856
+ function isRTL(element) {
1857
+ return getComputedStyle$1(element).direction === "rtl";
1858
+ }
1859
+ const platform = {
1860
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1861
+ getDocumentElement,
1862
+ getClippingRect,
1863
+ getOffsetParent,
1864
+ getElementRects,
1865
+ getClientRects,
1866
+ getDimensions,
1867
+ getScale,
1868
+ isElement,
1869
+ isRTL
1870
+ };
1871
+ function rectsAreEqual(a, b) {
1872
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1873
+ }
1874
+ function observeMove(element, onMove, ancestorResize) {
1875
+ let io = null;
1876
+ let timeoutId;
1877
+ const root = getDocumentElement(element);
1878
+ function cleanup() {
1879
+ var _io;
1880
+ clearTimeout(timeoutId);
1881
+ (_io = io) == null || _io.disconnect();
1882
+ io = null;
1883
+ }
1884
+ function refresh(skip, threshold) {
1885
+ if (skip === void 0) {
1886
+ skip = false;
1887
+ }
1888
+ if (threshold === void 0) {
1889
+ threshold = 1;
1890
+ }
1891
+ cleanup();
1892
+ const elementRectForRootMargin = element.getBoundingClientRect();
1893
+ const {
1894
+ left,
1895
+ top,
1896
+ width,
1897
+ height
1898
+ } = elementRectForRootMargin;
1899
+ if (!skip) {
1900
+ onMove();
1901
+ }
1902
+ if (!width || !height) {
1903
+ return;
1904
+ }
1905
+ const insetTop = floor(top);
1906
+ const insetRight = floor(root.clientWidth - (left + width));
1907
+ const insetBottom = floor(root.clientHeight - (top + height));
1908
+ const insetLeft = floor(left);
1909
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1910
+ const options = {
1911
+ rootMargin,
1912
+ threshold: max(0, min(1, threshold)) || 1
1913
+ };
1914
+ let isFirstUpdate = true;
1915
+ function handleObserve(entries) {
1916
+ const ratio = entries[0].intersectionRatio;
1917
+ if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1918
+ return refresh();
1919
+ }
1920
+ if (ratio !== threshold) {
1921
+ if (!isFirstUpdate) {
1922
+ return refresh();
1923
+ }
1924
+ if (!ratio) {
1925
+ timeoutId = setTimeout(() => {
1926
+ refresh(false, 1e-7);
1927
+ }, 1e3);
1928
+ } else {
1929
+ refresh(false, ratio);
1930
+ }
1931
+ }
1932
+ isFirstUpdate = false;
1933
+ }
1934
+ try {
1935
+ io = new IntersectionObserver(handleObserve, {
1936
+ ...options,
1937
+ // Handle <iframe>s
1938
+ root: root.ownerDocument
1939
+ });
1940
+ } catch (_e) {
1941
+ io = new IntersectionObserver(handleObserve, options);
1942
+ }
1943
+ io.observe(element);
1944
+ }
1945
+ const win = getWindow(element);
1946
+ const handleResize = () => refresh(ancestorResize);
1947
+ win.addEventListener("resize", handleResize);
1948
+ refresh(true);
1949
+ return () => {
1950
+ win.removeEventListener("resize", handleResize);
1951
+ cleanup();
1952
+ };
1953
+ }
1954
+ function autoUpdate(reference, floating, update, options) {
1955
+ if (options === void 0) {
1956
+ options = {};
1957
+ }
1958
+ const {
1959
+ ancestorScroll = true,
1960
+ ancestorResize = true,
1961
+ elementResize = typeof ResizeObserver === "function",
1962
+ layoutShift = typeof IntersectionObserver === "function",
1963
+ animationFrame = false
1964
+ } = options;
1965
+ const referenceEl = unwrapElement(reference);
1966
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
1967
+ ancestors.forEach((ancestor) => {
1968
+ ancestorScroll && ancestor.addEventListener("scroll", update);
1969
+ ancestorResize && ancestor.addEventListener("resize", update);
1970
+ });
1971
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update, ancestorResize) : null;
1972
+ let reobserveFrame = -1;
1973
+ let resizeObserver = null;
1974
+ if (elementResize) {
1975
+ resizeObserver = new ResizeObserver((_ref) => {
1976
+ let [firstEntry] = _ref;
1977
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
1978
+ resizeObserver.unobserve(floating);
1979
+ cancelAnimationFrame(reobserveFrame);
1980
+ reobserveFrame = requestAnimationFrame(() => {
1981
+ var _resizeObserver;
1982
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
1983
+ });
1984
+ }
1985
+ update();
1986
+ });
1987
+ if (referenceEl && !animationFrame) {
1988
+ resizeObserver.observe(referenceEl);
1989
+ }
1990
+ if (floating) {
1991
+ resizeObserver.observe(floating);
1992
+ }
1993
+ }
1994
+ let frameId;
1995
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
1996
+ if (animationFrame) {
1997
+ frameLoop();
1998
+ }
1999
+ function frameLoop() {
2000
+ const nextRefRect = getBoundingClientRect(reference);
2001
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
2002
+ update();
2003
+ }
2004
+ prevRefRect = nextRefRect;
2005
+ frameId = requestAnimationFrame(frameLoop);
2006
+ }
2007
+ update();
2008
+ return () => {
2009
+ var _resizeObserver2;
2010
+ ancestors.forEach((ancestor) => {
2011
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
2012
+ ancestorResize && ancestor.removeEventListener("resize", update);
2013
+ });
2014
+ cleanupIo == null || cleanupIo();
2015
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2016
+ resizeObserver = null;
2017
+ if (animationFrame) {
2018
+ cancelAnimationFrame(frameId);
2019
+ }
2020
+ };
2021
+ }
2022
+ const offset$1 = offset$2;
2023
+ const shift$1 = shift$2;
2024
+ const flip$1 = flip$2;
2025
+ const size$1 = size$2;
2026
+ const hide$1 = hide$2;
2027
+ const arrow$2 = arrow$3;
2028
+ const limitShift$1 = limitShift$2;
2029
+ const computePosition = (reference, floating, options) => {
2030
+ const cache = /* @__PURE__ */ new Map();
2031
+ const mergedOptions = options != null ? options : {};
2032
+ const platformWithCache = {
2033
+ ...platform,
2034
+ ...mergedOptions.platform,
2035
+ _c: cache
2036
+ };
2037
+ return computePosition$1(reference, floating, {
2038
+ ...mergedOptions,
2039
+ platform: platformWithCache
2040
+ });
2041
+ };
2042
+ var isClient = typeof document !== "undefined";
2043
+ var noop = function noop2() {
2044
+ };
2045
+ var index = isClient ? reactExports.useLayoutEffect : noop;
2046
+ function deepEqual(a, b) {
2047
+ if (a === b) {
2048
+ return true;
2049
+ }
2050
+ if (typeof a !== typeof b) {
2051
+ return false;
2052
+ }
2053
+ if (typeof a === "function" && a.toString() === b.toString()) {
2054
+ return true;
2055
+ }
2056
+ let length;
2057
+ let i;
2058
+ let keys;
2059
+ if (a && b && typeof a === "object") {
2060
+ if (Array.isArray(a)) {
2061
+ length = a.length;
2062
+ if (length !== b.length) return false;
2063
+ for (i = length; i-- !== 0; ) {
2064
+ if (!deepEqual(a[i], b[i])) {
2065
+ return false;
2066
+ }
2067
+ }
2068
+ return true;
2069
+ }
2070
+ keys = Object.keys(a);
2071
+ length = keys.length;
2072
+ if (length !== Object.keys(b).length) {
2073
+ return false;
2074
+ }
2075
+ for (i = length; i-- !== 0; ) {
2076
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
2077
+ return false;
2078
+ }
2079
+ }
2080
+ for (i = length; i-- !== 0; ) {
2081
+ const key = keys[i];
2082
+ if (key === "_owner" && a.$$typeof) {
2083
+ continue;
2084
+ }
2085
+ if (!deepEqual(a[key], b[key])) {
2086
+ return false;
2087
+ }
2088
+ }
2089
+ return true;
2090
+ }
2091
+ return a !== a && b !== b;
2092
+ }
2093
+ function getDPR(element) {
2094
+ if (typeof window === "undefined") {
2095
+ return 1;
2096
+ }
2097
+ const win = element.ownerDocument.defaultView || window;
2098
+ return win.devicePixelRatio || 1;
2099
+ }
2100
+ function roundByDPR(element, value) {
2101
+ const dpr = getDPR(element);
2102
+ return Math.round(value * dpr) / dpr;
2103
+ }
2104
+ function useLatestRef(value) {
2105
+ const ref = reactExports.useRef(value);
2106
+ index(() => {
2107
+ ref.current = value;
2108
+ });
2109
+ return ref;
2110
+ }
2111
+ function useFloating(options) {
2112
+ if (options === void 0) {
2113
+ options = {};
2114
+ }
2115
+ const {
2116
+ placement = "bottom",
2117
+ strategy = "absolute",
2118
+ middleware = [],
2119
+ platform: platform2,
2120
+ elements: {
2121
+ reference: externalReference,
2122
+ floating: externalFloating
2123
+ } = {},
2124
+ transform = true,
2125
+ whileElementsMounted,
2126
+ open
2127
+ } = options;
2128
+ const [data, setData] = reactExports.useState({
2129
+ x: 0,
2130
+ y: 0,
2131
+ strategy,
2132
+ placement,
2133
+ middlewareData: {},
2134
+ isPositioned: false
2135
+ });
2136
+ const [latestMiddleware, setLatestMiddleware] = reactExports.useState(middleware);
2137
+ if (!deepEqual(latestMiddleware, middleware)) {
2138
+ setLatestMiddleware(middleware);
2139
+ }
2140
+ const [_reference, _setReference] = reactExports.useState(null);
2141
+ const [_floating, _setFloating] = reactExports.useState(null);
2142
+ const setReference = reactExports.useCallback((node) => {
2143
+ if (node !== referenceRef.current) {
2144
+ referenceRef.current = node;
2145
+ _setReference(node);
2146
+ }
2147
+ }, []);
2148
+ const setFloating = reactExports.useCallback((node) => {
2149
+ if (node !== floatingRef.current) {
2150
+ floatingRef.current = node;
2151
+ _setFloating(node);
2152
+ }
2153
+ }, []);
2154
+ const referenceEl = externalReference || _reference;
2155
+ const floatingEl = externalFloating || _floating;
2156
+ const referenceRef = reactExports.useRef(null);
2157
+ const floatingRef = reactExports.useRef(null);
2158
+ const dataRef = reactExports.useRef(data);
2159
+ const hasWhileElementsMounted = whileElementsMounted != null;
2160
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
2161
+ const platformRef = useLatestRef(platform2);
2162
+ const openRef = useLatestRef(open);
2163
+ const update = reactExports.useCallback(() => {
2164
+ if (!referenceRef.current || !floatingRef.current) {
2165
+ return;
2166
+ }
2167
+ const config = {
2168
+ placement,
2169
+ strategy,
2170
+ middleware: latestMiddleware
2171
+ };
2172
+ if (platformRef.current) {
2173
+ config.platform = platformRef.current;
2174
+ }
2175
+ computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
2176
+ const fullData = {
2177
+ ...data2,
2178
+ // The floating element's position may be recomputed while it's closed
2179
+ // but still mounted (such as when transitioning out). To ensure
2180
+ // `isPositioned` will be `false` initially on the next open, avoid
2181
+ // setting it to `true` when `open === false` (must be specified).
2182
+ isPositioned: openRef.current !== false
2183
+ };
2184
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
2185
+ dataRef.current = fullData;
2186
+ reactDomExports.flushSync(() => {
2187
+ setData(fullData);
2188
+ });
2189
+ }
2190
+ });
2191
+ }, [latestMiddleware, placement, strategy, platformRef, openRef]);
2192
+ index(() => {
2193
+ if (open === false && dataRef.current.isPositioned) {
2194
+ dataRef.current.isPositioned = false;
2195
+ setData((data2) => ({
2196
+ ...data2,
2197
+ isPositioned: false
2198
+ }));
2199
+ }
2200
+ }, [open]);
2201
+ const isMountedRef = reactExports.useRef(false);
2202
+ index(() => {
2203
+ isMountedRef.current = true;
2204
+ return () => {
2205
+ isMountedRef.current = false;
2206
+ };
2207
+ }, []);
2208
+ index(() => {
2209
+ if (referenceEl) referenceRef.current = referenceEl;
2210
+ if (floatingEl) floatingRef.current = floatingEl;
2211
+ if (referenceEl && floatingEl) {
2212
+ if (whileElementsMountedRef.current) {
2213
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
2214
+ }
2215
+ update();
2216
+ }
2217
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
2218
+ const refs = reactExports.useMemo(() => ({
2219
+ reference: referenceRef,
2220
+ floating: floatingRef,
2221
+ setReference,
2222
+ setFloating
2223
+ }), [setReference, setFloating]);
2224
+ const elements = reactExports.useMemo(() => ({
2225
+ reference: referenceEl,
2226
+ floating: floatingEl
2227
+ }), [referenceEl, floatingEl]);
2228
+ const floatingStyles = reactExports.useMemo(() => {
2229
+ const initialStyles = {
2230
+ position: strategy,
2231
+ left: 0,
2232
+ top: 0
2233
+ };
2234
+ if (!elements.floating) {
2235
+ return initialStyles;
2236
+ }
2237
+ const x = roundByDPR(elements.floating, data.x);
2238
+ const y = roundByDPR(elements.floating, data.y);
2239
+ if (transform) {
2240
+ return {
2241
+ ...initialStyles,
2242
+ transform: "translate(" + x + "px, " + y + "px)",
2243
+ ...getDPR(elements.floating) >= 1.5 && {
2244
+ willChange: "transform"
2245
+ }
2246
+ };
2247
+ }
2248
+ return {
2249
+ position: strategy,
2250
+ left: x,
2251
+ top: y
2252
+ };
2253
+ }, [strategy, transform, elements.floating, data.x, data.y]);
2254
+ return reactExports.useMemo(() => ({
2255
+ ...data,
2256
+ update,
2257
+ refs,
2258
+ elements,
2259
+ floatingStyles
2260
+ }), [data, update, refs, elements, floatingStyles]);
2261
+ }
2262
+ const arrow$1 = (options) => {
2263
+ function isRef(value) {
2264
+ return {}.hasOwnProperty.call(value, "current");
2265
+ }
2266
+ return {
2267
+ name: "arrow",
2268
+ options,
2269
+ fn(state) {
2270
+ const {
2271
+ element,
2272
+ padding
2273
+ } = typeof options === "function" ? options(state) : options;
2274
+ if (element && isRef(element)) {
2275
+ if (element.current != null) {
2276
+ return arrow$2({
2277
+ element: element.current,
2278
+ padding
2279
+ }).fn(state);
2280
+ }
2281
+ return {};
2282
+ }
2283
+ if (element) {
2284
+ return arrow$2({
2285
+ element,
2286
+ padding
2287
+ }).fn(state);
2288
+ }
2289
+ return {};
2290
+ }
2291
+ };
2292
+ };
2293
+ const offset = (options, deps) => {
2294
+ const result = offset$1(options);
2295
+ return {
2296
+ name: result.name,
2297
+ fn: result.fn,
2298
+ options: [options, deps]
2299
+ };
2300
+ };
2301
+ const shift = (options, deps) => {
2302
+ const result = shift$1(options);
2303
+ return {
2304
+ name: result.name,
2305
+ fn: result.fn,
2306
+ options: [options, deps]
2307
+ };
2308
+ };
2309
+ const limitShift = (options, deps) => {
2310
+ const result = limitShift$1(options);
2311
+ return {
2312
+ fn: result.fn,
2313
+ options: [options, deps]
2314
+ };
2315
+ };
2316
+ const flip = (options, deps) => {
2317
+ const result = flip$1(options);
2318
+ return {
2319
+ name: result.name,
2320
+ fn: result.fn,
2321
+ options: [options, deps]
2322
+ };
2323
+ };
2324
+ const size = (options, deps) => {
2325
+ const result = size$1(options);
2326
+ return {
2327
+ name: result.name,
2328
+ fn: result.fn,
2329
+ options: [options, deps]
2330
+ };
2331
+ };
2332
+ const hide = (options, deps) => {
2333
+ const result = hide$1(options);
2334
+ return {
2335
+ name: result.name,
2336
+ fn: result.fn,
2337
+ options: [options, deps]
2338
+ };
2339
+ };
2340
+ const arrow = (options, deps) => {
2341
+ const result = arrow$1(options);
2342
+ return {
2343
+ name: result.name,
2344
+ fn: result.fn,
2345
+ options: [options, deps]
2346
+ };
2347
+ };
2348
+ var NAME$1 = "Arrow";
2349
+ var Arrow$1 = reactExports.forwardRef((props, forwardedRef) => {
2350
+ const { children, width = 10, height = 5, ...arrowProps } = props;
2351
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
2352
+ Primitive.svg,
2353
+ {
2354
+ ...arrowProps,
2355
+ ref: forwardedRef,
2356
+ width,
2357
+ height,
2358
+ viewBox: "0 0 30 10",
2359
+ preserveAspectRatio: "none",
2360
+ children: props.asChild ? children : /* @__PURE__ */ jsxRuntimeExports.jsx("polygon", { points: "0,0 30,0 15,10" })
2361
+ }
2362
+ );
2363
+ });
2364
+ Arrow$1.displayName = NAME$1;
2365
+ var Root$1 = Arrow$1;
2366
+ function useSize(element) {
2367
+ const [size2, setSize] = reactExports.useState(void 0);
2368
+ useLayoutEffect2(() => {
2369
+ if (element) {
2370
+ setSize({ width: element.offsetWidth, height: element.offsetHeight });
2371
+ const resizeObserver = new ResizeObserver((entries) => {
2372
+ if (!Array.isArray(entries)) {
2373
+ return;
2374
+ }
2375
+ if (!entries.length) {
2376
+ return;
2377
+ }
2378
+ const entry = entries[0];
2379
+ let width;
2380
+ let height;
2381
+ if ("borderBoxSize" in entry) {
2382
+ const borderSizeEntry = entry["borderBoxSize"];
2383
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
2384
+ width = borderSize["inlineSize"];
2385
+ height = borderSize["blockSize"];
2386
+ } else {
2387
+ width = element.offsetWidth;
2388
+ height = element.offsetHeight;
2389
+ }
2390
+ setSize({ width, height });
2391
+ });
2392
+ resizeObserver.observe(element, { box: "border-box" });
2393
+ return () => resizeObserver.unobserve(element);
2394
+ } else {
2395
+ setSize(void 0);
2396
+ }
2397
+ }, [element]);
2398
+ return size2;
2399
+ }
2400
+ var POPPER_NAME = "Popper";
2401
+ var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
2402
+ var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
2403
+ var Popper = (props) => {
2404
+ const { __scopePopper, children } = props;
2405
+ const [anchor, setAnchor] = reactExports.useState(null);
2406
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PopperProvider, { scope: __scopePopper, anchor, onAnchorChange: setAnchor, children });
2407
+ };
2408
+ Popper.displayName = POPPER_NAME;
2409
+ var ANCHOR_NAME = "PopperAnchor";
2410
+ var PopperAnchor = reactExports.forwardRef(
2411
+ (props, forwardedRef) => {
2412
+ const { __scopePopper, virtualRef, ...anchorProps } = props;
2413
+ const context = usePopperContext(ANCHOR_NAME, __scopePopper);
2414
+ const ref = reactExports.useRef(null);
2415
+ const composedRefs = useComposedRefs(forwardedRef, ref);
2416
+ const anchorRef = reactExports.useRef(null);
2417
+ reactExports.useEffect(() => {
2418
+ const previousAnchor = anchorRef.current;
2419
+ anchorRef.current = virtualRef?.current || ref.current;
2420
+ if (previousAnchor !== anchorRef.current) {
2421
+ context.onAnchorChange(anchorRef.current);
2422
+ }
2423
+ });
2424
+ return virtualRef ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...anchorProps, ref: composedRefs });
2425
+ }
2426
+ );
2427
+ PopperAnchor.displayName = ANCHOR_NAME;
2428
+ var CONTENT_NAME$1 = "PopperContent";
2429
+ var [PopperContentProvider, useContentContext] = createPopperContext(CONTENT_NAME$1);
2430
+ var PopperContent = reactExports.forwardRef(
2431
+ (props, forwardedRef) => {
2432
+ const {
2433
+ __scopePopper,
2434
+ side = "bottom",
2435
+ sideOffset = 0,
2436
+ align = "center",
2437
+ alignOffset = 0,
2438
+ arrowPadding = 0,
2439
+ avoidCollisions = true,
2440
+ collisionBoundary = [],
2441
+ collisionPadding: collisionPaddingProp = 0,
2442
+ sticky = "partial",
2443
+ hideWhenDetached = false,
2444
+ updatePositionStrategy = "optimized",
2445
+ onPlaced,
2446
+ ...contentProps
2447
+ } = props;
2448
+ const context = usePopperContext(CONTENT_NAME$1, __scopePopper);
2449
+ const [content, setContent] = reactExports.useState(null);
2450
+ const composedRefs = useComposedRefs(forwardedRef, (node) => setContent(node));
2451
+ const [arrow$12, setArrow] = reactExports.useState(null);
2452
+ const arrowSize = useSize(arrow$12);
2453
+ const arrowWidth = arrowSize?.width ?? 0;
2454
+ const arrowHeight = arrowSize?.height ?? 0;
2455
+ const desiredPlacement = side + (align !== "center" ? "-" + align : "");
2456
+ const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : { top: 0, right: 0, bottom: 0, left: 0, ...collisionPaddingProp };
2457
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [collisionBoundary];
2458
+ const hasExplicitBoundaries = boundary.length > 0;
2459
+ const detectOverflowOptions = {
2460
+ padding: collisionPadding,
2461
+ boundary: boundary.filter(isNotNull),
2462
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
2463
+ altBoundary: hasExplicitBoundaries
2464
+ };
2465
+ const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
2466
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
2467
+ strategy: "fixed",
2468
+ placement: desiredPlacement,
2469
+ whileElementsMounted: (...args) => {
2470
+ const cleanup = autoUpdate(...args, {
2471
+ animationFrame: updatePositionStrategy === "always"
2472
+ });
2473
+ return cleanup;
2474
+ },
2475
+ elements: {
2476
+ reference: context.anchor
2477
+ },
2478
+ middleware: [
2479
+ offset({ mainAxis: sideOffset + arrowHeight, alignmentAxis: alignOffset }),
2480
+ avoidCollisions && shift({
2481
+ mainAxis: true,
2482
+ crossAxis: false,
2483
+ limiter: sticky === "partial" ? limitShift() : void 0,
2484
+ ...detectOverflowOptions
2485
+ }),
2486
+ avoidCollisions && flip({ ...detectOverflowOptions }),
2487
+ size({
2488
+ ...detectOverflowOptions,
2489
+ apply: ({ elements, rects, availableWidth, availableHeight }) => {
2490
+ const { width: anchorWidth, height: anchorHeight } = rects.reference;
2491
+ const contentStyle = elements.floating.style;
2492
+ contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
2493
+ contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
2494
+ contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
2495
+ contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
2496
+ }
2497
+ }),
2498
+ arrow$12 && arrow({ element: arrow$12, padding: arrowPadding }),
2499
+ transformOrigin({ arrowWidth, arrowHeight }),
2500
+ hideWhenDetached && hide({ strategy: "referenceHidden", ...detectOverflowOptions })
2501
+ ]
2502
+ });
2503
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
2504
+ const handlePlaced = useCallbackRef(onPlaced);
2505
+ useLayoutEffect2(() => {
2506
+ if (isPositioned) {
2507
+ handlePlaced?.();
2508
+ }
2509
+ }, [isPositioned, handlePlaced]);
2510
+ const arrowX = middlewareData.arrow?.x;
2511
+ const arrowY = middlewareData.arrow?.y;
2512
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
2513
+ const [contentZIndex, setContentZIndex] = reactExports.useState();
2514
+ useLayoutEffect2(() => {
2515
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
2516
+ }, [content]);
2517
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
2518
+ "div",
2519
+ {
2520
+ ref: refs.setFloating,
2521
+ "data-radix-popper-content-wrapper": "",
2522
+ style: {
2523
+ ...floatingStyles,
2524
+ transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
2525
+ // keep off the page when measuring
2526
+ minWidth: "max-content",
2527
+ zIndex: contentZIndex,
2528
+ ["--radix-popper-transform-origin"]: [
2529
+ middlewareData.transformOrigin?.x,
2530
+ middlewareData.transformOrigin?.y
2531
+ ].join(" "),
2532
+ // hide the content if using the hide middleware and should be hidden
2533
+ // set visibility to hidden and disable pointer events so the UI behaves
2534
+ // as if the PopperContent isn't there at all
2535
+ ...middlewareData.hide?.referenceHidden && {
2536
+ visibility: "hidden",
2537
+ pointerEvents: "none"
2538
+ }
2539
+ },
2540
+ dir: props.dir,
2541
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2542
+ PopperContentProvider,
2543
+ {
2544
+ scope: __scopePopper,
2545
+ placedSide,
2546
+ onArrowChange: setArrow,
2547
+ arrowX,
2548
+ arrowY,
2549
+ shouldHideArrow: cannotCenterArrow,
2550
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2551
+ Primitive.div,
2552
+ {
2553
+ "data-side": placedSide,
2554
+ "data-align": placedAlign,
2555
+ ...contentProps,
2556
+ ref: composedRefs,
2557
+ style: {
2558
+ ...contentProps.style,
2559
+ // if the PopperContent hasn't been placed yet (not all measurements done)
2560
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
2561
+ animation: !isPositioned ? "none" : void 0
2562
+ }
2563
+ }
2564
+ )
2565
+ }
2566
+ )
2567
+ }
2568
+ );
2569
+ }
2570
+ );
2571
+ PopperContent.displayName = CONTENT_NAME$1;
2572
+ var ARROW_NAME$1 = "PopperArrow";
2573
+ var OPPOSITE_SIDE = {
2574
+ top: "bottom",
2575
+ right: "left",
2576
+ bottom: "top",
2577
+ left: "right"
2578
+ };
2579
+ var PopperArrow = reactExports.forwardRef(function PopperArrow2(props, forwardedRef) {
2580
+ const { __scopePopper, ...arrowProps } = props;
2581
+ const contentContext = useContentContext(ARROW_NAME$1, __scopePopper);
2582
+ const baseSide = OPPOSITE_SIDE[contentContext.placedSide];
2583
+ return (
2584
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
2585
+ // doesn't report size as we'd expect on SVG elements.
2586
+ // it reports their bounding box which is effectively the largest path inside the SVG.
2587
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
2588
+ "span",
2589
+ {
2590
+ ref: contentContext.onArrowChange,
2591
+ style: {
2592
+ position: "absolute",
2593
+ left: contentContext.arrowX,
2594
+ top: contentContext.arrowY,
2595
+ [baseSide]: 0,
2596
+ transformOrigin: {
2597
+ top: "",
2598
+ right: "0 0",
2599
+ bottom: "center 0",
2600
+ left: "100% 0"
2601
+ }[contentContext.placedSide],
2602
+ transform: {
2603
+ top: "translateY(100%)",
2604
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
2605
+ bottom: `rotate(180deg)`,
2606
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
2607
+ }[contentContext.placedSide],
2608
+ visibility: contentContext.shouldHideArrow ? "hidden" : void 0
2609
+ },
2610
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2611
+ Root$1,
2612
+ {
2613
+ ...arrowProps,
2614
+ ref: forwardedRef,
2615
+ style: {
2616
+ ...arrowProps.style,
2617
+ // ensures the element can be measured correctly (mostly for if SVG)
2618
+ display: "block"
2619
+ }
2620
+ }
2621
+ )
2622
+ }
2623
+ )
2624
+ );
2625
+ });
2626
+ PopperArrow.displayName = ARROW_NAME$1;
2627
+ function isNotNull(value) {
2628
+ return value !== null;
2629
+ }
2630
+ var transformOrigin = (options) => ({
2631
+ name: "transformOrigin",
2632
+ options,
2633
+ fn(data) {
2634
+ const { placement, rects, middlewareData } = data;
2635
+ const cannotCenterArrow = middlewareData.arrow?.centerOffset !== 0;
2636
+ const isArrowHidden = cannotCenterArrow;
2637
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
2638
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
2639
+ const [placedSide, placedAlign] = getSideAndAlignFromPlacement(placement);
2640
+ const noArrowAlign = { start: "0%", center: "50%", end: "100%" }[placedAlign];
2641
+ const arrowXCenter = (middlewareData.arrow?.x ?? 0) + arrowWidth / 2;
2642
+ const arrowYCenter = (middlewareData.arrow?.y ?? 0) + arrowHeight / 2;
2643
+ let x = "";
2644
+ let y = "";
2645
+ if (placedSide === "bottom") {
2646
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2647
+ y = `${-arrowHeight}px`;
2648
+ } else if (placedSide === "top") {
2649
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2650
+ y = `${rects.floating.height + arrowHeight}px`;
2651
+ } else if (placedSide === "right") {
2652
+ x = `${-arrowHeight}px`;
2653
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2654
+ } else if (placedSide === "left") {
2655
+ x = `${rects.floating.width + arrowHeight}px`;
2656
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2657
+ }
2658
+ return { data: { x, y } };
2659
+ }
2660
+ });
2661
+ function getSideAndAlignFromPlacement(placement) {
2662
+ const [side, align = "center"] = placement.split("-");
2663
+ return [side, align];
2664
+ }
2665
+ var Root2 = Popper;
2666
+ var Anchor = PopperAnchor;
2667
+ var Content = PopperContent;
2668
+ var Arrow = PopperArrow;
2669
+ var PORTAL_NAME$1 = "Portal";
2670
+ var Portal$1 = reactExports.forwardRef((props, forwardedRef) => {
2671
+ const { container: containerProp, ...portalProps } = props;
2672
+ const [mounted, setMounted] = reactExports.useState(false);
2673
+ useLayoutEffect2(() => setMounted(true), []);
2674
+ const container = containerProp || mounted && globalThis?.document?.body;
2675
+ return container ? ReactDOM.createPortal(/* @__PURE__ */ jsxRuntimeExports.jsx(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
2676
+ });
2677
+ Portal$1.displayName = PORTAL_NAME$1;
2678
+ function useStateMachine(initialState, machine) {
2679
+ return reactExports.useReducer((state, event) => {
2680
+ const nextState = machine[state][event];
2681
+ return nextState ?? state;
2682
+ }, initialState);
2683
+ }
2684
+ var Presence = (props) => {
2685
+ const { present, children } = props;
2686
+ const presence = usePresence(present);
2687
+ const child = typeof children === "function" ? children({ present: presence.isPresent }) : reactExports.Children.only(children);
2688
+ const ref = useComposedRefs(presence.ref, getElementRef(child));
2689
+ const forceMount = typeof children === "function";
2690
+ return forceMount || presence.isPresent ? reactExports.cloneElement(child, { ref }) : null;
2691
+ };
2692
+ Presence.displayName = "Presence";
2693
+ function usePresence(present) {
2694
+ const [node, setNode] = reactExports.useState();
2695
+ const stylesRef = reactExports.useRef(null);
2696
+ const prevPresentRef = reactExports.useRef(present);
2697
+ const prevAnimationNameRef = reactExports.useRef("none");
2698
+ const initialState = present ? "mounted" : "unmounted";
2699
+ const [state, send] = useStateMachine(initialState, {
2700
+ mounted: {
2701
+ UNMOUNT: "unmounted",
2702
+ ANIMATION_OUT: "unmountSuspended"
2703
+ },
2704
+ unmountSuspended: {
2705
+ MOUNT: "mounted",
2706
+ ANIMATION_END: "unmounted"
2707
+ },
2708
+ unmounted: {
2709
+ MOUNT: "mounted"
2710
+ }
2711
+ });
2712
+ reactExports.useEffect(() => {
2713
+ const currentAnimationName = getAnimationName(stylesRef.current);
2714
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
2715
+ }, [state]);
2716
+ useLayoutEffect2(() => {
2717
+ const styles = stylesRef.current;
2718
+ const wasPresent = prevPresentRef.current;
2719
+ const hasPresentChanged = wasPresent !== present;
2720
+ if (hasPresentChanged) {
2721
+ const prevAnimationName = prevAnimationNameRef.current;
2722
+ const currentAnimationName = getAnimationName(styles);
2723
+ if (present) {
2724
+ send("MOUNT");
2725
+ } else if (currentAnimationName === "none" || styles?.display === "none") {
2726
+ send("UNMOUNT");
2727
+ } else {
2728
+ const isAnimating = prevAnimationName !== currentAnimationName;
2729
+ if (wasPresent && isAnimating) {
2730
+ send("ANIMATION_OUT");
2731
+ } else {
2732
+ send("UNMOUNT");
2733
+ }
2734
+ }
2735
+ prevPresentRef.current = present;
2736
+ }
2737
+ }, [present, send]);
2738
+ useLayoutEffect2(() => {
2739
+ if (node) {
2740
+ let timeoutId;
2741
+ const ownerWindow = node.ownerDocument.defaultView ?? window;
2742
+ const handleAnimationEnd = (event) => {
2743
+ const currentAnimationName = getAnimationName(stylesRef.current);
2744
+ const isCurrentAnimation = currentAnimationName.includes(CSS.escape(event.animationName));
2745
+ if (event.target === node && isCurrentAnimation) {
2746
+ send("ANIMATION_END");
2747
+ if (!prevPresentRef.current) {
2748
+ const currentFillMode = node.style.animationFillMode;
2749
+ node.style.animationFillMode = "forwards";
2750
+ timeoutId = ownerWindow.setTimeout(() => {
2751
+ if (node.style.animationFillMode === "forwards") {
2752
+ node.style.animationFillMode = currentFillMode;
2753
+ }
2754
+ });
2755
+ }
2756
+ }
2757
+ };
2758
+ const handleAnimationStart = (event) => {
2759
+ if (event.target === node) {
2760
+ prevAnimationNameRef.current = getAnimationName(stylesRef.current);
2761
+ }
2762
+ };
2763
+ node.addEventListener("animationstart", handleAnimationStart);
2764
+ node.addEventListener("animationcancel", handleAnimationEnd);
2765
+ node.addEventListener("animationend", handleAnimationEnd);
2766
+ return () => {
2767
+ ownerWindow.clearTimeout(timeoutId);
2768
+ node.removeEventListener("animationstart", handleAnimationStart);
2769
+ node.removeEventListener("animationcancel", handleAnimationEnd);
2770
+ node.removeEventListener("animationend", handleAnimationEnd);
2771
+ };
2772
+ } else {
2773
+ send("ANIMATION_END");
2774
+ }
2775
+ }, [node, send]);
2776
+ return {
2777
+ isPresent: ["mounted", "unmountSuspended"].includes(state),
2778
+ ref: reactExports.useCallback((node2) => {
2779
+ stylesRef.current = node2 ? getComputedStyle(node2) : null;
2780
+ setNode(node2);
2781
+ }, [])
2782
+ };
2783
+ }
2784
+ function getAnimationName(styles) {
2785
+ return styles?.animationName || "none";
2786
+ }
2787
+ function getElementRef(element) {
2788
+ let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
2789
+ let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
2790
+ if (mayWarn) {
2791
+ return element.ref;
2792
+ }
2793
+ getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
2794
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
2795
+ if (mayWarn) {
2796
+ return element.props.ref;
2797
+ }
2798
+ return element.props.ref || element.ref;
2799
+ }
2800
+ var useInsertionEffect = React2[" useInsertionEffect ".trim().toString()] || useLayoutEffect2;
2801
+ function useControllableState({
2802
+ prop,
2803
+ defaultProp,
2804
+ onChange = () => {
2805
+ },
2806
+ caller
2807
+ }) {
2808
+ const [uncontrolledProp, setUncontrolledProp, onChangeRef] = useUncontrolledState({
2809
+ defaultProp,
2810
+ onChange
2811
+ });
2812
+ const isControlled = prop !== void 0;
2813
+ const value = isControlled ? prop : uncontrolledProp;
2814
+ {
2815
+ const isControlledRef = reactExports.useRef(prop !== void 0);
2816
+ reactExports.useEffect(() => {
2817
+ const wasControlled = isControlledRef.current;
2818
+ if (wasControlled !== isControlled) {
2819
+ const from = wasControlled ? "controlled" : "uncontrolled";
2820
+ const to = isControlled ? "controlled" : "uncontrolled";
2821
+ console.warn(
2822
+ `${caller} is changing from ${from} to ${to}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`
2823
+ );
2824
+ }
2825
+ isControlledRef.current = isControlled;
2826
+ }, [isControlled, caller]);
2827
+ }
2828
+ const setValue = reactExports.useCallback(
2829
+ (nextValue) => {
2830
+ if (isControlled) {
2831
+ const value2 = isFunction(nextValue) ? nextValue(prop) : nextValue;
2832
+ if (value2 !== prop) {
2833
+ onChangeRef.current?.(value2);
2834
+ }
2835
+ } else {
2836
+ setUncontrolledProp(nextValue);
2837
+ }
2838
+ },
2839
+ [isControlled, prop, setUncontrolledProp, onChangeRef]
2840
+ );
2841
+ return [value, setValue];
2842
+ }
2843
+ function useUncontrolledState({
2844
+ defaultProp,
2845
+ onChange
2846
+ }) {
2847
+ const [value, setValue] = reactExports.useState(defaultProp);
2848
+ const prevValueRef = reactExports.useRef(value);
2849
+ const onChangeRef = reactExports.useRef(onChange);
2850
+ useInsertionEffect(() => {
2851
+ onChangeRef.current = onChange;
2852
+ }, [onChange]);
2853
+ reactExports.useEffect(() => {
2854
+ if (prevValueRef.current !== value) {
2855
+ onChangeRef.current?.(value);
2856
+ prevValueRef.current = value;
2857
+ }
2858
+ }, [value, prevValueRef]);
2859
+ return [value, setValue, onChangeRef];
2860
+ }
2861
+ function isFunction(value) {
2862
+ return typeof value === "function";
2863
+ }
2864
+ var VISUALLY_HIDDEN_STYLES = Object.freeze({
2865
+ // See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
2866
+ position: "absolute",
2867
+ border: 0,
2868
+ width: 1,
2869
+ height: 1,
2870
+ padding: 0,
2871
+ margin: -1,
2872
+ overflow: "hidden",
2873
+ clip: "rect(0, 0, 0, 0)",
2874
+ whiteSpace: "nowrap",
2875
+ wordWrap: "normal"
2876
+ });
2877
+ var NAME = "VisuallyHidden";
2878
+ var VisuallyHidden = reactExports.forwardRef(
2879
+ (props, forwardedRef) => {
2880
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
2881
+ Primitive.span,
2882
+ {
2883
+ ...props,
2884
+ ref: forwardedRef,
2885
+ style: { ...VISUALLY_HIDDEN_STYLES, ...props.style }
2886
+ }
2887
+ );
2888
+ }
2889
+ );
2890
+ VisuallyHidden.displayName = NAME;
2891
+ var Root = VisuallyHidden;
2892
+ var [createTooltipContext] = createContextScope("Tooltip", [
2893
+ createPopperScope
2894
+ ]);
2895
+ var usePopperScope = createPopperScope();
2896
+ var PROVIDER_NAME = "TooltipProvider";
2897
+ var DEFAULT_DELAY_DURATION = 700;
2898
+ var TOOLTIP_OPEN = "tooltip.open";
2899
+ var [TooltipProviderContextProvider, useTooltipProviderContext] = createTooltipContext(PROVIDER_NAME);
2900
+ var TooltipProvider = (props) => {
2901
+ const {
2902
+ __scopeTooltip,
2903
+ delayDuration = DEFAULT_DELAY_DURATION,
2904
+ skipDelayDuration = 300,
2905
+ disableHoverableContent = false,
2906
+ children
2907
+ } = props;
2908
+ const isOpenDelayedRef = reactExports.useRef(true);
2909
+ const isPointerInTransitRef = reactExports.useRef(false);
2910
+ const skipDelayTimerRef = reactExports.useRef(0);
2911
+ reactExports.useEffect(() => {
2912
+ const skipDelayTimer = skipDelayTimerRef.current;
2913
+ return () => window.clearTimeout(skipDelayTimer);
2914
+ }, []);
2915
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
2916
+ TooltipProviderContextProvider,
2917
+ {
2918
+ scope: __scopeTooltip,
2919
+ isOpenDelayedRef,
2920
+ delayDuration,
2921
+ onOpen: reactExports.useCallback(() => {
2922
+ window.clearTimeout(skipDelayTimerRef.current);
2923
+ isOpenDelayedRef.current = false;
2924
+ }, []),
2925
+ onClose: reactExports.useCallback(() => {
2926
+ window.clearTimeout(skipDelayTimerRef.current);
2927
+ skipDelayTimerRef.current = window.setTimeout(
2928
+ () => isOpenDelayedRef.current = true,
2929
+ skipDelayDuration
2930
+ );
2931
+ }, [skipDelayDuration]),
2932
+ isPointerInTransitRef,
2933
+ onPointerInTransitChange: reactExports.useCallback((inTransit) => {
2934
+ isPointerInTransitRef.current = inTransit;
2935
+ }, []),
2936
+ disableHoverableContent,
2937
+ children
2938
+ }
2939
+ );
2940
+ };
2941
+ TooltipProvider.displayName = PROVIDER_NAME;
2942
+ var TOOLTIP_NAME = "Tooltip";
2943
+ var [TooltipContextProvider, useTooltipContext] = createTooltipContext(TOOLTIP_NAME);
2944
+ var Tooltip = (props) => {
2945
+ const {
2946
+ __scopeTooltip,
2947
+ children,
2948
+ open: openProp,
2949
+ defaultOpen,
2950
+ onOpenChange,
2951
+ disableHoverableContent: disableHoverableContentProp,
2952
+ delayDuration: delayDurationProp
2953
+ } = props;
2954
+ const providerContext = useTooltipProviderContext(TOOLTIP_NAME, props.__scopeTooltip);
2955
+ const popperScope = usePopperScope(__scopeTooltip);
2956
+ const [trigger, setTrigger] = reactExports.useState(null);
2957
+ const contentId = useId();
2958
+ const openTimerRef = reactExports.useRef(0);
2959
+ const disableHoverableContent = disableHoverableContentProp ?? providerContext.disableHoverableContent;
2960
+ const delayDuration = delayDurationProp ?? providerContext.delayDuration;
2961
+ const wasOpenDelayedRef = reactExports.useRef(false);
2962
+ const [open, setOpen] = useControllableState({
2963
+ prop: openProp,
2964
+ defaultProp: defaultOpen ?? false,
2965
+ onChange: (open2) => {
2966
+ if (open2) {
2967
+ providerContext.onOpen();
2968
+ document.dispatchEvent(new CustomEvent(TOOLTIP_OPEN));
2969
+ } else {
2970
+ providerContext.onClose();
2971
+ }
2972
+ onOpenChange?.(open2);
2973
+ },
2974
+ caller: TOOLTIP_NAME
2975
+ });
2976
+ const stateAttribute = reactExports.useMemo(() => {
2977
+ return open ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
2978
+ }, [open]);
2979
+ const handleOpen = reactExports.useCallback(() => {
2980
+ window.clearTimeout(openTimerRef.current);
2981
+ openTimerRef.current = 0;
2982
+ wasOpenDelayedRef.current = false;
2983
+ setOpen(true);
2984
+ }, [setOpen]);
2985
+ const handleClose = reactExports.useCallback(() => {
2986
+ window.clearTimeout(openTimerRef.current);
2987
+ openTimerRef.current = 0;
2988
+ setOpen(false);
2989
+ }, [setOpen]);
2990
+ const handleDelayedOpen = reactExports.useCallback(() => {
2991
+ window.clearTimeout(openTimerRef.current);
2992
+ openTimerRef.current = window.setTimeout(() => {
2993
+ wasOpenDelayedRef.current = true;
2994
+ setOpen(true);
2995
+ openTimerRef.current = 0;
2996
+ }, delayDuration);
2997
+ }, [delayDuration, setOpen]);
2998
+ reactExports.useEffect(() => {
2999
+ return () => {
3000
+ if (openTimerRef.current) {
3001
+ window.clearTimeout(openTimerRef.current);
3002
+ openTimerRef.current = 0;
3003
+ }
3004
+ };
3005
+ }, []);
3006
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Root2, { ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3007
+ TooltipContextProvider,
3008
+ {
3009
+ scope: __scopeTooltip,
3010
+ contentId,
3011
+ open,
3012
+ stateAttribute,
3013
+ trigger,
3014
+ onTriggerChange: setTrigger,
3015
+ onTriggerEnter: reactExports.useCallback(() => {
3016
+ if (providerContext.isOpenDelayedRef.current) handleDelayedOpen();
3017
+ else handleOpen();
3018
+ }, [providerContext.isOpenDelayedRef, handleDelayedOpen, handleOpen]),
3019
+ onTriggerLeave: reactExports.useCallback(() => {
3020
+ if (disableHoverableContent) {
3021
+ handleClose();
3022
+ } else {
3023
+ window.clearTimeout(openTimerRef.current);
3024
+ openTimerRef.current = 0;
3025
+ }
3026
+ }, [handleClose, disableHoverableContent]),
3027
+ onOpen: handleOpen,
3028
+ onClose: handleClose,
3029
+ disableHoverableContent,
3030
+ children
3031
+ }
3032
+ ) });
3033
+ };
3034
+ Tooltip.displayName = TOOLTIP_NAME;
3035
+ var TRIGGER_NAME = "TooltipTrigger";
3036
+ var TooltipTrigger = reactExports.forwardRef(
3037
+ (props, forwardedRef) => {
3038
+ const { __scopeTooltip, ...triggerProps } = props;
3039
+ const context = useTooltipContext(TRIGGER_NAME, __scopeTooltip);
3040
+ const providerContext = useTooltipProviderContext(TRIGGER_NAME, __scopeTooltip);
3041
+ const popperScope = usePopperScope(__scopeTooltip);
3042
+ const ref = reactExports.useRef(null);
3043
+ const composedRefs = useComposedRefs(forwardedRef, ref, context.onTriggerChange);
3044
+ const isPointerDownRef = reactExports.useRef(false);
3045
+ const hasPointerMoveOpenedRef = reactExports.useRef(false);
3046
+ const handlePointerUp = reactExports.useCallback(() => isPointerDownRef.current = false, []);
3047
+ reactExports.useEffect(() => {
3048
+ return () => document.removeEventListener("pointerup", handlePointerUp);
3049
+ }, [handlePointerUp]);
3050
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3051
+ Primitive.button,
3052
+ {
3053
+ "aria-describedby": context.open ? context.contentId : void 0,
3054
+ "data-state": context.stateAttribute,
3055
+ ...triggerProps,
3056
+ ref: composedRefs,
3057
+ onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
3058
+ if (event.pointerType === "touch") return;
3059
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
3060
+ context.onTriggerEnter();
3061
+ hasPointerMoveOpenedRef.current = true;
3062
+ }
3063
+ }),
3064
+ onPointerLeave: composeEventHandlers(props.onPointerLeave, () => {
3065
+ context.onTriggerLeave();
3066
+ hasPointerMoveOpenedRef.current = false;
3067
+ }),
3068
+ onPointerDown: composeEventHandlers(props.onPointerDown, () => {
3069
+ if (context.open) {
3070
+ context.onClose();
3071
+ }
3072
+ isPointerDownRef.current = true;
3073
+ document.addEventListener("pointerup", handlePointerUp, { once: true });
3074
+ }),
3075
+ onFocus: composeEventHandlers(props.onFocus, () => {
3076
+ if (!isPointerDownRef.current) context.onOpen();
3077
+ }),
3078
+ onBlur: composeEventHandlers(props.onBlur, context.onClose),
3079
+ onClick: composeEventHandlers(props.onClick, context.onClose)
3080
+ }
3081
+ ) });
3082
+ }
3083
+ );
3084
+ TooltipTrigger.displayName = TRIGGER_NAME;
3085
+ var PORTAL_NAME = "TooltipPortal";
3086
+ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME, {
3087
+ forceMount: void 0
3088
+ });
3089
+ var TooltipPortal = (props) => {
3090
+ const { __scopeTooltip, forceMount, children, container } = props;
3091
+ const context = useTooltipContext(PORTAL_NAME, __scopeTooltip);
3092
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Portal$1, { asChild: true, container, children }) }) });
3093
+ };
3094
+ TooltipPortal.displayName = PORTAL_NAME;
3095
+ var CONTENT_NAME = "TooltipContent";
3096
+ var TooltipContent = reactExports.forwardRef(
3097
+ (props, forwardedRef) => {
3098
+ const portalContext = usePortalContext(CONTENT_NAME, props.__scopeTooltip);
3099
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
3100
+ const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
3101
+ 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 }) });
3102
+ }
3103
+ );
3104
+ var TooltipContentHoverable = reactExports.forwardRef((props, forwardedRef) => {
3105
+ const context = useTooltipContext(CONTENT_NAME, props.__scopeTooltip);
3106
+ const providerContext = useTooltipProviderContext(CONTENT_NAME, props.__scopeTooltip);
3107
+ const ref = reactExports.useRef(null);
3108
+ const composedRefs = useComposedRefs(forwardedRef, ref);
3109
+ const [pointerGraceArea, setPointerGraceArea] = reactExports.useState(null);
3110
+ const { trigger, onClose } = context;
3111
+ const content = ref.current;
3112
+ const { onPointerInTransitChange } = providerContext;
3113
+ const handleRemoveGraceArea = reactExports.useCallback(() => {
3114
+ setPointerGraceArea(null);
3115
+ onPointerInTransitChange(false);
3116
+ }, [onPointerInTransitChange]);
3117
+ const handleCreateGraceArea = reactExports.useCallback(
3118
+ (event, hoverTarget) => {
3119
+ const currentTarget = event.currentTarget;
3120
+ const exitPoint = { x: event.clientX, y: event.clientY };
3121
+ const exitSide = getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
3122
+ const paddedExitPoints = getPaddedExitPoints(exitPoint, exitSide);
3123
+ const hoverTargetPoints = getPointsFromRect(hoverTarget.getBoundingClientRect());
3124
+ const graceArea = getHull([...paddedExitPoints, ...hoverTargetPoints]);
3125
+ setPointerGraceArea(graceArea);
3126
+ onPointerInTransitChange(true);
3127
+ },
3128
+ [onPointerInTransitChange]
3129
+ );
3130
+ reactExports.useEffect(() => {
3131
+ return () => handleRemoveGraceArea();
3132
+ }, [handleRemoveGraceArea]);
3133
+ reactExports.useEffect(() => {
3134
+ if (trigger && content) {
3135
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
3136
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
3137
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
3138
+ content.addEventListener("pointerleave", handleContentLeave);
3139
+ return () => {
3140
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
3141
+ content.removeEventListener("pointerleave", handleContentLeave);
3142
+ };
3143
+ }
3144
+ }, [trigger, content, handleCreateGraceArea, handleRemoveGraceArea]);
3145
+ reactExports.useEffect(() => {
3146
+ if (pointerGraceArea) {
3147
+ const handleTrackPointerGrace = (event) => {
3148
+ const target = event.target;
3149
+ const pointerPosition = { x: event.clientX, y: event.clientY };
3150
+ const hasEnteredTarget = trigger?.contains(target) || content?.contains(target);
3151
+ const isPointerOutsideGraceArea = !isPointInPolygon(pointerPosition, pointerGraceArea);
3152
+ if (hasEnteredTarget) {
3153
+ handleRemoveGraceArea();
3154
+ } else if (isPointerOutsideGraceArea) {
3155
+ handleRemoveGraceArea();
3156
+ onClose();
3157
+ }
3158
+ };
3159
+ document.addEventListener("pointermove", handleTrackPointerGrace);
3160
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
3161
+ }
3162
+ }, [trigger, content, pointerGraceArea, onClose, handleRemoveGraceArea]);
3163
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContentImpl, { ...props, ref: composedRefs });
3164
+ });
3165
+ var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
3166
+ var Slottable = /* @__PURE__ */ createSlottable("TooltipContent");
3167
+ var TooltipContentImpl = reactExports.forwardRef(
3168
+ (props, forwardedRef) => {
3169
+ const {
3170
+ __scopeTooltip,
3171
+ children,
3172
+ "aria-label": ariaLabel,
3173
+ onEscapeKeyDown,
3174
+ onPointerDownOutside,
3175
+ ...contentProps
3176
+ } = props;
3177
+ const context = useTooltipContext(CONTENT_NAME, __scopeTooltip);
3178
+ const popperScope = usePopperScope(__scopeTooltip);
3179
+ const { onClose } = context;
3180
+ reactExports.useEffect(() => {
3181
+ document.addEventListener(TOOLTIP_OPEN, onClose);
3182
+ return () => document.removeEventListener(TOOLTIP_OPEN, onClose);
3183
+ }, [onClose]);
3184
+ reactExports.useEffect(() => {
3185
+ if (context.trigger) {
3186
+ const handleScroll = (event) => {
3187
+ const target = event.target;
3188
+ if (target?.contains(context.trigger)) onClose();
3189
+ };
3190
+ window.addEventListener("scroll", handleScroll, { capture: true });
3191
+ return () => window.removeEventListener("scroll", handleScroll, { capture: true });
3192
+ }
3193
+ }, [context.trigger, onClose]);
3194
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
3195
+ DismissableLayer,
3196
+ {
3197
+ asChild: true,
3198
+ disableOutsidePointerEvents: false,
3199
+ onEscapeKeyDown,
3200
+ onPointerDownOutside,
3201
+ onFocusOutside: (event) => event.preventDefault(),
3202
+ onDismiss: onClose,
3203
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3204
+ Content,
3205
+ {
3206
+ "data-state": context.stateAttribute,
3207
+ ...popperScope,
3208
+ ...contentProps,
3209
+ ref: forwardedRef,
3210
+ style: {
3211
+ ...contentProps.style,
3212
+ // re-namespace exposed content custom properties
3213
+ ...{
3214
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
3215
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
3216
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
3217
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
3218
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
3219
+ }
3220
+ },
3221
+ children: [
3222
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Slottable, { children }),
3223
+ /* @__PURE__ */ jsxRuntimeExports.jsx(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
3224
+ ]
3225
+ }
3226
+ )
3227
+ }
3228
+ );
3229
+ }
3230
+ );
3231
+ TooltipContent.displayName = CONTENT_NAME;
3232
+ var ARROW_NAME = "TooltipArrow";
3233
+ var TooltipArrow = reactExports.forwardRef(
3234
+ (props, forwardedRef) => {
3235
+ const { __scopeTooltip, ...arrowProps } = props;
3236
+ const popperScope = usePopperScope(__scopeTooltip);
3237
+ const visuallyHiddenContentContext = useVisuallyHiddenContentContext(
3238
+ ARROW_NAME,
3239
+ __scopeTooltip
3240
+ );
3241
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
3242
+ }
3243
+ );
3244
+ TooltipArrow.displayName = ARROW_NAME;
3245
+ function getExitSideFromRect(point, rect) {
3246
+ const top = Math.abs(rect.top - point.y);
3247
+ const bottom = Math.abs(rect.bottom - point.y);
3248
+ const right = Math.abs(rect.right - point.x);
3249
+ const left = Math.abs(rect.left - point.x);
3250
+ switch (Math.min(top, bottom, right, left)) {
3251
+ case left:
3252
+ return "left";
3253
+ case right:
3254
+ return "right";
3255
+ case top:
3256
+ return "top";
3257
+ case bottom:
3258
+ return "bottom";
3259
+ default:
3260
+ throw new Error("unreachable");
3261
+ }
3262
+ }
3263
+ function getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
3264
+ const paddedExitPoints = [];
3265
+ switch (exitSide) {
3266
+ case "top":
3267
+ paddedExitPoints.push(
3268
+ { x: exitPoint.x - padding, y: exitPoint.y + padding },
3269
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
3270
+ );
3271
+ break;
3272
+ case "bottom":
3273
+ paddedExitPoints.push(
3274
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
3275
+ { x: exitPoint.x + padding, y: exitPoint.y - padding }
3276
+ );
3277
+ break;
3278
+ case "left":
3279
+ paddedExitPoints.push(
3280
+ { x: exitPoint.x + padding, y: exitPoint.y - padding },
3281
+ { x: exitPoint.x + padding, y: exitPoint.y + padding }
3282
+ );
3283
+ break;
3284
+ case "right":
3285
+ paddedExitPoints.push(
3286
+ { x: exitPoint.x - padding, y: exitPoint.y - padding },
3287
+ { x: exitPoint.x - padding, y: exitPoint.y + padding }
3288
+ );
3289
+ break;
3290
+ }
3291
+ return paddedExitPoints;
3292
+ }
3293
+ function getPointsFromRect(rect) {
3294
+ const { top, right, bottom, left } = rect;
3295
+ return [
3296
+ { x: left, y: top },
3297
+ { x: right, y: top },
3298
+ { x: right, y: bottom },
3299
+ { x: left, y: bottom }
3300
+ ];
3301
+ }
3302
+ function isPointInPolygon(point, polygon) {
3303
+ const { x, y } = point;
3304
+ let inside = false;
3305
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
3306
+ const ii = polygon[i];
3307
+ const jj = polygon[j];
3308
+ const xi = ii.x;
3309
+ const yi = ii.y;
3310
+ const xj = jj.x;
3311
+ const yj = jj.y;
3312
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
3313
+ if (intersect) inside = !inside;
3314
+ }
3315
+ return inside;
3316
+ }
3317
+ function getHull(points) {
3318
+ const newPoints = points.slice();
3319
+ newPoints.sort((a, b) => {
3320
+ if (a.x < b.x) return -1;
3321
+ else if (a.x > b.x) return 1;
3322
+ else if (a.y < b.y) return -1;
3323
+ else if (a.y > b.y) return 1;
3324
+ else return 0;
3325
+ });
3326
+ return getHullPresorted(newPoints);
3327
+ }
3328
+ function getHullPresorted(points) {
3329
+ if (points.length <= 1) return points.slice();
3330
+ const upperHull = [];
3331
+ for (let i = 0; i < points.length; i++) {
3332
+ const p = points[i];
3333
+ while (upperHull.length >= 2) {
3334
+ const q = upperHull[upperHull.length - 1];
3335
+ const r = upperHull[upperHull.length - 2];
3336
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
3337
+ else break;
3338
+ }
3339
+ upperHull.push(p);
3340
+ }
3341
+ upperHull.pop();
3342
+ const lowerHull = [];
3343
+ for (let i = points.length - 1; i >= 0; i--) {
3344
+ const p = points[i];
3345
+ while (lowerHull.length >= 2) {
3346
+ const q = lowerHull[lowerHull.length - 1];
3347
+ const r = lowerHull[lowerHull.length - 2];
3348
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
3349
+ else break;
3350
+ }
3351
+ lowerHull.push(p);
3352
+ }
3353
+ lowerHull.pop();
3354
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) {
3355
+ return upperHull;
3356
+ } else {
3357
+ return upperHull.concat(lowerHull);
3358
+ }
3359
+ }
3360
+ var Provider = TooltipProvider;
3361
+ var Root3 = Tooltip;
3362
+ var Trigger = TooltipTrigger;
3363
+ var Portal = TooltipPortal;
3364
+ var Content2 = TooltipContent;
3365
+ var Arrow2 = TooltipArrow;
3366
+ function __insertCSS(code) {
3367
+ if (typeof document == "undefined") return;
3368
+ let head = document.head || document.getElementsByTagName("head")[0];
3369
+ let style = document.createElement("style");
3370
+ style.type = "text/css";
3371
+ head.appendChild(style);
3372
+ style.styleSheet ? style.styleSheet.cssText = code : style.appendChild(document.createTextNode(code));
3373
+ }
3374
+ const getAsset = (type) => {
3375
+ switch (type) {
3376
+ case "success":
3377
+ return SuccessIcon;
3378
+ case "info":
3379
+ return InfoIcon;
3380
+ case "warning":
3381
+ return WarningIcon;
3382
+ case "error":
3383
+ return ErrorIcon;
3384
+ default:
3385
+ return null;
3386
+ }
3387
+ };
3388
+ const bars = Array(12).fill(0);
3389
+ const Loader = ({ visible, className }) => {
3390
+ return /* @__PURE__ */ React2$1.createElement("div", {
3391
+ className: [
3392
+ "sonner-loading-wrapper",
3393
+ className
3394
+ ].filter(Boolean).join(" "),
3395
+ "data-visible": visible
3396
+ }, /* @__PURE__ */ React2$1.createElement("div", {
3397
+ className: "sonner-spinner"
3398
+ }, bars.map((_, i) => /* @__PURE__ */ React2$1.createElement("div", {
3399
+ className: "sonner-loading-bar",
3400
+ key: `spinner-bar-${i}`
3401
+ }))));
3402
+ };
3403
+ const SuccessIcon = /* @__PURE__ */ React2$1.createElement("svg", {
3404
+ xmlns: "http://www.w3.org/2000/svg",
3405
+ viewBox: "0 0 20 20",
3406
+ fill: "currentColor",
3407
+ height: "20",
3408
+ width: "20"
3409
+ }, /* @__PURE__ */ React2$1.createElement("path", {
3410
+ fillRule: "evenodd",
3411
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
3412
+ clipRule: "evenodd"
3413
+ }));
3414
+ const WarningIcon = /* @__PURE__ */ React2$1.createElement("svg", {
3415
+ xmlns: "http://www.w3.org/2000/svg",
3416
+ viewBox: "0 0 24 24",
3417
+ fill: "currentColor",
3418
+ height: "20",
3419
+ width: "20"
3420
+ }, /* @__PURE__ */ React2$1.createElement("path", {
3421
+ fillRule: "evenodd",
3422
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
3423
+ clipRule: "evenodd"
3424
+ }));
3425
+ const InfoIcon = /* @__PURE__ */ React2$1.createElement("svg", {
3426
+ xmlns: "http://www.w3.org/2000/svg",
3427
+ viewBox: "0 0 20 20",
3428
+ fill: "currentColor",
3429
+ height: "20",
3430
+ width: "20"
3431
+ }, /* @__PURE__ */ React2$1.createElement("path", {
3432
+ fillRule: "evenodd",
3433
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
3434
+ clipRule: "evenodd"
3435
+ }));
3436
+ const ErrorIcon = /* @__PURE__ */ React2$1.createElement("svg", {
3437
+ xmlns: "http://www.w3.org/2000/svg",
3438
+ viewBox: "0 0 20 20",
3439
+ fill: "currentColor",
3440
+ height: "20",
3441
+ width: "20"
3442
+ }, /* @__PURE__ */ React2$1.createElement("path", {
3443
+ fillRule: "evenodd",
3444
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
3445
+ clipRule: "evenodd"
3446
+ }));
3447
+ const CloseIcon = /* @__PURE__ */ React2$1.createElement("svg", {
3448
+ xmlns: "http://www.w3.org/2000/svg",
3449
+ width: "12",
3450
+ height: "12",
3451
+ viewBox: "0 0 24 24",
3452
+ fill: "none",
3453
+ stroke: "currentColor",
3454
+ strokeWidth: "1.5",
3455
+ strokeLinecap: "round",
3456
+ strokeLinejoin: "round"
3457
+ }, /* @__PURE__ */ React2$1.createElement("line", {
3458
+ x1: "18",
3459
+ y1: "6",
3460
+ x2: "6",
3461
+ y2: "18"
3462
+ }), /* @__PURE__ */ React2$1.createElement("line", {
3463
+ x1: "6",
3464
+ y1: "6",
3465
+ x2: "18",
3466
+ y2: "18"
3467
+ }));
3468
+ const useIsDocumentHidden = () => {
3469
+ const [isDocumentHidden, setIsDocumentHidden] = React2$1.useState(document.hidden);
3470
+ React2$1.useEffect(() => {
3471
+ const callback = () => {
3472
+ setIsDocumentHidden(document.hidden);
3473
+ };
3474
+ document.addEventListener("visibilitychange", callback);
3475
+ return () => window.removeEventListener("visibilitychange", callback);
3476
+ }, []);
3477
+ return isDocumentHidden;
3478
+ };
3479
+ let toastsCounter = 1;
3480
+ class Observer {
3481
+ constructor() {
3482
+ this.subscribe = (subscriber) => {
3483
+ this.subscribers.push(subscriber);
3484
+ return () => {
3485
+ const index2 = this.subscribers.indexOf(subscriber);
3486
+ this.subscribers.splice(index2, 1);
3487
+ };
3488
+ };
3489
+ this.publish = (data) => {
3490
+ this.subscribers.forEach((subscriber) => subscriber(data));
3491
+ };
3492
+ this.addToast = (data) => {
3493
+ this.publish(data);
3494
+ this.toasts = [
3495
+ ...this.toasts,
3496
+ data
3497
+ ];
3498
+ };
3499
+ this.create = (data) => {
3500
+ var _data_id;
3501
+ const { message, ...rest } = data;
3502
+ const id = typeof (data == null ? void 0 : data.id) === "number" || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
3503
+ const alreadyExists = this.toasts.find((toast2) => {
3504
+ return toast2.id === id;
3505
+ });
3506
+ const dismissible = data.dismissible === void 0 ? true : data.dismissible;
3507
+ if (this.dismissedToasts.has(id)) {
3508
+ this.dismissedToasts.delete(id);
3509
+ }
3510
+ if (alreadyExists) {
3511
+ this.toasts = this.toasts.map((toast2) => {
3512
+ if (toast2.id === id) {
3513
+ this.publish({
3514
+ ...toast2,
3515
+ ...data,
3516
+ id,
3517
+ title: message
3518
+ });
3519
+ return {
3520
+ ...toast2,
3521
+ ...data,
3522
+ id,
3523
+ dismissible,
3524
+ title: message
3525
+ };
3526
+ }
3527
+ return toast2;
3528
+ });
3529
+ } else {
3530
+ this.addToast({
3531
+ title: message,
3532
+ ...rest,
3533
+ dismissible,
3534
+ id
3535
+ });
3536
+ }
3537
+ return id;
3538
+ };
3539
+ this.dismiss = (id) => {
3540
+ if (id) {
3541
+ this.dismissedToasts.add(id);
3542
+ requestAnimationFrame(() => this.subscribers.forEach((subscriber) => subscriber({
3543
+ id,
3544
+ dismiss: true
3545
+ })));
3546
+ } else {
3547
+ this.toasts.forEach((toast2) => {
3548
+ this.subscribers.forEach((subscriber) => subscriber({
3549
+ id: toast2.id,
3550
+ dismiss: true
3551
+ }));
3552
+ });
3553
+ }
3554
+ return id;
3555
+ };
3556
+ this.message = (message, data) => {
3557
+ return this.create({
3558
+ ...data,
3559
+ message
3560
+ });
3561
+ };
3562
+ this.error = (message, data) => {
3563
+ return this.create({
3564
+ ...data,
3565
+ message,
3566
+ type: "error"
3567
+ });
3568
+ };
3569
+ this.success = (message, data) => {
3570
+ return this.create({
3571
+ ...data,
3572
+ type: "success",
3573
+ message
3574
+ });
3575
+ };
3576
+ this.info = (message, data) => {
3577
+ return this.create({
3578
+ ...data,
3579
+ type: "info",
3580
+ message
3581
+ });
3582
+ };
3583
+ this.warning = (message, data) => {
3584
+ return this.create({
3585
+ ...data,
3586
+ type: "warning",
3587
+ message
3588
+ });
3589
+ };
3590
+ this.loading = (message, data) => {
3591
+ return this.create({
3592
+ ...data,
3593
+ type: "loading",
3594
+ message
3595
+ });
3596
+ };
3597
+ this.promise = (promise, data) => {
3598
+ if (!data) {
3599
+ return;
3600
+ }
3601
+ let id = void 0;
3602
+ if (data.loading !== void 0) {
3603
+ id = this.create({
3604
+ ...data,
3605
+ promise,
3606
+ type: "loading",
3607
+ message: data.loading,
3608
+ description: typeof data.description !== "function" ? data.description : void 0
3609
+ });
3610
+ }
3611
+ const p = Promise.resolve(promise instanceof Function ? promise() : promise);
3612
+ let shouldDismiss = id !== void 0;
3613
+ let result;
3614
+ const originalPromise = p.then(async (response) => {
3615
+ result = [
3616
+ "resolve",
3617
+ response
3618
+ ];
3619
+ const isReactElementResponse = React2$1.isValidElement(response);
3620
+ if (isReactElementResponse) {
3621
+ shouldDismiss = false;
3622
+ this.create({
3623
+ id,
3624
+ type: "default",
3625
+ message: response
3626
+ });
3627
+ } else if (isHttpResponse(response) && !response.ok) {
3628
+ shouldDismiss = false;
3629
+ const promiseData = typeof data.error === "function" ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
3630
+ const description = typeof data.description === "function" ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
3631
+ const isExtendedResult = typeof promiseData === "object" && !React2$1.isValidElement(promiseData);
3632
+ const toastSettings = isExtendedResult ? promiseData : {
3633
+ message: promiseData
3634
+ };
3635
+ this.create({
3636
+ id,
3637
+ type: "error",
3638
+ description,
3639
+ ...toastSettings
3640
+ });
3641
+ } else if (response instanceof Error) {
3642
+ shouldDismiss = false;
3643
+ const promiseData = typeof data.error === "function" ? await data.error(response) : data.error;
3644
+ const description = typeof data.description === "function" ? await data.description(response) : data.description;
3645
+ const isExtendedResult = typeof promiseData === "object" && !React2$1.isValidElement(promiseData);
3646
+ const toastSettings = isExtendedResult ? promiseData : {
3647
+ message: promiseData
3648
+ };
3649
+ this.create({
3650
+ id,
3651
+ type: "error",
3652
+ description,
3653
+ ...toastSettings
3654
+ });
3655
+ } else if (data.success !== void 0) {
3656
+ shouldDismiss = false;
3657
+ const promiseData = typeof data.success === "function" ? await data.success(response) : data.success;
3658
+ const description = typeof data.description === "function" ? await data.description(response) : data.description;
3659
+ const isExtendedResult = typeof promiseData === "object" && !React2$1.isValidElement(promiseData);
3660
+ const toastSettings = isExtendedResult ? promiseData : {
3661
+ message: promiseData
3662
+ };
3663
+ this.create({
3664
+ id,
3665
+ type: "success",
3666
+ description,
3667
+ ...toastSettings
3668
+ });
3669
+ }
3670
+ }).catch(async (error) => {
3671
+ result = [
3672
+ "reject",
3673
+ error
3674
+ ];
3675
+ if (data.error !== void 0) {
3676
+ shouldDismiss = false;
3677
+ const promiseData = typeof data.error === "function" ? await data.error(error) : data.error;
3678
+ const description = typeof data.description === "function" ? await data.description(error) : data.description;
3679
+ const isExtendedResult = typeof promiseData === "object" && !React2$1.isValidElement(promiseData);
3680
+ const toastSettings = isExtendedResult ? promiseData : {
3681
+ message: promiseData
3682
+ };
3683
+ this.create({
3684
+ id,
3685
+ type: "error",
3686
+ description,
3687
+ ...toastSettings
3688
+ });
3689
+ }
3690
+ }).finally(() => {
3691
+ if (shouldDismiss) {
3692
+ this.dismiss(id);
3693
+ id = void 0;
3694
+ }
3695
+ data.finally == null ? void 0 : data.finally.call(data);
3696
+ });
3697
+ const unwrap = () => new Promise((resolve, reject) => originalPromise.then(() => result[0] === "reject" ? reject(result[1]) : resolve(result[1])).catch(reject));
3698
+ if (typeof id !== "string" && typeof id !== "number") {
3699
+ return {
3700
+ unwrap
3701
+ };
3702
+ } else {
3703
+ return Object.assign(id, {
3704
+ unwrap
3705
+ });
3706
+ }
3707
+ };
3708
+ this.custom = (jsx, data) => {
3709
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
3710
+ this.create({
3711
+ jsx: jsx(id),
3712
+ id,
3713
+ ...data
3714
+ });
3715
+ return id;
3716
+ };
3717
+ this.getActiveToasts = () => {
3718
+ return this.toasts.filter((toast2) => !this.dismissedToasts.has(toast2.id));
3719
+ };
3720
+ this.subscribers = [];
3721
+ this.toasts = [];
3722
+ this.dismissedToasts = /* @__PURE__ */ new Set();
3723
+ }
3724
+ }
3725
+ const ToastState = new Observer();
3726
+ const toastFunction = (message, data) => {
3727
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
3728
+ ToastState.addToast({
3729
+ title: message,
3730
+ ...data,
3731
+ id
3732
+ });
3733
+ return id;
3734
+ };
3735
+ const isHttpResponse = (data) => {
3736
+ return data && typeof data === "object" && "ok" in data && typeof data.ok === "boolean" && "status" in data && typeof data.status === "number";
3737
+ };
3738
+ const basicToast = toastFunction;
3739
+ const getHistory = () => ToastState.toasts;
3740
+ const getToasts = () => ToastState.getActiveToasts();
3741
+ const toast = Object.assign(basicToast, {
3742
+ success: ToastState.success,
3743
+ info: ToastState.info,
3744
+ warning: ToastState.warning,
3745
+ error: ToastState.error,
3746
+ custom: ToastState.custom,
3747
+ message: ToastState.message,
3748
+ promise: ToastState.promise,
3749
+ dismiss: ToastState.dismiss,
3750
+ loading: ToastState.loading
3751
+ }, {
3752
+ getHistory,
3753
+ getToasts
3754
+ });
3755
+ __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
3756
+ function isAction(action) {
3757
+ return action.label !== void 0;
3758
+ }
3759
+ const VISIBLE_TOASTS_AMOUNT = 3;
3760
+ const VIEWPORT_OFFSET = "24px";
3761
+ const MOBILE_VIEWPORT_OFFSET = "16px";
3762
+ const TOAST_LIFETIME = 4e3;
3763
+ const TOAST_WIDTH = 356;
3764
+ const GAP = 14;
3765
+ const SWIPE_THRESHOLD = 45;
3766
+ const TIME_BEFORE_UNMOUNT = 200;
3767
+ function cn(...classes) {
3768
+ return classes.filter(Boolean).join(" ");
3769
+ }
3770
+ function getDefaultSwipeDirections(position) {
3771
+ const [y, x] = position.split("-");
3772
+ const directions = [];
3773
+ if (y) {
3774
+ directions.push(y);
3775
+ }
3776
+ if (x) {
3777
+ directions.push(x);
3778
+ }
3779
+ return directions;
3780
+ }
3781
+ const Toast = (props) => {
3782
+ var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
3783
+ const { invert: ToasterInvert, toast: toast2, unstyled, interacting, setHeights, visibleToasts, heights, index: index2, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = "", descriptionClassName = "", duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = "Close toast" } = props;
3784
+ const [swipeDirection, setSwipeDirection] = React2$1.useState(null);
3785
+ const [swipeOutDirection, setSwipeOutDirection] = React2$1.useState(null);
3786
+ const [mounted, setMounted] = React2$1.useState(false);
3787
+ const [removed, setRemoved] = React2$1.useState(false);
3788
+ const [swiping, setSwiping] = React2$1.useState(false);
3789
+ const [swipeOut, setSwipeOut] = React2$1.useState(false);
3790
+ const [isSwiped, setIsSwiped] = React2$1.useState(false);
3791
+ const [offsetBeforeRemove, setOffsetBeforeRemove] = React2$1.useState(0);
3792
+ const [initialHeight, setInitialHeight] = React2$1.useState(0);
3793
+ const remainingTime = React2$1.useRef(toast2.duration || durationFromToaster || TOAST_LIFETIME);
3794
+ const dragStartTime = React2$1.useRef(null);
3795
+ const toastRef = React2$1.useRef(null);
3796
+ const isFront = index2 === 0;
3797
+ const isVisible = index2 + 1 <= visibleToasts;
3798
+ const toastType = toast2.type;
3799
+ const dismissible = toast2.dismissible !== false;
3800
+ const toastClassname = toast2.className || "";
3801
+ const toastDescriptionClassname = toast2.descriptionClassName || "";
3802
+ const heightIndex = React2$1.useMemo(() => heights.findIndex((height) => height.toastId === toast2.id) || 0, [
3803
+ heights,
3804
+ toast2.id
3805
+ ]);
3806
+ const closeButton = React2$1.useMemo(() => {
3807
+ var _toast_closeButton;
3808
+ return (_toast_closeButton = toast2.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
3809
+ }, [
3810
+ toast2.closeButton,
3811
+ closeButtonFromToaster
3812
+ ]);
3813
+ const duration = React2$1.useMemo(() => toast2.duration || durationFromToaster || TOAST_LIFETIME, [
3814
+ toast2.duration,
3815
+ durationFromToaster
3816
+ ]);
3817
+ const closeTimerStartTimeRef = React2$1.useRef(0);
3818
+ const offset2 = React2$1.useRef(0);
3819
+ const lastCloseTimerStartTimeRef = React2$1.useRef(0);
3820
+ const pointerStartRef = React2$1.useRef(null);
3821
+ const [y, x] = position.split("-");
3822
+ const toastsHeightBefore = React2$1.useMemo(() => {
3823
+ return heights.reduce((prev, curr, reducerIndex) => {
3824
+ if (reducerIndex >= heightIndex) {
3825
+ return prev;
3826
+ }
3827
+ return prev + curr.height;
3828
+ }, 0);
3829
+ }, [
3830
+ heights,
3831
+ heightIndex
3832
+ ]);
3833
+ const isDocumentHidden = useIsDocumentHidden();
3834
+ const invert = toast2.invert || ToasterInvert;
3835
+ const disabled = toastType === "loading";
3836
+ offset2.current = React2$1.useMemo(() => heightIndex * gap + toastsHeightBefore, [
3837
+ heightIndex,
3838
+ toastsHeightBefore
3839
+ ]);
3840
+ React2$1.useEffect(() => {
3841
+ remainingTime.current = duration;
3842
+ }, [
3843
+ duration
3844
+ ]);
3845
+ React2$1.useEffect(() => {
3846
+ setMounted(true);
3847
+ }, []);
3848
+ React2$1.useEffect(() => {
3849
+ const toastNode = toastRef.current;
3850
+ if (toastNode) {
3851
+ const height = toastNode.getBoundingClientRect().height;
3852
+ setInitialHeight(height);
3853
+ setHeights((h) => [
3854
+ {
3855
+ toastId: toast2.id,
3856
+ height,
3857
+ position: toast2.position
3858
+ },
3859
+ ...h
3860
+ ]);
3861
+ return () => setHeights((h) => h.filter((height2) => height2.toastId !== toast2.id));
3862
+ }
3863
+ }, [
3864
+ setHeights,
3865
+ toast2.id
3866
+ ]);
3867
+ React2$1.useLayoutEffect(() => {
3868
+ if (!mounted) return;
3869
+ const toastNode = toastRef.current;
3870
+ const originalHeight = toastNode.style.height;
3871
+ toastNode.style.height = "auto";
3872
+ const newHeight = toastNode.getBoundingClientRect().height;
3873
+ toastNode.style.height = originalHeight;
3874
+ setInitialHeight(newHeight);
3875
+ setHeights((heights2) => {
3876
+ const alreadyExists = heights2.find((height) => height.toastId === toast2.id);
3877
+ if (!alreadyExists) {
3878
+ return [
3879
+ {
3880
+ toastId: toast2.id,
3881
+ height: newHeight,
3882
+ position: toast2.position
3883
+ },
3884
+ ...heights2
3885
+ ];
3886
+ } else {
3887
+ return heights2.map((height) => height.toastId === toast2.id ? {
3888
+ ...height,
3889
+ height: newHeight
3890
+ } : height);
3891
+ }
3892
+ });
3893
+ }, [
3894
+ mounted,
3895
+ toast2.title,
3896
+ toast2.description,
3897
+ setHeights,
3898
+ toast2.id,
3899
+ toast2.jsx,
3900
+ toast2.action,
3901
+ toast2.cancel
3902
+ ]);
3903
+ const deleteToast = React2$1.useCallback(() => {
3904
+ setRemoved(true);
3905
+ setOffsetBeforeRemove(offset2.current);
3906
+ setHeights((h) => h.filter((height) => height.toastId !== toast2.id));
3907
+ setTimeout(() => {
3908
+ removeToast(toast2);
3909
+ }, TIME_BEFORE_UNMOUNT);
3910
+ }, [
3911
+ toast2,
3912
+ removeToast,
3913
+ setHeights,
3914
+ offset2
3915
+ ]);
3916
+ React2$1.useEffect(() => {
3917
+ if (toast2.promise && toastType === "loading" || toast2.duration === Infinity || toast2.type === "loading") return;
3918
+ let timeoutId;
3919
+ const pauseTimer = () => {
3920
+ if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
3921
+ const elapsedTime = (/* @__PURE__ */ new Date()).getTime() - closeTimerStartTimeRef.current;
3922
+ remainingTime.current = remainingTime.current - elapsedTime;
3923
+ }
3924
+ lastCloseTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
3925
+ };
3926
+ const startTimer = () => {
3927
+ if (remainingTime.current === Infinity) return;
3928
+ closeTimerStartTimeRef.current = (/* @__PURE__ */ new Date()).getTime();
3929
+ timeoutId = setTimeout(() => {
3930
+ toast2.onAutoClose == null ? void 0 : toast2.onAutoClose.call(toast2, toast2);
3931
+ deleteToast();
3932
+ }, remainingTime.current);
3933
+ };
3934
+ if (expanded || interacting || isDocumentHidden) {
3935
+ pauseTimer();
3936
+ } else {
3937
+ startTimer();
3938
+ }
3939
+ return () => clearTimeout(timeoutId);
3940
+ }, [
3941
+ expanded,
3942
+ interacting,
3943
+ toast2,
3944
+ toastType,
3945
+ isDocumentHidden,
3946
+ deleteToast
3947
+ ]);
3948
+ React2$1.useEffect(() => {
3949
+ if (toast2.delete) {
3950
+ deleteToast();
3951
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
3952
+ }
3953
+ }, [
3954
+ deleteToast,
3955
+ toast2.delete
3956
+ ]);
3957
+ function getLoadingIcon() {
3958
+ var _toast_classNames9;
3959
+ if (icons == null ? void 0 : icons.loading) {
3960
+ var _toast_classNames12;
3961
+ return /* @__PURE__ */ React2$1.createElement("div", {
3962
+ className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames12 = toast2.classNames) == null ? void 0 : _toast_classNames12.loader, "sonner-loader"),
3963
+ "data-visible": toastType === "loading"
3964
+ }, icons.loading);
3965
+ }
3966
+ return /* @__PURE__ */ React2$1.createElement(Loader, {
3967
+ className: cn(classNames == null ? void 0 : classNames.loader, toast2 == null ? void 0 : (_toast_classNames9 = toast2.classNames) == null ? void 0 : _toast_classNames9.loader),
3968
+ visible: toastType === "loading"
3969
+ });
3970
+ }
3971
+ const icon = toast2.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
3972
+ var _toast_richColors, _icons_close;
3973
+ return /* @__PURE__ */ React2$1.createElement("li", {
3974
+ tabIndex: 0,
3975
+ ref: toastRef,
3976
+ className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast2 == null ? void 0 : (_toast_classNames = toast2.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast2 == null ? void 0 : (_toast_classNames1 = toast2.classNames) == null ? void 0 : _toast_classNames1[toastType]),
3977
+ "data-sonner-toast": "",
3978
+ "data-rich-colors": (_toast_richColors = toast2.richColors) != null ? _toast_richColors : defaultRichColors,
3979
+ "data-styled": !Boolean(toast2.jsx || toast2.unstyled || unstyled),
3980
+ "data-mounted": mounted,
3981
+ "data-promise": Boolean(toast2.promise),
3982
+ "data-swiped": isSwiped,
3983
+ "data-removed": removed,
3984
+ "data-visible": isVisible,
3985
+ "data-y-position": y,
3986
+ "data-x-position": x,
3987
+ "data-index": index2,
3988
+ "data-front": isFront,
3989
+ "data-swiping": swiping,
3990
+ "data-dismissible": dismissible,
3991
+ "data-type": toastType,
3992
+ "data-invert": invert,
3993
+ "data-swipe-out": swipeOut,
3994
+ "data-swipe-direction": swipeOutDirection,
3995
+ "data-expanded": Boolean(expanded || expandByDefault && mounted),
3996
+ "data-testid": toast2.testId,
3997
+ style: {
3998
+ "--index": index2,
3999
+ "--toasts-before": index2,
4000
+ "--z-index": toasts.length - index2,
4001
+ "--offset": `${removed ? offsetBeforeRemove : offset2.current}px`,
4002
+ "--initial-height": expandByDefault ? "auto" : `${initialHeight}px`,
4003
+ ...style,
4004
+ ...toast2.style
4005
+ },
4006
+ onDragEnd: () => {
4007
+ setSwiping(false);
4008
+ setSwipeDirection(null);
4009
+ pointerStartRef.current = null;
4010
+ },
4011
+ onPointerDown: (event) => {
4012
+ if (event.button === 2) return;
4013
+ if (disabled || !dismissible) return;
4014
+ dragStartTime.current = /* @__PURE__ */ new Date();
4015
+ setOffsetBeforeRemove(offset2.current);
4016
+ event.target.setPointerCapture(event.pointerId);
4017
+ if (event.target.tagName === "BUTTON") return;
4018
+ setSwiping(true);
4019
+ pointerStartRef.current = {
4020
+ x: event.clientX,
4021
+ y: event.clientY
4022
+ };
4023
+ },
4024
+ onPointerUp: () => {
4025
+ var _toastRef_current, _toastRef_current1, _dragStartTime_current;
4026
+ if (swipeOut || !dismissible) return;
4027
+ pointerStartRef.current = null;
4028
+ const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue("--swipe-amount-x").replace("px", "")) || 0);
4029
+ const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue("--swipe-amount-y").replace("px", "")) || 0);
4030
+ const timeTaken = (/* @__PURE__ */ new Date()).getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
4031
+ const swipeAmount = swipeDirection === "x" ? swipeAmountX : swipeAmountY;
4032
+ const velocity = Math.abs(swipeAmount) / timeTaken;
4033
+ if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
4034
+ setOffsetBeforeRemove(offset2.current);
4035
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
4036
+ if (swipeDirection === "x") {
4037
+ setSwipeOutDirection(swipeAmountX > 0 ? "right" : "left");
4038
+ } else {
4039
+ setSwipeOutDirection(swipeAmountY > 0 ? "down" : "up");
4040
+ }
4041
+ deleteToast();
4042
+ setSwipeOut(true);
4043
+ return;
4044
+ } else {
4045
+ var _toastRef_current2, _toastRef_current3;
4046
+ (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty("--swipe-amount-x", `0px`);
4047
+ (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty("--swipe-amount-y", `0px`);
4048
+ }
4049
+ setIsSwiped(false);
4050
+ setSwiping(false);
4051
+ setSwipeDirection(null);
4052
+ },
4053
+ onPointerMove: (event) => {
4054
+ var _window_getSelection, _toastRef_current, _toastRef_current1;
4055
+ if (!pointerStartRef.current || !dismissible) return;
4056
+ const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
4057
+ if (isHighlighted) return;
4058
+ const yDelta = event.clientY - pointerStartRef.current.y;
4059
+ const xDelta = event.clientX - pointerStartRef.current.x;
4060
+ var _props_swipeDirections;
4061
+ const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
4062
+ if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
4063
+ setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? "x" : "y");
4064
+ }
4065
+ let swipeAmount = {
4066
+ x: 0,
4067
+ y: 0
4068
+ };
4069
+ const getDampening = (delta) => {
4070
+ const factor = Math.abs(delta) / 20;
4071
+ return 1 / (1.5 + factor);
4072
+ };
4073
+ if (swipeDirection === "y") {
4074
+ if (swipeDirections.includes("top") || swipeDirections.includes("bottom")) {
4075
+ if (swipeDirections.includes("top") && yDelta < 0 || swipeDirections.includes("bottom") && yDelta > 0) {
4076
+ swipeAmount.y = yDelta;
4077
+ } else {
4078
+ const dampenedDelta = yDelta * getDampening(yDelta);
4079
+ swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
4080
+ }
4081
+ }
4082
+ } else if (swipeDirection === "x") {
4083
+ if (swipeDirections.includes("left") || swipeDirections.includes("right")) {
4084
+ if (swipeDirections.includes("left") && xDelta < 0 || swipeDirections.includes("right") && xDelta > 0) {
4085
+ swipeAmount.x = xDelta;
4086
+ } else {
4087
+ const dampenedDelta = xDelta * getDampening(xDelta);
4088
+ swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
4089
+ }
4090
+ }
4091
+ }
4092
+ if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
4093
+ setIsSwiped(true);
4094
+ }
4095
+ (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty("--swipe-amount-x", `${swipeAmount.x}px`);
4096
+ (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty("--swipe-amount-y", `${swipeAmount.y}px`);
4097
+ }
4098
+ }, closeButton && !toast2.jsx && toastType !== "loading" ? /* @__PURE__ */ React2$1.createElement("button", {
4099
+ "aria-label": closeButtonAriaLabel,
4100
+ "data-disabled": disabled,
4101
+ "data-close-button": true,
4102
+ onClick: disabled || !dismissible ? () => {
4103
+ } : () => {
4104
+ deleteToast();
4105
+ toast2.onDismiss == null ? void 0 : toast2.onDismiss.call(toast2, toast2);
4106
+ },
4107
+ className: cn(classNames == null ? void 0 : classNames.closeButton, toast2 == null ? void 0 : (_toast_classNames2 = toast2.classNames) == null ? void 0 : _toast_classNames2.closeButton)
4108
+ }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast2.icon || toast2.promise) && toast2.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast2.icon) ? /* @__PURE__ */ React2$1.createElement("div", {
4109
+ "data-icon": "",
4110
+ className: cn(classNames == null ? void 0 : classNames.icon, toast2 == null ? void 0 : (_toast_classNames3 = toast2.classNames) == null ? void 0 : _toast_classNames3.icon)
4111
+ }, toast2.promise || toast2.type === "loading" && !toast2.icon ? toast2.icon || getLoadingIcon() : null, toast2.type !== "loading" ? icon : null) : null, /* @__PURE__ */ React2$1.createElement("div", {
4112
+ "data-content": "",
4113
+ className: cn(classNames == null ? void 0 : classNames.content, toast2 == null ? void 0 : (_toast_classNames4 = toast2.classNames) == null ? void 0 : _toast_classNames4.content)
4114
+ }, /* @__PURE__ */ React2$1.createElement("div", {
4115
+ "data-title": "",
4116
+ className: cn(classNames == null ? void 0 : classNames.title, toast2 == null ? void 0 : (_toast_classNames5 = toast2.classNames) == null ? void 0 : _toast_classNames5.title)
4117
+ }, toast2.jsx ? toast2.jsx : typeof toast2.title === "function" ? toast2.title() : toast2.title), toast2.description ? /* @__PURE__ */ React2$1.createElement("div", {
4118
+ "data-description": "",
4119
+ className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast2 == null ? void 0 : (_toast_classNames6 = toast2.classNames) == null ? void 0 : _toast_classNames6.description)
4120
+ }, typeof toast2.description === "function" ? toast2.description() : toast2.description) : null), /* @__PURE__ */ React2$1.isValidElement(toast2.cancel) ? toast2.cancel : toast2.cancel && isAction(toast2.cancel) ? /* @__PURE__ */ React2$1.createElement("button", {
4121
+ "data-button": true,
4122
+ "data-cancel": true,
4123
+ style: toast2.cancelButtonStyle || cancelButtonStyle,
4124
+ onClick: (event) => {
4125
+ if (!isAction(toast2.cancel)) return;
4126
+ if (!dismissible) return;
4127
+ toast2.cancel.onClick == null ? void 0 : toast2.cancel.onClick.call(toast2.cancel, event);
4128
+ deleteToast();
4129
+ },
4130
+ className: cn(classNames == null ? void 0 : classNames.cancelButton, toast2 == null ? void 0 : (_toast_classNames7 = toast2.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
4131
+ }, toast2.cancel.label) : null, /* @__PURE__ */ React2$1.isValidElement(toast2.action) ? toast2.action : toast2.action && isAction(toast2.action) ? /* @__PURE__ */ React2$1.createElement("button", {
4132
+ "data-button": true,
4133
+ "data-action": true,
4134
+ style: toast2.actionButtonStyle || actionButtonStyle,
4135
+ onClick: (event) => {
4136
+ if (!isAction(toast2.action)) return;
4137
+ toast2.action.onClick == null ? void 0 : toast2.action.onClick.call(toast2.action, event);
4138
+ if (event.defaultPrevented) return;
4139
+ deleteToast();
4140
+ },
4141
+ className: cn(classNames == null ? void 0 : classNames.actionButton, toast2 == null ? void 0 : (_toast_classNames8 = toast2.classNames) == null ? void 0 : _toast_classNames8.actionButton)
4142
+ }, toast2.action.label) : null);
4143
+ };
4144
+ function getDocumentDirection() {
4145
+ if (typeof window === "undefined") return "ltr";
4146
+ if (typeof document === "undefined") return "ltr";
4147
+ const dirAttribute = document.documentElement.getAttribute("dir");
4148
+ if (dirAttribute === "auto" || !dirAttribute) {
4149
+ return window.getComputedStyle(document.documentElement).direction;
4150
+ }
4151
+ return dirAttribute;
4152
+ }
4153
+ function assignOffset(defaultOffset, mobileOffset) {
4154
+ const styles = {};
4155
+ [
4156
+ defaultOffset,
4157
+ mobileOffset
4158
+ ].forEach((offset2, index2) => {
4159
+ const isMobile = index2 === 1;
4160
+ const prefix = isMobile ? "--mobile-offset" : "--offset";
4161
+ const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
4162
+ function assignAll(offset3) {
4163
+ [
4164
+ "top",
4165
+ "right",
4166
+ "bottom",
4167
+ "left"
4168
+ ].forEach((key) => {
4169
+ styles[`${prefix}-${key}`] = typeof offset3 === "number" ? `${offset3}px` : offset3;
4170
+ });
4171
+ }
4172
+ if (typeof offset2 === "number" || typeof offset2 === "string") {
4173
+ assignAll(offset2);
4174
+ } else if (typeof offset2 === "object") {
4175
+ [
4176
+ "top",
4177
+ "right",
4178
+ "bottom",
4179
+ "left"
4180
+ ].forEach((key) => {
4181
+ if (offset2[key] === void 0) {
4182
+ styles[`${prefix}-${key}`] = defaultValue;
4183
+ } else {
4184
+ styles[`${prefix}-${key}`] = typeof offset2[key] === "number" ? `${offset2[key]}px` : offset2[key];
4185
+ }
4186
+ });
4187
+ } else {
4188
+ assignAll(defaultValue);
4189
+ }
4190
+ });
4191
+ return styles;
4192
+ }
4193
+ const Toaster = /* @__PURE__ */ React2$1.forwardRef(function Toaster2(props, ref) {
4194
+ const { id, invert, position = "bottom-right", hotkey = [
4195
+ "altKey",
4196
+ "KeyT"
4197
+ ], expand, closeButton, className, offset: offset2, mobileOffset, theme = "light", richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = "Notifications" } = props;
4198
+ const [toasts, setToasts] = React2$1.useState([]);
4199
+ const filteredToasts = React2$1.useMemo(() => {
4200
+ if (id) {
4201
+ return toasts.filter((toast2) => toast2.toasterId === id);
4202
+ }
4203
+ return toasts.filter((toast2) => !toast2.toasterId);
4204
+ }, [
4205
+ toasts,
4206
+ id
4207
+ ]);
4208
+ const possiblePositions = React2$1.useMemo(() => {
4209
+ return Array.from(new Set([
4210
+ position
4211
+ ].concat(filteredToasts.filter((toast2) => toast2.position).map((toast2) => toast2.position))));
4212
+ }, [
4213
+ filteredToasts,
4214
+ position
4215
+ ]);
4216
+ const [heights, setHeights] = React2$1.useState([]);
4217
+ const [expanded, setExpanded] = React2$1.useState(false);
4218
+ const [interacting, setInteracting] = React2$1.useState(false);
4219
+ const [actualTheme, setActualTheme] = React2$1.useState(theme !== "system" ? theme : typeof window !== "undefined" ? window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "light");
4220
+ const listRef = React2$1.useRef(null);
4221
+ const hotkeyLabel = hotkey.join("+").replace(/Key/g, "").replace(/Digit/g, "");
4222
+ const lastFocusedElementRef = React2$1.useRef(null);
4223
+ const isFocusWithinRef = React2$1.useRef(false);
4224
+ const removeToast = React2$1.useCallback((toastToRemove) => {
4225
+ setToasts((toasts2) => {
4226
+ var _toasts_find;
4227
+ if (!((_toasts_find = toasts2.find((toast2) => toast2.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
4228
+ ToastState.dismiss(toastToRemove.id);
4229
+ }
4230
+ return toasts2.filter(({ id: id2 }) => id2 !== toastToRemove.id);
4231
+ });
4232
+ }, []);
4233
+ React2$1.useEffect(() => {
4234
+ return ToastState.subscribe((toast2) => {
4235
+ if (toast2.dismiss) {
4236
+ requestAnimationFrame(() => {
4237
+ setToasts((toasts2) => toasts2.map((t) => t.id === toast2.id ? {
4238
+ ...t,
4239
+ delete: true
4240
+ } : t));
4241
+ });
4242
+ return;
4243
+ }
4244
+ setTimeout(() => {
4245
+ ReactDOM.flushSync(() => {
4246
+ setToasts((toasts2) => {
4247
+ const indexOfExistingToast = toasts2.findIndex((t) => t.id === toast2.id);
4248
+ if (indexOfExistingToast !== -1) {
4249
+ return [
4250
+ ...toasts2.slice(0, indexOfExistingToast),
4251
+ {
4252
+ ...toasts2[indexOfExistingToast],
4253
+ ...toast2
4254
+ },
4255
+ ...toasts2.slice(indexOfExistingToast + 1)
4256
+ ];
4257
+ }
4258
+ return [
4259
+ toast2,
4260
+ ...toasts2
4261
+ ];
4262
+ });
4263
+ });
4264
+ });
4265
+ });
4266
+ }, [
4267
+ toasts
4268
+ ]);
4269
+ React2$1.useEffect(() => {
4270
+ if (theme !== "system") {
4271
+ setActualTheme(theme);
4272
+ return;
4273
+ }
4274
+ if (theme === "system") {
4275
+ if (window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
4276
+ setActualTheme("dark");
4277
+ } else {
4278
+ setActualTheme("light");
4279
+ }
4280
+ }
4281
+ if (typeof window === "undefined") return;
4282
+ const darkMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
4283
+ try {
4284
+ darkMediaQuery.addEventListener("change", ({ matches }) => {
4285
+ if (matches) {
4286
+ setActualTheme("dark");
4287
+ } else {
4288
+ setActualTheme("light");
4289
+ }
4290
+ });
4291
+ } catch (error) {
4292
+ darkMediaQuery.addListener(({ matches }) => {
4293
+ try {
4294
+ if (matches) {
4295
+ setActualTheme("dark");
4296
+ } else {
4297
+ setActualTheme("light");
4298
+ }
4299
+ } catch (e) {
4300
+ console.error(e);
4301
+ }
4302
+ });
4303
+ }
4304
+ }, [
4305
+ theme
4306
+ ]);
4307
+ React2$1.useEffect(() => {
4308
+ if (toasts.length <= 1) {
4309
+ setExpanded(false);
4310
+ }
4311
+ }, [
4312
+ toasts
4313
+ ]);
4314
+ React2$1.useEffect(() => {
4315
+ const handleKeyDown = (event) => {
4316
+ var _listRef_current;
4317
+ const isHotkeyPressed = hotkey.every((key) => event[key] || event.code === key);
4318
+ if (isHotkeyPressed) {
4319
+ var _listRef_current1;
4320
+ setExpanded(true);
4321
+ (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
4322
+ }
4323
+ if (event.code === "Escape" && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
4324
+ setExpanded(false);
4325
+ }
4326
+ };
4327
+ document.addEventListener("keydown", handleKeyDown);
4328
+ return () => document.removeEventListener("keydown", handleKeyDown);
4329
+ }, [
4330
+ hotkey
4331
+ ]);
4332
+ React2$1.useEffect(() => {
4333
+ if (listRef.current) {
4334
+ return () => {
4335
+ if (lastFocusedElementRef.current) {
4336
+ lastFocusedElementRef.current.focus({
4337
+ preventScroll: true
4338
+ });
4339
+ lastFocusedElementRef.current = null;
4340
+ isFocusWithinRef.current = false;
4341
+ }
4342
+ };
4343
+ }
4344
+ }, [
4345
+ listRef.current
4346
+ ]);
4347
+ return (
4348
+ // Remove item from normal navigation flow, only available via hotkey
4349
+ /* @__PURE__ */ React2$1.createElement("section", {
4350
+ ref,
4351
+ "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
4352
+ tabIndex: -1,
4353
+ "aria-live": "polite",
4354
+ "aria-relevant": "additions text",
4355
+ "aria-atomic": "false",
4356
+ suppressHydrationWarning: true
4357
+ }, possiblePositions.map((position2, index2) => {
4358
+ var _heights_;
4359
+ const [y, x] = position2.split("-");
4360
+ if (!filteredToasts.length) return null;
4361
+ return /* @__PURE__ */ React2$1.createElement("ol", {
4362
+ key: position2,
4363
+ dir: dir === "auto" ? getDocumentDirection() : dir,
4364
+ tabIndex: -1,
4365
+ ref: listRef,
4366
+ className,
4367
+ "data-sonner-toaster": true,
4368
+ "data-sonner-theme": actualTheme,
4369
+ "data-y-position": y,
4370
+ "data-x-position": x,
4371
+ style: {
4372
+ "--front-toast-height": `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
4373
+ "--width": `${TOAST_WIDTH}px`,
4374
+ "--gap": `${gap}px`,
4375
+ ...style,
4376
+ ...assignOffset(offset2, mobileOffset)
4377
+ },
4378
+ onBlur: (event) => {
4379
+ if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
4380
+ isFocusWithinRef.current = false;
4381
+ if (lastFocusedElementRef.current) {
4382
+ lastFocusedElementRef.current.focus({
4383
+ preventScroll: true
4384
+ });
4385
+ lastFocusedElementRef.current = null;
4386
+ }
4387
+ }
4388
+ },
4389
+ onFocus: (event) => {
4390
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
4391
+ if (isNotDismissible) return;
4392
+ if (!isFocusWithinRef.current) {
4393
+ isFocusWithinRef.current = true;
4394
+ lastFocusedElementRef.current = event.relatedTarget;
4395
+ }
4396
+ },
4397
+ onMouseEnter: () => setExpanded(true),
4398
+ onMouseMove: () => setExpanded(true),
4399
+ onMouseLeave: () => {
4400
+ if (!interacting) {
4401
+ setExpanded(false);
4402
+ }
4403
+ },
4404
+ onDragEnd: () => setExpanded(false),
4405
+ onPointerDown: (event) => {
4406
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === "false";
4407
+ if (isNotDismissible) return;
4408
+ setInteracting(true);
4409
+ },
4410
+ onPointerUp: () => setInteracting(false)
4411
+ }, filteredToasts.filter((toast2) => !toast2.position && index2 === 0 || toast2.position === position2).map((toast2, index3) => {
4412
+ var _toastOptions_duration, _toastOptions_closeButton;
4413
+ return /* @__PURE__ */ React2$1.createElement(Toast, {
4414
+ key: toast2.id,
4415
+ icons,
4416
+ index: index3,
4417
+ toast: toast2,
4418
+ defaultRichColors: richColors,
4419
+ duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
4420
+ className: toastOptions == null ? void 0 : toastOptions.className,
4421
+ descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
4422
+ invert,
4423
+ visibleToasts,
4424
+ closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
4425
+ interacting,
4426
+ position: position2,
4427
+ style: toastOptions == null ? void 0 : toastOptions.style,
4428
+ unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
4429
+ classNames: toastOptions == null ? void 0 : toastOptions.classNames,
4430
+ cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
4431
+ actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
4432
+ closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
4433
+ removeToast,
4434
+ toasts: filteredToasts.filter((t) => t.position == toast2.position),
4435
+ heights: heights.filter((h) => h.position == toast2.position),
4436
+ setHeights,
4437
+ expandByDefault: expand,
4438
+ gap,
4439
+ expanded,
4440
+ swipeDirections: props.swipeDirections
4441
+ });
4442
+ }));
4443
+ }))
4444
+ );
4445
+ });
4446
+ export {
4447
+ Anchor as A,
4448
+ hide as B,
4449
+ Content as C,
4450
+ DismissableLayer as D,
4451
+ autoUpdate as E,
4452
+ Primitive as P,
4453
+ Root2 as R,
4454
+ Toaster as T,
4455
+ VISUALLY_HIDDEN_STYLES as V,
4456
+ TooltipProvider as a,
4457
+ createSlot as b,
4458
+ createContextScope as c,
4459
+ useCallbackRef as d,
4460
+ composeEventHandlers as e,
4461
+ useLayoutEffect2 as f,
4462
+ Portal$1 as g,
4463
+ useId as h,
4464
+ createPopperScope as i,
4465
+ useControllableState as j,
4466
+ Arrow as k,
4467
+ Portal as l,
4468
+ Content2 as m,
4469
+ Arrow2 as n,
4470
+ Root3 as o,
4471
+ Trigger as p,
4472
+ Provider as q,
4473
+ useFloating as r,
4474
+ offset as s,
4475
+ toast as t,
4476
+ useComposedRefs as u,
4477
+ shift as v,
4478
+ limitShift as w,
4479
+ flip as x,
4480
+ size as y,
4481
+ arrow as z
4482
+ };