@retikolo/drag-drop-content-types-strapi 2.0.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 (51) hide show
  1. package/README.md +77 -0
  2. package/dist/_chunks/Settings-BUJ6OWyE.js +3632 -0
  3. package/dist/_chunks/Settings-Cx22s5Bk.mjs +3615 -0
  4. package/dist/_chunks/en-I3-CH3Sy.js +31 -0
  5. package/dist/_chunks/en-bxpER_P-.mjs +31 -0
  6. package/dist/_chunks/fr-C8Qw4iPZ.js +4 -0
  7. package/dist/_chunks/fr-hkSxFuzl.mjs +4 -0
  8. package/dist/_chunks/index-CxWC49Ye.mjs +477 -0
  9. package/dist/_chunks/index-D5Ne-GrP.js +478 -0
  10. package/dist/admin/index.js +3 -0
  11. package/dist/admin/index.mjs +4 -0
  12. package/dist/admin/src/components/Initializer.d.ts +5 -0
  13. package/dist/admin/src/components/PluginIcon.d.ts +2 -0
  14. package/dist/admin/src/components/SettingsTextField.d.ts +14 -0
  15. package/dist/admin/src/components/SettingsToggleField.d.ts +13 -0
  16. package/dist/admin/src/components/SortModal/CustomItem.d.ts +12 -0
  17. package/dist/admin/src/components/SortModal/SortMenu.d.ts +3 -0
  18. package/dist/admin/src/components/SortModal/SortableList.d.ts +3 -0
  19. package/dist/admin/src/components/SortModal/SortableListItem.d.ts +7 -0
  20. package/dist/admin/src/components/SortModal/index.d.ts +2 -0
  21. package/dist/admin/src/components/SortModal/utils.d.ts +2 -0
  22. package/dist/admin/src/components/TooltipIconButton.d.ts +11 -0
  23. package/dist/admin/src/index.d.ts +13 -0
  24. package/dist/admin/src/pages/App.d.ts +2 -0
  25. package/dist/admin/src/pages/HomePage.d.ts +2 -0
  26. package/dist/admin/src/pages/Settings.d.ts +2 -0
  27. package/dist/admin/src/permissions.d.ts +7 -0
  28. package/dist/admin/src/pluginId.d.ts +1 -0
  29. package/dist/admin/src/utils/getTranslation.d.ts +2 -0
  30. package/dist/admin/src/utils/strapi.d.ts +13 -0
  31. package/dist/admin/src/utils/useQueryParams.d.ts +7 -0
  32. package/dist/server/index.js +266 -0
  33. package/dist/server/index.mjs +267 -0
  34. package/dist/server/src/bootstrap.d.ts +5 -0
  35. package/dist/server/src/config/index.d.ts +5 -0
  36. package/dist/server/src/content-types/index.d.ts +2 -0
  37. package/dist/server/src/controllers/dragdrop.d.ts +9 -0
  38. package/dist/server/src/controllers/index.d.ts +16 -0
  39. package/dist/server/src/controllers/settings.d.ts +8 -0
  40. package/dist/server/src/destroy.d.ts +5 -0
  41. package/dist/server/src/index.d.ts +79 -0
  42. package/dist/server/src/middlewares/index.d.ts +2 -0
  43. package/dist/server/src/policies/index.d.ts +2 -0
  44. package/dist/server/src/register.d.ts +5 -0
  45. package/dist/server/src/routes/dragdrop.d.ts +13 -0
  46. package/dist/server/src/routes/index.d.ts +26 -0
  47. package/dist/server/src/routes/settings.d.ts +12 -0
  48. package/dist/server/src/services/dragdrop.d.ts +21 -0
  49. package/dist/server/src/services/index.d.ts +21 -0
  50. package/dist/server/src/services/settings.d.ts +8 -0
  51. package/package.json +98 -0
@@ -0,0 +1,3615 @@
1
+ import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { useCallback, createContext, useMemo, createElement, useContext, Fragment, forwardRef, Children, isValidElement, cloneElement, useEffect, useRef, useState, useLayoutEffect, useReducer } from "react";
4
+ import { useFetchClient, useNotification, Layouts, Page } from "@strapi/strapi/admin";
5
+ import { IconButton, Box, Typography, Field, Flex, TextInput, Toggle, Button, Grid } from "@strapi/design-system";
6
+ import { Information, Check } from "@strapi/icons";
7
+ import { useIntl } from "react-intl";
8
+ import { g as getTranslation } from "./index-CxWC49Ye.mjs";
9
+ import * as ReactDOM from "react-dom";
10
+ import ReactDOM__default, { flushSync } from "react-dom";
11
+ function _extends() {
12
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
13
+ for (var e = 1; e < arguments.length; e++) {
14
+ var t = arguments[e];
15
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
16
+ }
17
+ return n;
18
+ }, _extends.apply(null, arguments);
19
+ }
20
+ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
21
+ return function handleEvent(event) {
22
+ originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
23
+ if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
24
+ };
25
+ }
26
+ function $6ed0406888f73fc4$var$setRef(ref, value) {
27
+ if (typeof ref === "function") ref(value);
28
+ else if (ref !== null && ref !== void 0) ref.current = value;
29
+ }
30
+ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
31
+ return (node) => refs.forEach(
32
+ (ref) => $6ed0406888f73fc4$var$setRef(ref, node)
33
+ );
34
+ }
35
+ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
36
+ return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
37
+ }
38
+ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
39
+ let defaultContexts = [];
40
+ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
41
+ const BaseContext = /* @__PURE__ */ createContext(defaultContext);
42
+ const index2 = defaultContexts.length;
43
+ defaultContexts = [
44
+ ...defaultContexts,
45
+ defaultContext
46
+ ];
47
+ function Provider(props) {
48
+ const { scope, children, ...context } = props;
49
+ const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
50
+ const value = useMemo(
51
+ () => context,
52
+ Object.values(context)
53
+ );
54
+ return /* @__PURE__ */ createElement(Context.Provider, {
55
+ value
56
+ }, children);
57
+ }
58
+ function useContext$1(consumerName, scope) {
59
+ const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext;
60
+ const context = useContext(Context);
61
+ if (context) return context;
62
+ if (defaultContext !== void 0) return defaultContext;
63
+ throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
64
+ }
65
+ Provider.displayName = rootComponentName + "Provider";
66
+ return [
67
+ Provider,
68
+ useContext$1
69
+ ];
70
+ }
71
+ const createScope = () => {
72
+ const scopeContexts = defaultContexts.map((defaultContext) => {
73
+ return /* @__PURE__ */ createContext(defaultContext);
74
+ });
75
+ return function useScope(scope) {
76
+ const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
77
+ return useMemo(
78
+ () => ({
79
+ [`__scope${scopeName}`]: {
80
+ ...scope,
81
+ [scopeName]: contexts
82
+ }
83
+ }),
84
+ [
85
+ scope,
86
+ contexts
87
+ ]
88
+ );
89
+ };
90
+ };
91
+ createScope.scopeName = scopeName;
92
+ return [
93
+ $c512c27ab02ef895$export$fd42f52fd3ae1109,
94
+ $c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
95
+ ];
96
+ }
97
+ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
98
+ const baseScope = scopes[0];
99
+ if (scopes.length === 1) return baseScope;
100
+ const createScope1 = () => {
101
+ const scopeHooks = scopes.map(
102
+ (createScope) => ({
103
+ useScope: createScope(),
104
+ scopeName: createScope.scopeName
105
+ })
106
+ );
107
+ return function useComposedScopes(overrideScopes) {
108
+ const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => {
109
+ const scopeProps = useScope(overrideScopes);
110
+ const currentScope = scopeProps[`__scope${scopeName}`];
111
+ return {
112
+ ...nextScopes,
113
+ ...currentScope
114
+ };
115
+ }, {});
116
+ return useMemo(
117
+ () => ({
118
+ [`__scope${baseScope.scopeName}`]: nextScopes1
119
+ }),
120
+ [
121
+ nextScopes1
122
+ ]
123
+ );
124
+ };
125
+ };
126
+ createScope1.scopeName = baseScope.scopeName;
127
+ return createScope1;
128
+ }
129
+ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
130
+ const { children, ...slotProps } = props;
131
+ const childrenArray = Children.toArray(children);
132
+ const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
133
+ if (slottable) {
134
+ const newElement = slottable.props.children;
135
+ const newChildren = childrenArray.map((child) => {
136
+ if (child === slottable) {
137
+ if (Children.count(newElement) > 1) return Children.only(null);
138
+ return /* @__PURE__ */ isValidElement(newElement) ? newElement.props.children : null;
139
+ } else return child;
140
+ });
141
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
142
+ ref: forwardedRef
143
+ }), /* @__PURE__ */ isValidElement(newElement) ? /* @__PURE__ */ cloneElement(newElement, void 0, newChildren) : null);
144
+ }
145
+ return /* @__PURE__ */ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
146
+ ref: forwardedRef
147
+ }), children);
148
+ });
149
+ $5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot";
150
+ const $5e63c961fc1ce211$var$SlotClone = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
151
+ const { children, ...slotProps } = props;
152
+ if (/* @__PURE__ */ isValidElement(children)) return /* @__PURE__ */ cloneElement(children, {
153
+ ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
154
+ ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref
155
+ });
156
+ return Children.count(children) > 1 ? Children.only(null) : null;
157
+ });
158
+ $5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone";
159
+ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children }) => {
160
+ return /* @__PURE__ */ createElement(Fragment, null, children);
161
+ };
162
+ function $5e63c961fc1ce211$var$isSlottable(child) {
163
+ return /* @__PURE__ */ isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
164
+ }
165
+ function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
166
+ const overrideProps = {
167
+ ...childProps
168
+ };
169
+ for (const propName in childProps) {
170
+ const slotPropValue = slotProps[propName];
171
+ const childPropValue = childProps[propName];
172
+ const isHandler = /^on[A-Z]/.test(propName);
173
+ if (isHandler) {
174
+ if (slotPropValue && childPropValue) overrideProps[propName] = (...args) => {
175
+ childPropValue(...args);
176
+ slotPropValue(...args);
177
+ };
178
+ else if (slotPropValue) overrideProps[propName] = slotPropValue;
179
+ } else if (propName === "style") overrideProps[propName] = {
180
+ ...slotPropValue,
181
+ ...childPropValue
182
+ };
183
+ else if (propName === "className") overrideProps[propName] = [
184
+ slotPropValue,
185
+ childPropValue
186
+ ].filter(Boolean).join(" ");
187
+ }
188
+ return {
189
+ ...slotProps,
190
+ ...overrideProps
191
+ };
192
+ }
193
+ const $8927f6f2acc4f386$var$NODES = [
194
+ "a",
195
+ "button",
196
+ "div",
197
+ "form",
198
+ "h2",
199
+ "h3",
200
+ "img",
201
+ "input",
202
+ "label",
203
+ "li",
204
+ "nav",
205
+ "ol",
206
+ "p",
207
+ "span",
208
+ "svg",
209
+ "ul"
210
+ ];
211
+ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node) => {
212
+ const Node2 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
213
+ const { asChild, ...primitiveProps } = props;
214
+ const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
215
+ useEffect(() => {
216
+ window[Symbol.for("radix-ui")] = true;
217
+ }, []);
218
+ return /* @__PURE__ */ createElement(Comp, _extends({}, primitiveProps, {
219
+ ref: forwardedRef
220
+ }));
221
+ });
222
+ Node2.displayName = `Primitive.${node}`;
223
+ return {
224
+ ...primitive,
225
+ [node]: Node2
226
+ };
227
+ }, {});
228
+ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
229
+ if (target) flushSync(
230
+ () => target.dispatchEvent(event)
231
+ );
232
+ }
233
+ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
234
+ const callbackRef = useRef(callback);
235
+ useEffect(() => {
236
+ callbackRef.current = callback;
237
+ });
238
+ return useMemo(
239
+ () => (...args) => {
240
+ var _callbackRef$current;
241
+ return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
242
+ },
243
+ []
244
+ );
245
+ }
246
+ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
247
+ const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
248
+ useEffect(() => {
249
+ const handleKeyDown = (event) => {
250
+ if (event.key === "Escape") onEscapeKeyDown(event);
251
+ };
252
+ ownerDocument.addEventListener("keydown", handleKeyDown);
253
+ return () => ownerDocument.removeEventListener("keydown", handleKeyDown);
254
+ }, [
255
+ onEscapeKeyDown,
256
+ ownerDocument
257
+ ]);
258
+ }
259
+ const $5cb92bef7577960e$var$CONTEXT_UPDATE = "dismissableLayer.update";
260
+ const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
261
+ const $5cb92bef7577960e$var$FOCUS_OUTSIDE = "dismissableLayer.focusOutside";
262
+ let $5cb92bef7577960e$var$originalBodyPointerEvents;
263
+ const $5cb92bef7577960e$var$DismissableLayerContext = /* @__PURE__ */ createContext({
264
+ layers: /* @__PURE__ */ new Set(),
265
+ layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(),
266
+ branches: /* @__PURE__ */ new Set()
267
+ });
268
+ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
269
+ var _node$ownerDocument;
270
+ const { disableOutsidePointerEvents = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props;
271
+ const context = useContext($5cb92bef7577960e$var$DismissableLayerContext);
272
+ const [node1, setNode] = useState(null);
273
+ const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
274
+ const [, force] = useState({});
275
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
276
+ forwardedRef,
277
+ (node) => setNode(node)
278
+ );
279
+ const layers = Array.from(context.layers);
280
+ const [highestLayerWithOutsidePointerEventsDisabled] = [
281
+ ...context.layersWithOutsidePointerEventsDisabled
282
+ ].slice(-1);
283
+ const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled);
284
+ const index2 = node1 ? layers.indexOf(node1) : -1;
285
+ const isBodyPointerEventsDisabled = context.layersWithOutsidePointerEventsDisabled.size > 0;
286
+ const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex;
287
+ const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event) => {
288
+ const target = event.target;
289
+ const isPointerDownOnBranch = [
290
+ ...context.branches
291
+ ].some(
292
+ (branch) => branch.contains(target)
293
+ );
294
+ if (!isPointerEventsEnabled || isPointerDownOnBranch) return;
295
+ onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event);
296
+ onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
297
+ if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
298
+ }, ownerDocument);
299
+ const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event) => {
300
+ const target = event.target;
301
+ const isFocusInBranch = [
302
+ ...context.branches
303
+ ].some(
304
+ (branch) => branch.contains(target)
305
+ );
306
+ if (isFocusInBranch) return;
307
+ onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event);
308
+ onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event);
309
+ if (!event.defaultPrevented) onDismiss === null || onDismiss === void 0 || onDismiss();
310
+ }, ownerDocument);
311
+ $addc16e1bbe58fd0$export$3a72a57244d6e765((event) => {
312
+ const isHighestLayer = index2 === context.layers.size - 1;
313
+ if (!isHighestLayer) return;
314
+ onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event);
315
+ if (!event.defaultPrevented && onDismiss) {
316
+ event.preventDefault();
317
+ onDismiss();
318
+ }
319
+ }, ownerDocument);
320
+ useEffect(() => {
321
+ if (!node1) return;
322
+ if (disableOutsidePointerEvents) {
323
+ if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
324
+ $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents;
325
+ ownerDocument.body.style.pointerEvents = "none";
326
+ }
327
+ context.layersWithOutsidePointerEventsDisabled.add(node1);
328
+ }
329
+ context.layers.add(node1);
330
+ $5cb92bef7577960e$var$dispatchUpdate();
331
+ return () => {
332
+ if (disableOutsidePointerEvents && context.layersWithOutsidePointerEventsDisabled.size === 1) ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents;
333
+ };
334
+ }, [
335
+ node1,
336
+ ownerDocument,
337
+ disableOutsidePointerEvents,
338
+ context
339
+ ]);
340
+ useEffect(() => {
341
+ return () => {
342
+ if (!node1) return;
343
+ context.layers.delete(node1);
344
+ context.layersWithOutsidePointerEventsDisabled.delete(node1);
345
+ $5cb92bef7577960e$var$dispatchUpdate();
346
+ };
347
+ }, [
348
+ node1,
349
+ context
350
+ ]);
351
+ useEffect(() => {
352
+ const handleUpdate = () => force({});
353
+ document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
354
+ return () => document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
355
+ }, []);
356
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, layerProps, {
357
+ ref: composedRefs,
358
+ style: {
359
+ pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0,
360
+ ...props.style
361
+ },
362
+ onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
363
+ onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
364
+ onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
365
+ }));
366
+ });
367
+ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
368
+ const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
369
+ const isPointerInsideReactTreeRef = useRef(false);
370
+ const handleClickRef = useRef(() => {
371
+ });
372
+ useEffect(() => {
373
+ const handlePointerDown = (event) => {
374
+ if (event.target && !isPointerInsideReactTreeRef.current) {
375
+ let handleAndDispatchPointerDownOutsideEvent = function() {
376
+ $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, {
377
+ discrete: true
378
+ });
379
+ };
380
+ const eventDetail = {
381
+ originalEvent: event
382
+ };
383
+ if (event.pointerType === "touch") {
384
+ ownerDocument.removeEventListener("click", handleClickRef.current);
385
+ handleClickRef.current = handleAndDispatchPointerDownOutsideEvent;
386
+ ownerDocument.addEventListener("click", handleClickRef.current, {
387
+ once: true
388
+ });
389
+ } else handleAndDispatchPointerDownOutsideEvent();
390
+ } else
391
+ ownerDocument.removeEventListener("click", handleClickRef.current);
392
+ isPointerInsideReactTreeRef.current = false;
393
+ };
394
+ const timerId = window.setTimeout(() => {
395
+ ownerDocument.addEventListener("pointerdown", handlePointerDown);
396
+ }, 0);
397
+ return () => {
398
+ window.clearTimeout(timerId);
399
+ ownerDocument.removeEventListener("pointerdown", handlePointerDown);
400
+ ownerDocument.removeEventListener("click", handleClickRef.current);
401
+ };
402
+ }, [
403
+ ownerDocument,
404
+ handlePointerDownOutside
405
+ ]);
406
+ return {
407
+ // ensures we check React component tree (not just DOM tree)
408
+ onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true
409
+ };
410
+ }
411
+ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
412
+ const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
413
+ const isFocusInsideReactTreeRef = useRef(false);
414
+ useEffect(() => {
415
+ const handleFocus = (event) => {
416
+ if (event.target && !isFocusInsideReactTreeRef.current) {
417
+ const eventDetail = {
418
+ originalEvent: event
419
+ };
420
+ $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, {
421
+ discrete: false
422
+ });
423
+ }
424
+ };
425
+ ownerDocument.addEventListener("focusin", handleFocus);
426
+ return () => ownerDocument.removeEventListener("focusin", handleFocus);
427
+ }, [
428
+ ownerDocument,
429
+ handleFocusOutside
430
+ ]);
431
+ return {
432
+ onFocusCapture: () => isFocusInsideReactTreeRef.current = true,
433
+ onBlurCapture: () => isFocusInsideReactTreeRef.current = false
434
+ };
435
+ }
436
+ function $5cb92bef7577960e$var$dispatchUpdate() {
437
+ const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE);
438
+ document.dispatchEvent(event);
439
+ }
440
+ function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detail, { discrete }) {
441
+ const target = detail.originalEvent.target;
442
+ const event = new CustomEvent(name, {
443
+ bubbles: false,
444
+ cancelable: true,
445
+ detail
446
+ });
447
+ if (handler) target.addEventListener(name, handler, {
448
+ once: true
449
+ });
450
+ if (discrete) $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
451
+ else target.dispatchEvent(event);
452
+ }
453
+ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? useLayoutEffect : () => {
454
+ };
455
+ const $1746a345f3d73bb7$var$useReactId = React["useId".toString()] || (() => void 0);
456
+ let $1746a345f3d73bb7$var$count = 0;
457
+ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
458
+ const [id, setId] = React.useState($1746a345f3d73bb7$var$useReactId());
459
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
460
+ setId(
461
+ (reactId) => reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
462
+ );
463
+ }, [
464
+ deterministicId
465
+ ]);
466
+ return id ? `radix-${id}` : "";
467
+ }
468
+ const sides = ["top", "right", "bottom", "left"];
469
+ const min = Math.min;
470
+ const max = Math.max;
471
+ const round = Math.round;
472
+ const floor = Math.floor;
473
+ const createCoords = (v) => ({
474
+ x: v,
475
+ y: v
476
+ });
477
+ const oppositeSideMap = {
478
+ left: "right",
479
+ right: "left",
480
+ bottom: "top",
481
+ top: "bottom"
482
+ };
483
+ const oppositeAlignmentMap = {
484
+ start: "end",
485
+ end: "start"
486
+ };
487
+ function clamp(start, value, end) {
488
+ return max(start, min(value, end));
489
+ }
490
+ function evaluate(value, param) {
491
+ return typeof value === "function" ? value(param) : value;
492
+ }
493
+ function getSide(placement) {
494
+ return placement.split("-")[0];
495
+ }
496
+ function getAlignment(placement) {
497
+ return placement.split("-")[1];
498
+ }
499
+ function getOppositeAxis(axis) {
500
+ return axis === "x" ? "y" : "x";
501
+ }
502
+ function getAxisLength(axis) {
503
+ return axis === "y" ? "height" : "width";
504
+ }
505
+ const yAxisSides = /* @__PURE__ */ new Set(["top", "bottom"]);
506
+ function getSideAxis(placement) {
507
+ return yAxisSides.has(getSide(placement)) ? "y" : "x";
508
+ }
509
+ function getAlignmentAxis(placement) {
510
+ return getOppositeAxis(getSideAxis(placement));
511
+ }
512
+ function getAlignmentSides(placement, rects, rtl) {
513
+ if (rtl === void 0) {
514
+ rtl = false;
515
+ }
516
+ const alignment = getAlignment(placement);
517
+ const alignmentAxis = getAlignmentAxis(placement);
518
+ const length = getAxisLength(alignmentAxis);
519
+ let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
520
+ if (rects.reference[length] > rects.floating[length]) {
521
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
522
+ }
523
+ return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
524
+ }
525
+ function getExpandedPlacements(placement) {
526
+ const oppositePlacement = getOppositePlacement(placement);
527
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
528
+ }
529
+ function getOppositeAlignmentPlacement(placement) {
530
+ return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]);
531
+ }
532
+ const lrPlacement = ["left", "right"];
533
+ const rlPlacement = ["right", "left"];
534
+ const tbPlacement = ["top", "bottom"];
535
+ const btPlacement = ["bottom", "top"];
536
+ function getSideList(side, isStart, rtl) {
537
+ switch (side) {
538
+ case "top":
539
+ case "bottom":
540
+ if (rtl) return isStart ? rlPlacement : lrPlacement;
541
+ return isStart ? lrPlacement : rlPlacement;
542
+ case "left":
543
+ case "right":
544
+ return isStart ? tbPlacement : btPlacement;
545
+ default:
546
+ return [];
547
+ }
548
+ }
549
+ function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
550
+ const alignment = getAlignment(placement);
551
+ let list = getSideList(getSide(placement), direction === "start", rtl);
552
+ if (alignment) {
553
+ list = list.map((side) => side + "-" + alignment);
554
+ if (flipAlignment) {
555
+ list = list.concat(list.map(getOppositeAlignmentPlacement));
556
+ }
557
+ }
558
+ return list;
559
+ }
560
+ function getOppositePlacement(placement) {
561
+ return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]);
562
+ }
563
+ function expandPaddingObject(padding) {
564
+ return {
565
+ top: 0,
566
+ right: 0,
567
+ bottom: 0,
568
+ left: 0,
569
+ ...padding
570
+ };
571
+ }
572
+ function getPaddingObject(padding) {
573
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
574
+ top: padding,
575
+ right: padding,
576
+ bottom: padding,
577
+ left: padding
578
+ };
579
+ }
580
+ function rectToClientRect(rect) {
581
+ const {
582
+ x,
583
+ y,
584
+ width,
585
+ height
586
+ } = rect;
587
+ return {
588
+ width,
589
+ height,
590
+ top: y,
591
+ left: x,
592
+ right: x + width,
593
+ bottom: y + height,
594
+ x,
595
+ y
596
+ };
597
+ }
598
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
599
+ let {
600
+ reference,
601
+ floating
602
+ } = _ref;
603
+ const sideAxis = getSideAxis(placement);
604
+ const alignmentAxis = getAlignmentAxis(placement);
605
+ const alignLength = getAxisLength(alignmentAxis);
606
+ const side = getSide(placement);
607
+ const isVertical = sideAxis === "y";
608
+ const commonX = reference.x + reference.width / 2 - floating.width / 2;
609
+ const commonY = reference.y + reference.height / 2 - floating.height / 2;
610
+ const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
611
+ let coords;
612
+ switch (side) {
613
+ case "top":
614
+ coords = {
615
+ x: commonX,
616
+ y: reference.y - floating.height
617
+ };
618
+ break;
619
+ case "bottom":
620
+ coords = {
621
+ x: commonX,
622
+ y: reference.y + reference.height
623
+ };
624
+ break;
625
+ case "right":
626
+ coords = {
627
+ x: reference.x + reference.width,
628
+ y: commonY
629
+ };
630
+ break;
631
+ case "left":
632
+ coords = {
633
+ x: reference.x - floating.width,
634
+ y: commonY
635
+ };
636
+ break;
637
+ default:
638
+ coords = {
639
+ x: reference.x,
640
+ y: reference.y
641
+ };
642
+ }
643
+ switch (getAlignment(placement)) {
644
+ case "start":
645
+ coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
646
+ break;
647
+ case "end":
648
+ coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
649
+ break;
650
+ }
651
+ return coords;
652
+ }
653
+ async function detectOverflow(state, options) {
654
+ var _await$platform$isEle;
655
+ if (options === void 0) {
656
+ options = {};
657
+ }
658
+ const {
659
+ x,
660
+ y,
661
+ platform: platform2,
662
+ rects,
663
+ elements,
664
+ strategy
665
+ } = state;
666
+ const {
667
+ boundary = "clippingAncestors",
668
+ rootBoundary = "viewport",
669
+ elementContext = "floating",
670
+ altBoundary = false,
671
+ padding = 0
672
+ } = evaluate(options, state);
673
+ const paddingObject = getPaddingObject(padding);
674
+ const altContext = elementContext === "floating" ? "reference" : "floating";
675
+ const element = elements[altBoundary ? altContext : elementContext];
676
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
677
+ 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)),
678
+ boundary,
679
+ rootBoundary,
680
+ strategy
681
+ }));
682
+ const rect = elementContext === "floating" ? {
683
+ x,
684
+ y,
685
+ width: rects.floating.width,
686
+ height: rects.floating.height
687
+ } : rects.reference;
688
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
689
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
690
+ x: 1,
691
+ y: 1
692
+ } : {
693
+ x: 1,
694
+ y: 1
695
+ };
696
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
697
+ elements,
698
+ rect,
699
+ offsetParent,
700
+ strategy
701
+ }) : rect);
702
+ return {
703
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
704
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
705
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
706
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
707
+ };
708
+ }
709
+ const computePosition$1 = async (reference, floating, config) => {
710
+ const {
711
+ placement = "bottom",
712
+ strategy = "absolute",
713
+ middleware = [],
714
+ platform: platform2
715
+ } = config;
716
+ const validMiddleware = middleware.filter(Boolean);
717
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
718
+ let rects = await platform2.getElementRects({
719
+ reference,
720
+ floating,
721
+ strategy
722
+ });
723
+ let {
724
+ x,
725
+ y
726
+ } = computeCoordsFromPlacement(rects, placement, rtl);
727
+ let statefulPlacement = placement;
728
+ let middlewareData = {};
729
+ let resetCount = 0;
730
+ for (let i = 0; i < validMiddleware.length; i++) {
731
+ var _platform$detectOverf;
732
+ const {
733
+ name,
734
+ fn
735
+ } = validMiddleware[i];
736
+ const {
737
+ x: nextX,
738
+ y: nextY,
739
+ data,
740
+ reset
741
+ } = await fn({
742
+ x,
743
+ y,
744
+ initialPlacement: placement,
745
+ placement: statefulPlacement,
746
+ strategy,
747
+ middlewareData,
748
+ rects,
749
+ platform: {
750
+ ...platform2,
751
+ detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
752
+ },
753
+ elements: {
754
+ reference,
755
+ floating
756
+ }
757
+ });
758
+ x = nextX != null ? nextX : x;
759
+ y = nextY != null ? nextY : y;
760
+ middlewareData = {
761
+ ...middlewareData,
762
+ [name]: {
763
+ ...middlewareData[name],
764
+ ...data
765
+ }
766
+ };
767
+ if (reset && resetCount <= 50) {
768
+ resetCount++;
769
+ if (typeof reset === "object") {
770
+ if (reset.placement) {
771
+ statefulPlacement = reset.placement;
772
+ }
773
+ if (reset.rects) {
774
+ rects = reset.rects === true ? await platform2.getElementRects({
775
+ reference,
776
+ floating,
777
+ strategy
778
+ }) : reset.rects;
779
+ }
780
+ ({
781
+ x,
782
+ y
783
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
784
+ }
785
+ i = -1;
786
+ }
787
+ }
788
+ return {
789
+ x,
790
+ y,
791
+ placement: statefulPlacement,
792
+ strategy,
793
+ middlewareData
794
+ };
795
+ };
796
+ const arrow$3 = (options) => ({
797
+ name: "arrow",
798
+ options,
799
+ async fn(state) {
800
+ const {
801
+ x,
802
+ y,
803
+ placement,
804
+ rects,
805
+ platform: platform2,
806
+ elements,
807
+ middlewareData
808
+ } = state;
809
+ const {
810
+ element,
811
+ padding = 0
812
+ } = evaluate(options, state) || {};
813
+ if (element == null) {
814
+ return {};
815
+ }
816
+ const paddingObject = getPaddingObject(padding);
817
+ const coords = {
818
+ x,
819
+ y
820
+ };
821
+ const axis = getAlignmentAxis(placement);
822
+ const length = getAxisLength(axis);
823
+ const arrowDimensions = await platform2.getDimensions(element);
824
+ const isYAxis = axis === "y";
825
+ const minProp = isYAxis ? "top" : "left";
826
+ const maxProp = isYAxis ? "bottom" : "right";
827
+ const clientProp = isYAxis ? "clientHeight" : "clientWidth";
828
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
829
+ const startDiff = coords[axis] - rects.reference[axis];
830
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
831
+ let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
832
+ if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) {
833
+ clientSize = elements.floating[clientProp] || rects.floating[length];
834
+ }
835
+ const centerToReference = endDiff / 2 - startDiff / 2;
836
+ const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
837
+ const minPadding = min(paddingObject[minProp], largestPossiblePadding);
838
+ const maxPadding = min(paddingObject[maxProp], largestPossiblePadding);
839
+ const min$1 = minPadding;
840
+ const max2 = clientSize - arrowDimensions[length] - maxPadding;
841
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
842
+ const offset2 = clamp(min$1, center, max2);
843
+ const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
844
+ const alignmentOffset = shouldAddOffset ? center < min$1 ? center - min$1 : center - max2 : 0;
845
+ return {
846
+ [axis]: coords[axis] + alignmentOffset,
847
+ data: {
848
+ [axis]: offset2,
849
+ centerOffset: center - offset2 - alignmentOffset,
850
+ ...shouldAddOffset && {
851
+ alignmentOffset
852
+ }
853
+ },
854
+ reset: shouldAddOffset
855
+ };
856
+ }
857
+ });
858
+ const flip$2 = function(options) {
859
+ if (options === void 0) {
860
+ options = {};
861
+ }
862
+ return {
863
+ name: "flip",
864
+ options,
865
+ async fn(state) {
866
+ var _middlewareData$arrow, _middlewareData$flip;
867
+ const {
868
+ placement,
869
+ middlewareData,
870
+ rects,
871
+ initialPlacement,
872
+ platform: platform2,
873
+ elements
874
+ } = state;
875
+ const {
876
+ mainAxis: checkMainAxis = true,
877
+ crossAxis: checkCrossAxis = true,
878
+ fallbackPlacements: specifiedFallbackPlacements,
879
+ fallbackStrategy = "bestFit",
880
+ fallbackAxisSideDirection = "none",
881
+ flipAlignment = true,
882
+ ...detectOverflowOptions
883
+ } = evaluate(options, state);
884
+ if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
885
+ return {};
886
+ }
887
+ const side = getSide(placement);
888
+ const initialSideAxis = getSideAxis(initialPlacement);
889
+ const isBasePlacement = getSide(initialPlacement) === initialPlacement;
890
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
891
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
892
+ const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
893
+ if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
894
+ fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
895
+ }
896
+ const placements = [initialPlacement, ...fallbackPlacements];
897
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
898
+ const overflows = [];
899
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
900
+ if (checkMainAxis) {
901
+ overflows.push(overflow[side]);
902
+ }
903
+ if (checkCrossAxis) {
904
+ const sides2 = getAlignmentSides(placement, rects, rtl);
905
+ overflows.push(overflow[sides2[0]], overflow[sides2[1]]);
906
+ }
907
+ overflowsData = [...overflowsData, {
908
+ placement,
909
+ overflows
910
+ }];
911
+ if (!overflows.every((side2) => side2 <= 0)) {
912
+ var _middlewareData$flip2, _overflowsData$filter;
913
+ const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
914
+ const nextPlacement = placements[nextIndex];
915
+ if (nextPlacement) {
916
+ const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false;
917
+ if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis
918
+ // overflows the main axis.
919
+ overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
920
+ return {
921
+ data: {
922
+ index: nextIndex,
923
+ overflows: overflowsData
924
+ },
925
+ reset: {
926
+ placement: nextPlacement
927
+ }
928
+ };
929
+ }
930
+ }
931
+ 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;
932
+ if (!resetPlacement) {
933
+ switch (fallbackStrategy) {
934
+ case "bestFit": {
935
+ var _overflowsData$filter2;
936
+ const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => {
937
+ if (hasFallbackAxisSideDirection) {
938
+ const currentSideAxis = getSideAxis(d.placement);
939
+ return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal
940
+ // reading directions favoring greater width.
941
+ currentSideAxis === "y";
942
+ }
943
+ return true;
944
+ }).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];
945
+ if (placement2) {
946
+ resetPlacement = placement2;
947
+ }
948
+ break;
949
+ }
950
+ case "initialPlacement":
951
+ resetPlacement = initialPlacement;
952
+ break;
953
+ }
954
+ }
955
+ if (placement !== resetPlacement) {
956
+ return {
957
+ reset: {
958
+ placement: resetPlacement
959
+ }
960
+ };
961
+ }
962
+ }
963
+ return {};
964
+ }
965
+ };
966
+ };
967
+ function getSideOffsets(overflow, rect) {
968
+ return {
969
+ top: overflow.top - rect.height,
970
+ right: overflow.right - rect.width,
971
+ bottom: overflow.bottom - rect.height,
972
+ left: overflow.left - rect.width
973
+ };
974
+ }
975
+ function isAnySideFullyClipped(overflow) {
976
+ return sides.some((side) => overflow[side] >= 0);
977
+ }
978
+ const hide$2 = function(options) {
979
+ if (options === void 0) {
980
+ options = {};
981
+ }
982
+ return {
983
+ name: "hide",
984
+ options,
985
+ async fn(state) {
986
+ const {
987
+ rects,
988
+ platform: platform2
989
+ } = state;
990
+ const {
991
+ strategy = "referenceHidden",
992
+ ...detectOverflowOptions
993
+ } = evaluate(options, state);
994
+ switch (strategy) {
995
+ case "referenceHidden": {
996
+ const overflow = await platform2.detectOverflow(state, {
997
+ ...detectOverflowOptions,
998
+ elementContext: "reference"
999
+ });
1000
+ const offsets = getSideOffsets(overflow, rects.reference);
1001
+ return {
1002
+ data: {
1003
+ referenceHiddenOffsets: offsets,
1004
+ referenceHidden: isAnySideFullyClipped(offsets)
1005
+ }
1006
+ };
1007
+ }
1008
+ case "escaped": {
1009
+ const overflow = await platform2.detectOverflow(state, {
1010
+ ...detectOverflowOptions,
1011
+ altBoundary: true
1012
+ });
1013
+ const offsets = getSideOffsets(overflow, rects.floating);
1014
+ return {
1015
+ data: {
1016
+ escapedOffsets: offsets,
1017
+ escaped: isAnySideFullyClipped(offsets)
1018
+ }
1019
+ };
1020
+ }
1021
+ default: {
1022
+ return {};
1023
+ }
1024
+ }
1025
+ }
1026
+ };
1027
+ };
1028
+ const originSides = /* @__PURE__ */ new Set(["left", "top"]);
1029
+ async function convertValueToCoords(state, options) {
1030
+ const {
1031
+ placement,
1032
+ platform: platform2,
1033
+ elements
1034
+ } = state;
1035
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
1036
+ const side = getSide(placement);
1037
+ const alignment = getAlignment(placement);
1038
+ const isVertical = getSideAxis(placement) === "y";
1039
+ const mainAxisMulti = originSides.has(side) ? -1 : 1;
1040
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
1041
+ const rawValue = evaluate(options, state);
1042
+ let {
1043
+ mainAxis,
1044
+ crossAxis,
1045
+ alignmentAxis
1046
+ } = typeof rawValue === "number" ? {
1047
+ mainAxis: rawValue,
1048
+ crossAxis: 0,
1049
+ alignmentAxis: null
1050
+ } : {
1051
+ mainAxis: rawValue.mainAxis || 0,
1052
+ crossAxis: rawValue.crossAxis || 0,
1053
+ alignmentAxis: rawValue.alignmentAxis
1054
+ };
1055
+ if (alignment && typeof alignmentAxis === "number") {
1056
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
1057
+ }
1058
+ return isVertical ? {
1059
+ x: crossAxis * crossAxisMulti,
1060
+ y: mainAxis * mainAxisMulti
1061
+ } : {
1062
+ x: mainAxis * mainAxisMulti,
1063
+ y: crossAxis * crossAxisMulti
1064
+ };
1065
+ }
1066
+ const offset$2 = function(options) {
1067
+ if (options === void 0) {
1068
+ options = 0;
1069
+ }
1070
+ return {
1071
+ name: "offset",
1072
+ options,
1073
+ async fn(state) {
1074
+ var _middlewareData$offse, _middlewareData$arrow;
1075
+ const {
1076
+ x,
1077
+ y,
1078
+ placement,
1079
+ middlewareData
1080
+ } = state;
1081
+ const diffCoords = await convertValueToCoords(state, options);
1082
+ if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
1083
+ return {};
1084
+ }
1085
+ return {
1086
+ x: x + diffCoords.x,
1087
+ y: y + diffCoords.y,
1088
+ data: {
1089
+ ...diffCoords,
1090
+ placement
1091
+ }
1092
+ };
1093
+ }
1094
+ };
1095
+ };
1096
+ const shift$2 = function(options) {
1097
+ if (options === void 0) {
1098
+ options = {};
1099
+ }
1100
+ return {
1101
+ name: "shift",
1102
+ options,
1103
+ async fn(state) {
1104
+ const {
1105
+ x,
1106
+ y,
1107
+ placement,
1108
+ platform: platform2
1109
+ } = state;
1110
+ const {
1111
+ mainAxis: checkMainAxis = true,
1112
+ crossAxis: checkCrossAxis = false,
1113
+ limiter = {
1114
+ fn: (_ref) => {
1115
+ let {
1116
+ x: x2,
1117
+ y: y2
1118
+ } = _ref;
1119
+ return {
1120
+ x: x2,
1121
+ y: y2
1122
+ };
1123
+ }
1124
+ },
1125
+ ...detectOverflowOptions
1126
+ } = evaluate(options, state);
1127
+ const coords = {
1128
+ x,
1129
+ y
1130
+ };
1131
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1132
+ const crossAxis = getSideAxis(getSide(placement));
1133
+ const mainAxis = getOppositeAxis(crossAxis);
1134
+ let mainAxisCoord = coords[mainAxis];
1135
+ let crossAxisCoord = coords[crossAxis];
1136
+ if (checkMainAxis) {
1137
+ const minSide = mainAxis === "y" ? "top" : "left";
1138
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
1139
+ const min2 = mainAxisCoord + overflow[minSide];
1140
+ const max2 = mainAxisCoord - overflow[maxSide];
1141
+ mainAxisCoord = clamp(min2, mainAxisCoord, max2);
1142
+ }
1143
+ if (checkCrossAxis) {
1144
+ const minSide = crossAxis === "y" ? "top" : "left";
1145
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
1146
+ const min2 = crossAxisCoord + overflow[minSide];
1147
+ const max2 = crossAxisCoord - overflow[maxSide];
1148
+ crossAxisCoord = clamp(min2, crossAxisCoord, max2);
1149
+ }
1150
+ const limitedCoords = limiter.fn({
1151
+ ...state,
1152
+ [mainAxis]: mainAxisCoord,
1153
+ [crossAxis]: crossAxisCoord
1154
+ });
1155
+ return {
1156
+ ...limitedCoords,
1157
+ data: {
1158
+ x: limitedCoords.x - x,
1159
+ y: limitedCoords.y - y,
1160
+ enabled: {
1161
+ [mainAxis]: checkMainAxis,
1162
+ [crossAxis]: checkCrossAxis
1163
+ }
1164
+ }
1165
+ };
1166
+ }
1167
+ };
1168
+ };
1169
+ const limitShift$2 = function(options) {
1170
+ if (options === void 0) {
1171
+ options = {};
1172
+ }
1173
+ return {
1174
+ options,
1175
+ fn(state) {
1176
+ const {
1177
+ x,
1178
+ y,
1179
+ placement,
1180
+ rects,
1181
+ middlewareData
1182
+ } = state;
1183
+ const {
1184
+ offset: offset2 = 0,
1185
+ mainAxis: checkMainAxis = true,
1186
+ crossAxis: checkCrossAxis = true
1187
+ } = evaluate(options, state);
1188
+ const coords = {
1189
+ x,
1190
+ y
1191
+ };
1192
+ const crossAxis = getSideAxis(placement);
1193
+ const mainAxis = getOppositeAxis(crossAxis);
1194
+ let mainAxisCoord = coords[mainAxis];
1195
+ let crossAxisCoord = coords[crossAxis];
1196
+ const rawOffset = evaluate(offset2, state);
1197
+ const computedOffset = typeof rawOffset === "number" ? {
1198
+ mainAxis: rawOffset,
1199
+ crossAxis: 0
1200
+ } : {
1201
+ mainAxis: 0,
1202
+ crossAxis: 0,
1203
+ ...rawOffset
1204
+ };
1205
+ if (checkMainAxis) {
1206
+ const len = mainAxis === "y" ? "height" : "width";
1207
+ const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1208
+ const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1209
+ if (mainAxisCoord < limitMin) {
1210
+ mainAxisCoord = limitMin;
1211
+ } else if (mainAxisCoord > limitMax) {
1212
+ mainAxisCoord = limitMax;
1213
+ }
1214
+ }
1215
+ if (checkCrossAxis) {
1216
+ var _middlewareData$offse, _middlewareData$offse2;
1217
+ const len = mainAxis === "y" ? "width" : "height";
1218
+ const isOriginSide = originSides.has(getSide(placement));
1219
+ 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);
1220
+ 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);
1221
+ if (crossAxisCoord < limitMin) {
1222
+ crossAxisCoord = limitMin;
1223
+ } else if (crossAxisCoord > limitMax) {
1224
+ crossAxisCoord = limitMax;
1225
+ }
1226
+ }
1227
+ return {
1228
+ [mainAxis]: mainAxisCoord,
1229
+ [crossAxis]: crossAxisCoord
1230
+ };
1231
+ }
1232
+ };
1233
+ };
1234
+ const size$2 = function(options) {
1235
+ if (options === void 0) {
1236
+ options = {};
1237
+ }
1238
+ return {
1239
+ name: "size",
1240
+ options,
1241
+ async fn(state) {
1242
+ var _state$middlewareData, _state$middlewareData2;
1243
+ const {
1244
+ placement,
1245
+ rects,
1246
+ platform: platform2,
1247
+ elements
1248
+ } = state;
1249
+ const {
1250
+ apply = () => {
1251
+ },
1252
+ ...detectOverflowOptions
1253
+ } = evaluate(options, state);
1254
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1255
+ const side = getSide(placement);
1256
+ const alignment = getAlignment(placement);
1257
+ const isYAxis = getSideAxis(placement) === "y";
1258
+ const {
1259
+ width,
1260
+ height
1261
+ } = rects.floating;
1262
+ let heightSide;
1263
+ let widthSide;
1264
+ if (side === "top" || side === "bottom") {
1265
+ heightSide = side;
1266
+ widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right";
1267
+ } else {
1268
+ widthSide = side;
1269
+ heightSide = alignment === "end" ? "top" : "bottom";
1270
+ }
1271
+ const maximumClippingHeight = height - overflow.top - overflow.bottom;
1272
+ const maximumClippingWidth = width - overflow.left - overflow.right;
1273
+ const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight);
1274
+ const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth);
1275
+ const noShift = !state.middlewareData.shift;
1276
+ let availableHeight = overflowAvailableHeight;
1277
+ let availableWidth = overflowAvailableWidth;
1278
+ if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) {
1279
+ availableWidth = maximumClippingWidth;
1280
+ }
1281
+ if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) {
1282
+ availableHeight = maximumClippingHeight;
1283
+ }
1284
+ if (noShift && !alignment) {
1285
+ const xMin = max(overflow.left, 0);
1286
+ const xMax = max(overflow.right, 0);
1287
+ const yMin = max(overflow.top, 0);
1288
+ const yMax = max(overflow.bottom, 0);
1289
+ if (isYAxis) {
1290
+ availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1291
+ } else {
1292
+ availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1293
+ }
1294
+ }
1295
+ await apply({
1296
+ ...state,
1297
+ availableWidth,
1298
+ availableHeight
1299
+ });
1300
+ const nextDimensions = await platform2.getDimensions(elements.floating);
1301
+ if (width !== nextDimensions.width || height !== nextDimensions.height) {
1302
+ return {
1303
+ reset: {
1304
+ rects: true
1305
+ }
1306
+ };
1307
+ }
1308
+ return {};
1309
+ }
1310
+ };
1311
+ };
1312
+ function hasWindow() {
1313
+ return typeof window !== "undefined";
1314
+ }
1315
+ function getNodeName(node) {
1316
+ if (isNode(node)) {
1317
+ return (node.nodeName || "").toLowerCase();
1318
+ }
1319
+ return "#document";
1320
+ }
1321
+ function getWindow(node) {
1322
+ var _node$ownerDocument;
1323
+ return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1324
+ }
1325
+ function getDocumentElement(node) {
1326
+ var _ref;
1327
+ return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1328
+ }
1329
+ function isNode(value) {
1330
+ if (!hasWindow()) {
1331
+ return false;
1332
+ }
1333
+ return value instanceof Node || value instanceof getWindow(value).Node;
1334
+ }
1335
+ function isElement(value) {
1336
+ if (!hasWindow()) {
1337
+ return false;
1338
+ }
1339
+ return value instanceof Element || value instanceof getWindow(value).Element;
1340
+ }
1341
+ function isHTMLElement(value) {
1342
+ if (!hasWindow()) {
1343
+ return false;
1344
+ }
1345
+ return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1346
+ }
1347
+ function isShadowRoot(value) {
1348
+ if (!hasWindow() || typeof ShadowRoot === "undefined") {
1349
+ return false;
1350
+ }
1351
+ return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1352
+ }
1353
+ const invalidOverflowDisplayValues = /* @__PURE__ */ new Set(["inline", "contents"]);
1354
+ function isOverflowElement(element) {
1355
+ const {
1356
+ overflow,
1357
+ overflowX,
1358
+ overflowY,
1359
+ display
1360
+ } = getComputedStyle$1(element);
1361
+ return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !invalidOverflowDisplayValues.has(display);
1362
+ }
1363
+ const tableElements = /* @__PURE__ */ new Set(["table", "td", "th"]);
1364
+ function isTableElement(element) {
1365
+ return tableElements.has(getNodeName(element));
1366
+ }
1367
+ const topLayerSelectors = [":popover-open", ":modal"];
1368
+ function isTopLayer(element) {
1369
+ return topLayerSelectors.some((selector) => {
1370
+ try {
1371
+ return element.matches(selector);
1372
+ } catch (_e) {
1373
+ return false;
1374
+ }
1375
+ });
1376
+ }
1377
+ const transformProperties = ["transform", "translate", "scale", "rotate", "perspective"];
1378
+ const willChangeValues = ["transform", "translate", "scale", "rotate", "perspective", "filter"];
1379
+ const containValues = ["paint", "layout", "strict", "content"];
1380
+ function isContainingBlock(elementOrCss) {
1381
+ const webkit = isWebKit();
1382
+ const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
1383
+ return transformProperties.some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || willChangeValues.some((value) => (css.willChange || "").includes(value)) || containValues.some((value) => (css.contain || "").includes(value));
1384
+ }
1385
+ function getContainingBlock(element) {
1386
+ let currentNode = getParentNode(element);
1387
+ while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
1388
+ if (isContainingBlock(currentNode)) {
1389
+ return currentNode;
1390
+ } else if (isTopLayer(currentNode)) {
1391
+ return null;
1392
+ }
1393
+ currentNode = getParentNode(currentNode);
1394
+ }
1395
+ return null;
1396
+ }
1397
+ function isWebKit() {
1398
+ if (typeof CSS === "undefined" || !CSS.supports) return false;
1399
+ return CSS.supports("-webkit-backdrop-filter", "none");
1400
+ }
1401
+ const lastTraversableNodeNames = /* @__PURE__ */ new Set(["html", "body", "#document"]);
1402
+ function isLastTraversableNode(node) {
1403
+ return lastTraversableNodeNames.has(getNodeName(node));
1404
+ }
1405
+ function getComputedStyle$1(element) {
1406
+ return getWindow(element).getComputedStyle(element);
1407
+ }
1408
+ function getNodeScroll(element) {
1409
+ if (isElement(element)) {
1410
+ return {
1411
+ scrollLeft: element.scrollLeft,
1412
+ scrollTop: element.scrollTop
1413
+ };
1414
+ }
1415
+ return {
1416
+ scrollLeft: element.scrollX,
1417
+ scrollTop: element.scrollY
1418
+ };
1419
+ }
1420
+ function getParentNode(node) {
1421
+ if (getNodeName(node) === "html") {
1422
+ return node;
1423
+ }
1424
+ const result = (
1425
+ // Step into the shadow DOM of the parent of a slotted node.
1426
+ node.assignedSlot || // DOM Element detected.
1427
+ node.parentNode || // ShadowRoot detected.
1428
+ isShadowRoot(node) && node.host || // Fallback.
1429
+ getDocumentElement(node)
1430
+ );
1431
+ return isShadowRoot(result) ? result.host : result;
1432
+ }
1433
+ function getNearestOverflowAncestor(node) {
1434
+ const parentNode = getParentNode(node);
1435
+ if (isLastTraversableNode(parentNode)) {
1436
+ return node.ownerDocument ? node.ownerDocument.body : node.body;
1437
+ }
1438
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1439
+ return parentNode;
1440
+ }
1441
+ return getNearestOverflowAncestor(parentNode);
1442
+ }
1443
+ function getOverflowAncestors(node, list, traverseIframes) {
1444
+ var _node$ownerDocument2;
1445
+ if (list === void 0) {
1446
+ list = [];
1447
+ }
1448
+ if (traverseIframes === void 0) {
1449
+ traverseIframes = true;
1450
+ }
1451
+ const scrollableAncestor = getNearestOverflowAncestor(node);
1452
+ const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1453
+ const win = getWindow(scrollableAncestor);
1454
+ if (isBody) {
1455
+ const frameElement = getFrameElement(win);
1456
+ return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
1457
+ }
1458
+ return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
1459
+ }
1460
+ function getFrameElement(win) {
1461
+ return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
1462
+ }
1463
+ function getCssDimensions(element) {
1464
+ const css = getComputedStyle$1(element);
1465
+ let width = parseFloat(css.width) || 0;
1466
+ let height = parseFloat(css.height) || 0;
1467
+ const hasOffset = isHTMLElement(element);
1468
+ const offsetWidth = hasOffset ? element.offsetWidth : width;
1469
+ const offsetHeight = hasOffset ? element.offsetHeight : height;
1470
+ const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1471
+ if (shouldFallback) {
1472
+ width = offsetWidth;
1473
+ height = offsetHeight;
1474
+ }
1475
+ return {
1476
+ width,
1477
+ height,
1478
+ $: shouldFallback
1479
+ };
1480
+ }
1481
+ function unwrapElement(element) {
1482
+ return !isElement(element) ? element.contextElement : element;
1483
+ }
1484
+ function getScale(element) {
1485
+ const domElement = unwrapElement(element);
1486
+ if (!isHTMLElement(domElement)) {
1487
+ return createCoords(1);
1488
+ }
1489
+ const rect = domElement.getBoundingClientRect();
1490
+ const {
1491
+ width,
1492
+ height,
1493
+ $
1494
+ } = getCssDimensions(domElement);
1495
+ let x = ($ ? round(rect.width) : rect.width) / width;
1496
+ let y = ($ ? round(rect.height) : rect.height) / height;
1497
+ if (!x || !Number.isFinite(x)) {
1498
+ x = 1;
1499
+ }
1500
+ if (!y || !Number.isFinite(y)) {
1501
+ y = 1;
1502
+ }
1503
+ return {
1504
+ x,
1505
+ y
1506
+ };
1507
+ }
1508
+ const noOffsets = /* @__PURE__ */ createCoords(0);
1509
+ function getVisualOffsets(element) {
1510
+ const win = getWindow(element);
1511
+ if (!isWebKit() || !win.visualViewport) {
1512
+ return noOffsets;
1513
+ }
1514
+ return {
1515
+ x: win.visualViewport.offsetLeft,
1516
+ y: win.visualViewport.offsetTop
1517
+ };
1518
+ }
1519
+ function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1520
+ if (isFixed === void 0) {
1521
+ isFixed = false;
1522
+ }
1523
+ if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1524
+ return false;
1525
+ }
1526
+ return isFixed;
1527
+ }
1528
+ function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1529
+ if (includeScale === void 0) {
1530
+ includeScale = false;
1531
+ }
1532
+ if (isFixedStrategy === void 0) {
1533
+ isFixedStrategy = false;
1534
+ }
1535
+ const clientRect = element.getBoundingClientRect();
1536
+ const domElement = unwrapElement(element);
1537
+ let scale = createCoords(1);
1538
+ if (includeScale) {
1539
+ if (offsetParent) {
1540
+ if (isElement(offsetParent)) {
1541
+ scale = getScale(offsetParent);
1542
+ }
1543
+ } else {
1544
+ scale = getScale(element);
1545
+ }
1546
+ }
1547
+ const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
1548
+ let x = (clientRect.left + visualOffsets.x) / scale.x;
1549
+ let y = (clientRect.top + visualOffsets.y) / scale.y;
1550
+ let width = clientRect.width / scale.x;
1551
+ let height = clientRect.height / scale.y;
1552
+ if (domElement) {
1553
+ const win = getWindow(domElement);
1554
+ const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
1555
+ let currentWin = win;
1556
+ let currentIFrame = getFrameElement(currentWin);
1557
+ while (currentIFrame && offsetParent && offsetWin !== currentWin) {
1558
+ const iframeScale = getScale(currentIFrame);
1559
+ const iframeRect = currentIFrame.getBoundingClientRect();
1560
+ const css = getComputedStyle$1(currentIFrame);
1561
+ const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
1562
+ const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
1563
+ x *= iframeScale.x;
1564
+ y *= iframeScale.y;
1565
+ width *= iframeScale.x;
1566
+ height *= iframeScale.y;
1567
+ x += left;
1568
+ y += top;
1569
+ currentWin = getWindow(currentIFrame);
1570
+ currentIFrame = getFrameElement(currentWin);
1571
+ }
1572
+ }
1573
+ return rectToClientRect({
1574
+ width,
1575
+ height,
1576
+ x,
1577
+ y
1578
+ });
1579
+ }
1580
+ function getWindowScrollBarX(element, rect) {
1581
+ const leftScroll = getNodeScroll(element).scrollLeft;
1582
+ if (!rect) {
1583
+ return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
1584
+ }
1585
+ return rect.left + leftScroll;
1586
+ }
1587
+ function getHTMLOffset(documentElement, scroll) {
1588
+ const htmlRect = documentElement.getBoundingClientRect();
1589
+ const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
1590
+ const y = htmlRect.top + scroll.scrollTop;
1591
+ return {
1592
+ x,
1593
+ y
1594
+ };
1595
+ }
1596
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
1597
+ let {
1598
+ elements,
1599
+ rect,
1600
+ offsetParent,
1601
+ strategy
1602
+ } = _ref;
1603
+ const isFixed = strategy === "fixed";
1604
+ const documentElement = getDocumentElement(offsetParent);
1605
+ const topLayer = elements ? isTopLayer(elements.floating) : false;
1606
+ if (offsetParent === documentElement || topLayer && isFixed) {
1607
+ return rect;
1608
+ }
1609
+ let scroll = {
1610
+ scrollLeft: 0,
1611
+ scrollTop: 0
1612
+ };
1613
+ let scale = createCoords(1);
1614
+ const offsets = createCoords(0);
1615
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1616
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1617
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1618
+ scroll = getNodeScroll(offsetParent);
1619
+ }
1620
+ if (isHTMLElement(offsetParent)) {
1621
+ const offsetRect = getBoundingClientRect(offsetParent);
1622
+ scale = getScale(offsetParent);
1623
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1624
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1625
+ }
1626
+ }
1627
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1628
+ return {
1629
+ width: rect.width * scale.x,
1630
+ height: rect.height * scale.y,
1631
+ x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
1632
+ y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
1633
+ };
1634
+ }
1635
+ function getClientRects(element) {
1636
+ return Array.from(element.getClientRects());
1637
+ }
1638
+ function getDocumentRect(element) {
1639
+ const html = getDocumentElement(element);
1640
+ const scroll = getNodeScroll(element);
1641
+ const body = element.ownerDocument.body;
1642
+ const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
1643
+ const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
1644
+ let x = -scroll.scrollLeft + getWindowScrollBarX(element);
1645
+ const y = -scroll.scrollTop;
1646
+ if (getComputedStyle$1(body).direction === "rtl") {
1647
+ x += max(html.clientWidth, body.clientWidth) - width;
1648
+ }
1649
+ return {
1650
+ width,
1651
+ height,
1652
+ x,
1653
+ y
1654
+ };
1655
+ }
1656
+ const SCROLLBAR_MAX = 25;
1657
+ function getViewportRect(element, strategy) {
1658
+ const win = getWindow(element);
1659
+ const html = getDocumentElement(element);
1660
+ const visualViewport = win.visualViewport;
1661
+ let width = html.clientWidth;
1662
+ let height = html.clientHeight;
1663
+ let x = 0;
1664
+ let y = 0;
1665
+ if (visualViewport) {
1666
+ width = visualViewport.width;
1667
+ height = visualViewport.height;
1668
+ const visualViewportBased = isWebKit();
1669
+ if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
1670
+ x = visualViewport.offsetLeft;
1671
+ y = visualViewport.offsetTop;
1672
+ }
1673
+ }
1674
+ const windowScrollbarX = getWindowScrollBarX(html);
1675
+ if (windowScrollbarX <= 0) {
1676
+ const doc = html.ownerDocument;
1677
+ const body = doc.body;
1678
+ const bodyStyles = getComputedStyle(body);
1679
+ const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
1680
+ const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
1681
+ if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
1682
+ width -= clippingStableScrollbarWidth;
1683
+ }
1684
+ } else if (windowScrollbarX <= SCROLLBAR_MAX) {
1685
+ width += windowScrollbarX;
1686
+ }
1687
+ return {
1688
+ width,
1689
+ height,
1690
+ x,
1691
+ y
1692
+ };
1693
+ }
1694
+ const absoluteOrFixed = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1695
+ function getInnerBoundingClientRect(element, strategy) {
1696
+ const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
1697
+ const top = clientRect.top + element.clientTop;
1698
+ const left = clientRect.left + element.clientLeft;
1699
+ const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
1700
+ const width = element.clientWidth * scale.x;
1701
+ const height = element.clientHeight * scale.y;
1702
+ const x = left * scale.x;
1703
+ const y = top * scale.y;
1704
+ return {
1705
+ width,
1706
+ height,
1707
+ x,
1708
+ y
1709
+ };
1710
+ }
1711
+ function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
1712
+ let rect;
1713
+ if (clippingAncestor === "viewport") {
1714
+ rect = getViewportRect(element, strategy);
1715
+ } else if (clippingAncestor === "document") {
1716
+ rect = getDocumentRect(getDocumentElement(element));
1717
+ } else if (isElement(clippingAncestor)) {
1718
+ rect = getInnerBoundingClientRect(clippingAncestor, strategy);
1719
+ } else {
1720
+ const visualOffsets = getVisualOffsets(element);
1721
+ rect = {
1722
+ x: clippingAncestor.x - visualOffsets.x,
1723
+ y: clippingAncestor.y - visualOffsets.y,
1724
+ width: clippingAncestor.width,
1725
+ height: clippingAncestor.height
1726
+ };
1727
+ }
1728
+ return rectToClientRect(rect);
1729
+ }
1730
+ function hasFixedPositionAncestor(element, stopNode) {
1731
+ const parentNode = getParentNode(element);
1732
+ if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
1733
+ return false;
1734
+ }
1735
+ return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
1736
+ }
1737
+ function getClippingElementAncestors(element, cache) {
1738
+ const cachedResult = cache.get(element);
1739
+ if (cachedResult) {
1740
+ return cachedResult;
1741
+ }
1742
+ let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
1743
+ let currentContainingBlockComputedStyle = null;
1744
+ const elementIsFixed = getComputedStyle$1(element).position === "fixed";
1745
+ let currentNode = elementIsFixed ? getParentNode(element) : element;
1746
+ while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
1747
+ const computedStyle = getComputedStyle$1(currentNode);
1748
+ const currentNodeIsContaining = isContainingBlock(currentNode);
1749
+ if (!currentNodeIsContaining && computedStyle.position === "fixed") {
1750
+ currentContainingBlockComputedStyle = null;
1751
+ }
1752
+ const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
1753
+ if (shouldDropCurrentNode) {
1754
+ result = result.filter((ancestor) => ancestor !== currentNode);
1755
+ } else {
1756
+ currentContainingBlockComputedStyle = computedStyle;
1757
+ }
1758
+ currentNode = getParentNode(currentNode);
1759
+ }
1760
+ cache.set(element, result);
1761
+ return result;
1762
+ }
1763
+ function getClippingRect(_ref) {
1764
+ let {
1765
+ element,
1766
+ boundary,
1767
+ rootBoundary,
1768
+ strategy
1769
+ } = _ref;
1770
+ const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
1771
+ const clippingAncestors = [...elementClippingAncestors, rootBoundary];
1772
+ const firstClippingAncestor = clippingAncestors[0];
1773
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
1774
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
1775
+ accRect.top = max(rect.top, accRect.top);
1776
+ accRect.right = min(rect.right, accRect.right);
1777
+ accRect.bottom = min(rect.bottom, accRect.bottom);
1778
+ accRect.left = max(rect.left, accRect.left);
1779
+ return accRect;
1780
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
1781
+ return {
1782
+ width: clippingRect.right - clippingRect.left,
1783
+ height: clippingRect.bottom - clippingRect.top,
1784
+ x: clippingRect.left,
1785
+ y: clippingRect.top
1786
+ };
1787
+ }
1788
+ function getDimensions(element) {
1789
+ const {
1790
+ width,
1791
+ height
1792
+ } = getCssDimensions(element);
1793
+ return {
1794
+ width,
1795
+ height
1796
+ };
1797
+ }
1798
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
1799
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
1800
+ const documentElement = getDocumentElement(offsetParent);
1801
+ const isFixed = strategy === "fixed";
1802
+ const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
1803
+ let scroll = {
1804
+ scrollLeft: 0,
1805
+ scrollTop: 0
1806
+ };
1807
+ const offsets = createCoords(0);
1808
+ function setLeftRTLScrollbarOffset() {
1809
+ offsets.x = getWindowScrollBarX(documentElement);
1810
+ }
1811
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
1812
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
1813
+ scroll = getNodeScroll(offsetParent);
1814
+ }
1815
+ if (isOffsetParentAnElement) {
1816
+ const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
1817
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
1818
+ offsets.y = offsetRect.y + offsetParent.clientTop;
1819
+ } else if (documentElement) {
1820
+ setLeftRTLScrollbarOffset();
1821
+ }
1822
+ }
1823
+ if (isFixed && !isOffsetParentAnElement && documentElement) {
1824
+ setLeftRTLScrollbarOffset();
1825
+ }
1826
+ const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
1827
+ const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
1828
+ const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
1829
+ return {
1830
+ x,
1831
+ y,
1832
+ width: rect.width,
1833
+ height: rect.height
1834
+ };
1835
+ }
1836
+ function isStaticPositioned(element) {
1837
+ return getComputedStyle$1(element).position === "static";
1838
+ }
1839
+ function getTrueOffsetParent(element, polyfill) {
1840
+ if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") {
1841
+ return null;
1842
+ }
1843
+ if (polyfill) {
1844
+ return polyfill(element);
1845
+ }
1846
+ let rawOffsetParent = element.offsetParent;
1847
+ if (getDocumentElement(element) === rawOffsetParent) {
1848
+ rawOffsetParent = rawOffsetParent.ownerDocument.body;
1849
+ }
1850
+ return rawOffsetParent;
1851
+ }
1852
+ function getOffsetParent(element, polyfill) {
1853
+ const win = getWindow(element);
1854
+ if (isTopLayer(element)) {
1855
+ return win;
1856
+ }
1857
+ if (!isHTMLElement(element)) {
1858
+ let svgOffsetParent = getParentNode(element);
1859
+ while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
1860
+ if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
1861
+ return svgOffsetParent;
1862
+ }
1863
+ svgOffsetParent = getParentNode(svgOffsetParent);
1864
+ }
1865
+ return win;
1866
+ }
1867
+ let offsetParent = getTrueOffsetParent(element, polyfill);
1868
+ while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
1869
+ offsetParent = getTrueOffsetParent(offsetParent, polyfill);
1870
+ }
1871
+ if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
1872
+ return win;
1873
+ }
1874
+ return offsetParent || getContainingBlock(element) || win;
1875
+ }
1876
+ const getElementRects = async function(data) {
1877
+ const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
1878
+ const getDimensionsFn = this.getDimensions;
1879
+ const floatingDimensions = await getDimensionsFn(data.floating);
1880
+ return {
1881
+ reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
1882
+ floating: {
1883
+ x: 0,
1884
+ y: 0,
1885
+ width: floatingDimensions.width,
1886
+ height: floatingDimensions.height
1887
+ }
1888
+ };
1889
+ };
1890
+ function isRTL(element) {
1891
+ return getComputedStyle$1(element).direction === "rtl";
1892
+ }
1893
+ const platform = {
1894
+ convertOffsetParentRelativeRectToViewportRelativeRect,
1895
+ getDocumentElement,
1896
+ getClippingRect,
1897
+ getOffsetParent,
1898
+ getElementRects,
1899
+ getClientRects,
1900
+ getDimensions,
1901
+ getScale,
1902
+ isElement,
1903
+ isRTL
1904
+ };
1905
+ function rectsAreEqual(a, b) {
1906
+ return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
1907
+ }
1908
+ function observeMove(element, onMove) {
1909
+ let io = null;
1910
+ let timeoutId;
1911
+ const root = getDocumentElement(element);
1912
+ function cleanup() {
1913
+ var _io;
1914
+ clearTimeout(timeoutId);
1915
+ (_io = io) == null || _io.disconnect();
1916
+ io = null;
1917
+ }
1918
+ function refresh(skip, threshold) {
1919
+ if (skip === void 0) {
1920
+ skip = false;
1921
+ }
1922
+ if (threshold === void 0) {
1923
+ threshold = 1;
1924
+ }
1925
+ cleanup();
1926
+ const elementRectForRootMargin = element.getBoundingClientRect();
1927
+ const {
1928
+ left,
1929
+ top,
1930
+ width,
1931
+ height
1932
+ } = elementRectForRootMargin;
1933
+ if (!skip) {
1934
+ onMove();
1935
+ }
1936
+ if (!width || !height) {
1937
+ return;
1938
+ }
1939
+ const insetTop = floor(top);
1940
+ const insetRight = floor(root.clientWidth - (left + width));
1941
+ const insetBottom = floor(root.clientHeight - (top + height));
1942
+ const insetLeft = floor(left);
1943
+ const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
1944
+ const options = {
1945
+ rootMargin,
1946
+ threshold: max(0, min(1, threshold)) || 1
1947
+ };
1948
+ let isFirstUpdate = true;
1949
+ function handleObserve(entries) {
1950
+ const ratio = entries[0].intersectionRatio;
1951
+ if (ratio !== threshold) {
1952
+ if (!isFirstUpdate) {
1953
+ return refresh();
1954
+ }
1955
+ if (!ratio) {
1956
+ timeoutId = setTimeout(() => {
1957
+ refresh(false, 1e-7);
1958
+ }, 1e3);
1959
+ } else {
1960
+ refresh(false, ratio);
1961
+ }
1962
+ }
1963
+ if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
1964
+ refresh();
1965
+ }
1966
+ isFirstUpdate = false;
1967
+ }
1968
+ try {
1969
+ io = new IntersectionObserver(handleObserve, {
1970
+ ...options,
1971
+ // Handle <iframe>s
1972
+ root: root.ownerDocument
1973
+ });
1974
+ } catch (_e) {
1975
+ io = new IntersectionObserver(handleObserve, options);
1976
+ }
1977
+ io.observe(element);
1978
+ }
1979
+ refresh(true);
1980
+ return cleanup;
1981
+ }
1982
+ function autoUpdate(reference, floating, update, options) {
1983
+ if (options === void 0) {
1984
+ options = {};
1985
+ }
1986
+ const {
1987
+ ancestorScroll = true,
1988
+ ancestorResize = true,
1989
+ elementResize = typeof ResizeObserver === "function",
1990
+ layoutShift = typeof IntersectionObserver === "function",
1991
+ animationFrame = false
1992
+ } = options;
1993
+ const referenceEl = unwrapElement(reference);
1994
+ const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
1995
+ ancestors.forEach((ancestor) => {
1996
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
1997
+ passive: true
1998
+ });
1999
+ ancestorResize && ancestor.addEventListener("resize", update);
2000
+ });
2001
+ const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2002
+ let reobserveFrame = -1;
2003
+ let resizeObserver = null;
2004
+ if (elementResize) {
2005
+ resizeObserver = new ResizeObserver((_ref) => {
2006
+ let [firstEntry] = _ref;
2007
+ if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2008
+ resizeObserver.unobserve(floating);
2009
+ cancelAnimationFrame(reobserveFrame);
2010
+ reobserveFrame = requestAnimationFrame(() => {
2011
+ var _resizeObserver;
2012
+ (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
2013
+ });
2014
+ }
2015
+ update();
2016
+ });
2017
+ if (referenceEl && !animationFrame) {
2018
+ resizeObserver.observe(referenceEl);
2019
+ }
2020
+ resizeObserver.observe(floating);
2021
+ }
2022
+ let frameId;
2023
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2024
+ if (animationFrame) {
2025
+ frameLoop();
2026
+ }
2027
+ function frameLoop() {
2028
+ const nextRefRect = getBoundingClientRect(reference);
2029
+ if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
2030
+ update();
2031
+ }
2032
+ prevRefRect = nextRefRect;
2033
+ frameId = requestAnimationFrame(frameLoop);
2034
+ }
2035
+ update();
2036
+ return () => {
2037
+ var _resizeObserver2;
2038
+ ancestors.forEach((ancestor) => {
2039
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
2040
+ ancestorResize && ancestor.removeEventListener("resize", update);
2041
+ });
2042
+ cleanupIo == null || cleanupIo();
2043
+ (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
2044
+ resizeObserver = null;
2045
+ if (animationFrame) {
2046
+ cancelAnimationFrame(frameId);
2047
+ }
2048
+ };
2049
+ }
2050
+ const offset$1 = offset$2;
2051
+ const shift$1 = shift$2;
2052
+ const flip$1 = flip$2;
2053
+ const size$1 = size$2;
2054
+ const hide$1 = hide$2;
2055
+ const arrow$2 = arrow$3;
2056
+ const limitShift$1 = limitShift$2;
2057
+ const computePosition = (reference, floating, options) => {
2058
+ const cache = /* @__PURE__ */ new Map();
2059
+ const mergedOptions = {
2060
+ platform,
2061
+ ...options
2062
+ };
2063
+ const platformWithCache = {
2064
+ ...mergedOptions.platform,
2065
+ _c: cache
2066
+ };
2067
+ return computePosition$1(reference, floating, {
2068
+ ...mergedOptions,
2069
+ platform: platformWithCache
2070
+ });
2071
+ };
2072
+ var index = typeof document !== "undefined" ? useLayoutEffect : useEffect;
2073
+ function deepEqual(a, b) {
2074
+ if (a === b) {
2075
+ return true;
2076
+ }
2077
+ if (typeof a !== typeof b) {
2078
+ return false;
2079
+ }
2080
+ if (typeof a === "function" && a.toString() === b.toString()) {
2081
+ return true;
2082
+ }
2083
+ let length;
2084
+ let i;
2085
+ let keys;
2086
+ if (a && b && typeof a === "object") {
2087
+ if (Array.isArray(a)) {
2088
+ length = a.length;
2089
+ if (length !== b.length) return false;
2090
+ for (i = length; i-- !== 0; ) {
2091
+ if (!deepEqual(a[i], b[i])) {
2092
+ return false;
2093
+ }
2094
+ }
2095
+ return true;
2096
+ }
2097
+ keys = Object.keys(a);
2098
+ length = keys.length;
2099
+ if (length !== Object.keys(b).length) {
2100
+ return false;
2101
+ }
2102
+ for (i = length; i-- !== 0; ) {
2103
+ if (!{}.hasOwnProperty.call(b, keys[i])) {
2104
+ return false;
2105
+ }
2106
+ }
2107
+ for (i = length; i-- !== 0; ) {
2108
+ const key = keys[i];
2109
+ if (key === "_owner" && a.$$typeof) {
2110
+ continue;
2111
+ }
2112
+ if (!deepEqual(a[key], b[key])) {
2113
+ return false;
2114
+ }
2115
+ }
2116
+ return true;
2117
+ }
2118
+ return a !== a && b !== b;
2119
+ }
2120
+ function getDPR(element) {
2121
+ if (typeof window === "undefined") {
2122
+ return 1;
2123
+ }
2124
+ const win = element.ownerDocument.defaultView || window;
2125
+ return win.devicePixelRatio || 1;
2126
+ }
2127
+ function roundByDPR(element, value) {
2128
+ const dpr = getDPR(element);
2129
+ return Math.round(value * dpr) / dpr;
2130
+ }
2131
+ function useLatestRef(value) {
2132
+ const ref = React.useRef(value);
2133
+ index(() => {
2134
+ ref.current = value;
2135
+ });
2136
+ return ref;
2137
+ }
2138
+ function useFloating(options) {
2139
+ if (options === void 0) {
2140
+ options = {};
2141
+ }
2142
+ const {
2143
+ placement = "bottom",
2144
+ strategy = "absolute",
2145
+ middleware = [],
2146
+ platform: platform2,
2147
+ elements: {
2148
+ reference: externalReference,
2149
+ floating: externalFloating
2150
+ } = {},
2151
+ transform = true,
2152
+ whileElementsMounted,
2153
+ open
2154
+ } = options;
2155
+ const [data, setData] = React.useState({
2156
+ x: 0,
2157
+ y: 0,
2158
+ strategy,
2159
+ placement,
2160
+ middlewareData: {},
2161
+ isPositioned: false
2162
+ });
2163
+ const [latestMiddleware, setLatestMiddleware] = React.useState(middleware);
2164
+ if (!deepEqual(latestMiddleware, middleware)) {
2165
+ setLatestMiddleware(middleware);
2166
+ }
2167
+ const [_reference, _setReference] = React.useState(null);
2168
+ const [_floating, _setFloating] = React.useState(null);
2169
+ const setReference = React.useCallback((node) => {
2170
+ if (node !== referenceRef.current) {
2171
+ referenceRef.current = node;
2172
+ _setReference(node);
2173
+ }
2174
+ }, []);
2175
+ const setFloating = React.useCallback((node) => {
2176
+ if (node !== floatingRef.current) {
2177
+ floatingRef.current = node;
2178
+ _setFloating(node);
2179
+ }
2180
+ }, []);
2181
+ const referenceEl = externalReference || _reference;
2182
+ const floatingEl = externalFloating || _floating;
2183
+ const referenceRef = React.useRef(null);
2184
+ const floatingRef = React.useRef(null);
2185
+ const dataRef = React.useRef(data);
2186
+ const hasWhileElementsMounted = whileElementsMounted != null;
2187
+ const whileElementsMountedRef = useLatestRef(whileElementsMounted);
2188
+ const platformRef = useLatestRef(platform2);
2189
+ const update = React.useCallback(() => {
2190
+ if (!referenceRef.current || !floatingRef.current) {
2191
+ return;
2192
+ }
2193
+ const config = {
2194
+ placement,
2195
+ strategy,
2196
+ middleware: latestMiddleware
2197
+ };
2198
+ if (platformRef.current) {
2199
+ config.platform = platformRef.current;
2200
+ }
2201
+ computePosition(referenceRef.current, floatingRef.current, config).then((data2) => {
2202
+ const fullData = {
2203
+ ...data2,
2204
+ isPositioned: true
2205
+ };
2206
+ if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) {
2207
+ dataRef.current = fullData;
2208
+ ReactDOM.flushSync(() => {
2209
+ setData(fullData);
2210
+ });
2211
+ }
2212
+ });
2213
+ }, [latestMiddleware, placement, strategy, platformRef]);
2214
+ index(() => {
2215
+ if (open === false && dataRef.current.isPositioned) {
2216
+ dataRef.current.isPositioned = false;
2217
+ setData((data2) => ({
2218
+ ...data2,
2219
+ isPositioned: false
2220
+ }));
2221
+ }
2222
+ }, [open]);
2223
+ const isMountedRef = React.useRef(false);
2224
+ index(() => {
2225
+ isMountedRef.current = true;
2226
+ return () => {
2227
+ isMountedRef.current = false;
2228
+ };
2229
+ }, []);
2230
+ index(() => {
2231
+ if (referenceEl) referenceRef.current = referenceEl;
2232
+ if (floatingEl) floatingRef.current = floatingEl;
2233
+ if (referenceEl && floatingEl) {
2234
+ if (whileElementsMountedRef.current) {
2235
+ return whileElementsMountedRef.current(referenceEl, floatingEl, update);
2236
+ }
2237
+ update();
2238
+ }
2239
+ }, [referenceEl, floatingEl, update, whileElementsMountedRef, hasWhileElementsMounted]);
2240
+ const refs = React.useMemo(() => ({
2241
+ reference: referenceRef,
2242
+ floating: floatingRef,
2243
+ setReference,
2244
+ setFloating
2245
+ }), [setReference, setFloating]);
2246
+ const elements = React.useMemo(() => ({
2247
+ reference: referenceEl,
2248
+ floating: floatingEl
2249
+ }), [referenceEl, floatingEl]);
2250
+ const floatingStyles = React.useMemo(() => {
2251
+ const initialStyles = {
2252
+ position: strategy,
2253
+ left: 0,
2254
+ top: 0
2255
+ };
2256
+ if (!elements.floating) {
2257
+ return initialStyles;
2258
+ }
2259
+ const x = roundByDPR(elements.floating, data.x);
2260
+ const y = roundByDPR(elements.floating, data.y);
2261
+ if (transform) {
2262
+ return {
2263
+ ...initialStyles,
2264
+ transform: "translate(" + x + "px, " + y + "px)",
2265
+ ...getDPR(elements.floating) >= 1.5 && {
2266
+ willChange: "transform"
2267
+ }
2268
+ };
2269
+ }
2270
+ return {
2271
+ position: strategy,
2272
+ left: x,
2273
+ top: y
2274
+ };
2275
+ }, [strategy, transform, elements.floating, data.x, data.y]);
2276
+ return React.useMemo(() => ({
2277
+ ...data,
2278
+ update,
2279
+ refs,
2280
+ elements,
2281
+ floatingStyles
2282
+ }), [data, update, refs, elements, floatingStyles]);
2283
+ }
2284
+ const arrow$1 = (options) => {
2285
+ function isRef(value) {
2286
+ return {}.hasOwnProperty.call(value, "current");
2287
+ }
2288
+ return {
2289
+ name: "arrow",
2290
+ options,
2291
+ fn(state) {
2292
+ const {
2293
+ element,
2294
+ padding
2295
+ } = typeof options === "function" ? options(state) : options;
2296
+ if (element && isRef(element)) {
2297
+ if (element.current != null) {
2298
+ return arrow$2({
2299
+ element: element.current,
2300
+ padding
2301
+ }).fn(state);
2302
+ }
2303
+ return {};
2304
+ }
2305
+ if (element) {
2306
+ return arrow$2({
2307
+ element,
2308
+ padding
2309
+ }).fn(state);
2310
+ }
2311
+ return {};
2312
+ }
2313
+ };
2314
+ };
2315
+ const offset = (options, deps) => ({
2316
+ ...offset$1(options),
2317
+ options: [options, deps]
2318
+ });
2319
+ const shift = (options, deps) => ({
2320
+ ...shift$1(options),
2321
+ options: [options, deps]
2322
+ });
2323
+ const limitShift = (options, deps) => ({
2324
+ ...limitShift$1(options),
2325
+ options: [options, deps]
2326
+ });
2327
+ const flip = (options, deps) => ({
2328
+ ...flip$1(options),
2329
+ options: [options, deps]
2330
+ });
2331
+ const size = (options, deps) => ({
2332
+ ...size$1(options),
2333
+ options: [options, deps]
2334
+ });
2335
+ const hide = (options, deps) => ({
2336
+ ...hide$1(options),
2337
+ options: [options, deps]
2338
+ });
2339
+ const arrow = (options, deps) => ({
2340
+ ...arrow$1(options),
2341
+ options: [options, deps]
2342
+ });
2343
+ const $7e8f5cd07187803e$export$21b07c8f274aebd5 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2344
+ const { children, width = 10, height = 5, ...arrowProps } = props;
2345
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.svg, _extends({}, arrowProps, {
2346
+ ref: forwardedRef,
2347
+ width,
2348
+ height,
2349
+ viewBox: "0 0 30 10",
2350
+ preserveAspectRatio: "none"
2351
+ }), props.asChild ? children : /* @__PURE__ */ createElement("polygon", {
2352
+ points: "0,0 30,0 15,10"
2353
+ }));
2354
+ });
2355
+ const $7e8f5cd07187803e$export$be92b6f5f03c0fe9 = $7e8f5cd07187803e$export$21b07c8f274aebd5;
2356
+ function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
2357
+ const [size2, setSize] = useState(void 0);
2358
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2359
+ if (element) {
2360
+ setSize({
2361
+ width: element.offsetWidth,
2362
+ height: element.offsetHeight
2363
+ });
2364
+ const resizeObserver = new ResizeObserver((entries) => {
2365
+ if (!Array.isArray(entries)) return;
2366
+ if (!entries.length) return;
2367
+ const entry = entries[0];
2368
+ let width;
2369
+ let height;
2370
+ if ("borderBoxSize" in entry) {
2371
+ const borderSizeEntry = entry["borderBoxSize"];
2372
+ const borderSize = Array.isArray(borderSizeEntry) ? borderSizeEntry[0] : borderSizeEntry;
2373
+ width = borderSize["inlineSize"];
2374
+ height = borderSize["blockSize"];
2375
+ } else {
2376
+ width = element.offsetWidth;
2377
+ height = element.offsetHeight;
2378
+ }
2379
+ setSize({
2380
+ width,
2381
+ height
2382
+ });
2383
+ });
2384
+ resizeObserver.observe(element, {
2385
+ box: "border-box"
2386
+ });
2387
+ return () => resizeObserver.unobserve(element);
2388
+ } else
2389
+ setSize(void 0);
2390
+ }, [
2391
+ element
2392
+ ]);
2393
+ return size2;
2394
+ }
2395
+ const $cf1ac5d9fe0e8206$var$POPPER_NAME = "Popper";
2396
+ const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aac194ae923] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($cf1ac5d9fe0e8206$var$POPPER_NAME);
2397
+ const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
2398
+ const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props) => {
2399
+ const { __scopePopper, children } = props;
2400
+ const [anchor, setAnchor] = useState(null);
2401
+ return /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
2402
+ scope: __scopePopper,
2403
+ anchor,
2404
+ onAnchorChange: setAnchor
2405
+ }, children);
2406
+ };
2407
+ const $cf1ac5d9fe0e8206$var$ANCHOR_NAME = "PopperAnchor";
2408
+ const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2409
+ const { __scopePopper, virtualRef, ...anchorProps } = props;
2410
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
2411
+ const ref = useRef(null);
2412
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
2413
+ useEffect(() => {
2414
+ context.onAnchorChange((virtualRef === null || virtualRef === void 0 ? void 0 : virtualRef.current) || ref.current);
2415
+ });
2416
+ return virtualRef ? null : /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, anchorProps, {
2417
+ ref: composedRefs
2418
+ }));
2419
+ });
2420
+ const $cf1ac5d9fe0e8206$var$CONTENT_NAME = "PopperContent";
2421
+ const [$cf1ac5d9fe0e8206$var$PopperContentProvider, $cf1ac5d9fe0e8206$var$useContentContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME);
2422
+ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2423
+ var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
2424
+ const { __scopePopper, side = "bottom", sideOffset = 0, align = "center", alignOffset = 0, arrowPadding = 0, avoidCollisions = true, collisionBoundary = [], collisionPadding: collisionPaddingProp = 0, sticky = "partial", hideWhenDetached = false, updatePositionStrategy = "optimized", onPlaced, ...contentProps } = props;
2425
+ const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
2426
+ const [content, setContent] = useState(null);
2427
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(
2428
+ forwardedRef,
2429
+ (node) => setContent(node)
2430
+ );
2431
+ const [arrow$12, setArrow] = useState(null);
2432
+ const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$12);
2433
+ const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
2434
+ const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
2435
+ const desiredPlacement = side + (align !== "center" ? "-" + align : "");
2436
+ const collisionPadding = typeof collisionPaddingProp === "number" ? collisionPaddingProp : {
2437
+ top: 0,
2438
+ right: 0,
2439
+ bottom: 0,
2440
+ left: 0,
2441
+ ...collisionPaddingProp
2442
+ };
2443
+ const boundary = Array.isArray(collisionBoundary) ? collisionBoundary : [
2444
+ collisionBoundary
2445
+ ];
2446
+ const hasExplicitBoundaries = boundary.length > 0;
2447
+ const detectOverflowOptions = {
2448
+ padding: collisionPadding,
2449
+ boundary: boundary.filter($cf1ac5d9fe0e8206$var$isNotNull),
2450
+ // with `strategy: 'fixed'`, this is the only way to get it to respect boundaries
2451
+ altBoundary: hasExplicitBoundaries
2452
+ };
2453
+ const { refs, floatingStyles, placement, isPositioned, middlewareData } = useFloating({
2454
+ // default to `fixed` strategy so users don't have to pick and we also avoid focus scroll issues
2455
+ strategy: "fixed",
2456
+ placement: desiredPlacement,
2457
+ whileElementsMounted: (...args) => {
2458
+ const cleanup = autoUpdate(...args, {
2459
+ animationFrame: updatePositionStrategy === "always"
2460
+ });
2461
+ return cleanup;
2462
+ },
2463
+ elements: {
2464
+ reference: context.anchor
2465
+ },
2466
+ middleware: [
2467
+ offset({
2468
+ mainAxis: sideOffset + arrowHeight,
2469
+ alignmentAxis: alignOffset
2470
+ }),
2471
+ avoidCollisions && shift({
2472
+ mainAxis: true,
2473
+ crossAxis: false,
2474
+ limiter: sticky === "partial" ? limitShift() : void 0,
2475
+ ...detectOverflowOptions
2476
+ }),
2477
+ avoidCollisions && flip({
2478
+ ...detectOverflowOptions
2479
+ }),
2480
+ size({
2481
+ ...detectOverflowOptions,
2482
+ apply: ({ elements, rects, availableWidth, availableHeight }) => {
2483
+ const { width: anchorWidth, height: anchorHeight } = rects.reference;
2484
+ const contentStyle = elements.floating.style;
2485
+ contentStyle.setProperty("--radix-popper-available-width", `${availableWidth}px`);
2486
+ contentStyle.setProperty("--radix-popper-available-height", `${availableHeight}px`);
2487
+ contentStyle.setProperty("--radix-popper-anchor-width", `${anchorWidth}px`);
2488
+ contentStyle.setProperty("--radix-popper-anchor-height", `${anchorHeight}px`);
2489
+ }
2490
+ }),
2491
+ arrow$12 && arrow({
2492
+ element: arrow$12,
2493
+ padding: arrowPadding
2494
+ }),
2495
+ $cf1ac5d9fe0e8206$var$transformOrigin({
2496
+ arrowWidth,
2497
+ arrowHeight
2498
+ }),
2499
+ hideWhenDetached && hide({
2500
+ strategy: "referenceHidden",
2501
+ ...detectOverflowOptions
2502
+ })
2503
+ ]
2504
+ });
2505
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2506
+ const handlePlaced = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPlaced);
2507
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2508
+ if (isPositioned) handlePlaced === null || handlePlaced === void 0 || handlePlaced();
2509
+ }, [
2510
+ isPositioned,
2511
+ handlePlaced
2512
+ ]);
2513
+ const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
2514
+ const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
2515
+ const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
2516
+ const [contentZIndex, setContentZIndex] = useState();
2517
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2518
+ if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
2519
+ }, [
2520
+ content
2521
+ ]);
2522
+ return /* @__PURE__ */ createElement("div", {
2523
+ ref: refs.setFloating,
2524
+ "data-radix-popper-content-wrapper": "",
2525
+ style: {
2526
+ ...floatingStyles,
2527
+ transform: isPositioned ? floatingStyles.transform : "translate(0, -200%)",
2528
+ // keep off the page when measuring
2529
+ minWidth: "max-content",
2530
+ zIndex: contentZIndex,
2531
+ ["--radix-popper-transform-origin"]: [
2532
+ (_middlewareData$trans = middlewareData.transformOrigin) === null || _middlewareData$trans === void 0 ? void 0 : _middlewareData$trans.x,
2533
+ (_middlewareData$trans2 = middlewareData.transformOrigin) === null || _middlewareData$trans2 === void 0 ? void 0 : _middlewareData$trans2.y
2534
+ ].join(" ")
2535
+ },
2536
+ dir: props.dir
2537
+ }, /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$var$PopperContentProvider, {
2538
+ scope: __scopePopper,
2539
+ placedSide,
2540
+ onArrowChange: setArrow,
2541
+ arrowX,
2542
+ arrowY,
2543
+ shouldHideArrow: cannotCenterArrow
2544
+ }, /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({
2545
+ "data-side": placedSide,
2546
+ "data-align": placedAlign
2547
+ }, contentProps, {
2548
+ ref: composedRefs,
2549
+ style: {
2550
+ ...contentProps.style,
2551
+ // if the PopperContent hasn't been placed yet (not all measurements done)
2552
+ // we prevent animations so that users's animation don't kick in too early referring wrong sides
2553
+ animation: !isPositioned ? "none" : void 0,
2554
+ // hide the content if using the hide middleware and should be hidden
2555
+ opacity: (_middlewareData$hide = middlewareData.hide) !== null && _middlewareData$hide !== void 0 && _middlewareData$hide.referenceHidden ? 0 : void 0
2556
+ }
2557
+ }))));
2558
+ });
2559
+ const $cf1ac5d9fe0e8206$var$ARROW_NAME = "PopperArrow";
2560
+ const $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE = {
2561
+ top: "bottom",
2562
+ right: "left",
2563
+ bottom: "top",
2564
+ left: "right"
2565
+ };
2566
+ const $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0 = /* @__PURE__ */ forwardRef(function $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd02(props, forwardedRef) {
2567
+ const { __scopePopper, ...arrowProps } = props;
2568
+ const contentContext = $cf1ac5d9fe0e8206$var$useContentContext($cf1ac5d9fe0e8206$var$ARROW_NAME, __scopePopper);
2569
+ const baseSide = $cf1ac5d9fe0e8206$var$OPPOSITE_SIDE[contentContext.placedSide];
2570
+ return (
2571
+ // we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
2572
+ // doesn't report size as we'd expect on SVG elements.
2573
+ // it reports their bounding box which is effectively the largest path inside the SVG.
2574
+ /* @__PURE__ */ createElement("span", {
2575
+ ref: contentContext.onArrowChange,
2576
+ style: {
2577
+ position: "absolute",
2578
+ left: contentContext.arrowX,
2579
+ top: contentContext.arrowY,
2580
+ [baseSide]: 0,
2581
+ transformOrigin: {
2582
+ top: "",
2583
+ right: "0 0",
2584
+ bottom: "center 0",
2585
+ left: "100% 0"
2586
+ }[contentContext.placedSide],
2587
+ transform: {
2588
+ top: "translateY(100%)",
2589
+ right: "translateY(50%) rotate(90deg) translateX(-50%)",
2590
+ bottom: `rotate(180deg)`,
2591
+ left: "translateY(50%) rotate(-90deg) translateX(50%)"
2592
+ }[contentContext.placedSide],
2593
+ visibility: contentContext.shouldHideArrow ? "hidden" : void 0
2594
+ }
2595
+ }, /* @__PURE__ */ createElement($7e8f5cd07187803e$export$be92b6f5f03c0fe9, _extends({}, arrowProps, {
2596
+ ref: forwardedRef,
2597
+ style: {
2598
+ ...arrowProps.style,
2599
+ // ensures the element can be measured correctly (mostly for if SVG)
2600
+ display: "block"
2601
+ }
2602
+ })))
2603
+ );
2604
+ });
2605
+ /* @__PURE__ */ Object.assign($cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0, {
2606
+ displayName: $cf1ac5d9fe0e8206$var$ARROW_NAME
2607
+ });
2608
+ function $cf1ac5d9fe0e8206$var$isNotNull(value) {
2609
+ return value !== null;
2610
+ }
2611
+ const $cf1ac5d9fe0e8206$var$transformOrigin = (options) => ({
2612
+ name: "transformOrigin",
2613
+ options,
2614
+ fn(data) {
2615
+ var _middlewareData$arrow4, _middlewareData$arrow5, _middlewareData$arrow6, _middlewareData$arrow7, _middlewareData$arrow8;
2616
+ const { placement, rects, middlewareData } = data;
2617
+ const cannotCenterArrow = ((_middlewareData$arrow4 = middlewareData.arrow) === null || _middlewareData$arrow4 === void 0 ? void 0 : _middlewareData$arrow4.centerOffset) !== 0;
2618
+ const isArrowHidden = cannotCenterArrow;
2619
+ const arrowWidth = isArrowHidden ? 0 : options.arrowWidth;
2620
+ const arrowHeight = isArrowHidden ? 0 : options.arrowHeight;
2621
+ const [placedSide, placedAlign] = $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement);
2622
+ const noArrowAlign = {
2623
+ start: "0%",
2624
+ center: "50%",
2625
+ end: "100%"
2626
+ }[placedAlign];
2627
+ const arrowXCenter = ((_middlewareData$arrow5 = (_middlewareData$arrow6 = middlewareData.arrow) === null || _middlewareData$arrow6 === void 0 ? void 0 : _middlewareData$arrow6.x) !== null && _middlewareData$arrow5 !== void 0 ? _middlewareData$arrow5 : 0) + arrowWidth / 2;
2628
+ const arrowYCenter = ((_middlewareData$arrow7 = (_middlewareData$arrow8 = middlewareData.arrow) === null || _middlewareData$arrow8 === void 0 ? void 0 : _middlewareData$arrow8.y) !== null && _middlewareData$arrow7 !== void 0 ? _middlewareData$arrow7 : 0) + arrowHeight / 2;
2629
+ let x = "";
2630
+ let y = "";
2631
+ if (placedSide === "bottom") {
2632
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2633
+ y = `${-arrowHeight}px`;
2634
+ } else if (placedSide === "top") {
2635
+ x = isArrowHidden ? noArrowAlign : `${arrowXCenter}px`;
2636
+ y = `${rects.floating.height + arrowHeight}px`;
2637
+ } else if (placedSide === "right") {
2638
+ x = `${-arrowHeight}px`;
2639
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2640
+ } else if (placedSide === "left") {
2641
+ x = `${rects.floating.width + arrowHeight}px`;
2642
+ y = isArrowHidden ? noArrowAlign : `${arrowYCenter}px`;
2643
+ }
2644
+ return {
2645
+ data: {
2646
+ x,
2647
+ y
2648
+ }
2649
+ };
2650
+ }
2651
+ });
2652
+ function $cf1ac5d9fe0e8206$var$getSideAndAlignFromPlacement(placement) {
2653
+ const [side, align = "center"] = placement.split("-");
2654
+ return [
2655
+ side,
2656
+ align
2657
+ ];
2658
+ }
2659
+ const $cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9 = $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9;
2660
+ const $cf1ac5d9fe0e8206$export$b688253958b8dfe7 = $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d;
2661
+ const $cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2 = $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc;
2662
+ const $cf1ac5d9fe0e8206$export$21b07c8f274aebd5 = $cf1ac5d9fe0e8206$export$79d62cd4e10a3fd0;
2663
+ const $f1701beae083dbae$export$602eac185826482c = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2664
+ var _globalThis$document;
2665
+ const { container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body, ...portalProps } = props;
2666
+ return container ? /* @__PURE__ */ ReactDOM__default.createPortal(/* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends({}, portalProps, {
2667
+ ref: forwardedRef
2668
+ })), container) : null;
2669
+ });
2670
+ function $fe963b355347cc68$export$3e6543de14f8614f(initialState, machine) {
2671
+ return useReducer((state, event) => {
2672
+ const nextState = machine[state][event];
2673
+ return nextState !== null && nextState !== void 0 ? nextState : state;
2674
+ }, initialState);
2675
+ }
2676
+ const $921a889cee6df7e8$export$99c2b779aa4e8b8b = (props) => {
2677
+ const { present, children } = props;
2678
+ const presence = $921a889cee6df7e8$var$usePresence(present);
2679
+ const child = typeof children === "function" ? children({
2680
+ present: presence.isPresent
2681
+ }) : Children.only(children);
2682
+ const ref = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(presence.ref, child.ref);
2683
+ const forceMount = typeof children === "function";
2684
+ return forceMount || presence.isPresent ? /* @__PURE__ */ cloneElement(child, {
2685
+ ref
2686
+ }) : null;
2687
+ };
2688
+ $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = "Presence";
2689
+ function $921a889cee6df7e8$var$usePresence(present) {
2690
+ const [node1, setNode] = useState();
2691
+ const stylesRef = useRef({});
2692
+ const prevPresentRef = useRef(present);
2693
+ const prevAnimationNameRef = useRef("none");
2694
+ const initialState = present ? "mounted" : "unmounted";
2695
+ const [state, send] = $fe963b355347cc68$export$3e6543de14f8614f(initialState, {
2696
+ mounted: {
2697
+ UNMOUNT: "unmounted",
2698
+ ANIMATION_OUT: "unmountSuspended"
2699
+ },
2700
+ unmountSuspended: {
2701
+ MOUNT: "mounted",
2702
+ ANIMATION_END: "unmounted"
2703
+ },
2704
+ unmounted: {
2705
+ MOUNT: "mounted"
2706
+ }
2707
+ });
2708
+ useEffect(() => {
2709
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
2710
+ prevAnimationNameRef.current = state === "mounted" ? currentAnimationName : "none";
2711
+ }, [
2712
+ state
2713
+ ]);
2714
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2715
+ const styles = stylesRef.current;
2716
+ const wasPresent = prevPresentRef.current;
2717
+ const hasPresentChanged = wasPresent !== present;
2718
+ if (hasPresentChanged) {
2719
+ const prevAnimationName = prevAnimationNameRef.current;
2720
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(styles);
2721
+ if (present) send("MOUNT");
2722
+ else if (currentAnimationName === "none" || (styles === null || styles === void 0 ? void 0 : styles.display) === "none")
2723
+ send("UNMOUNT");
2724
+ else {
2725
+ const isAnimating = prevAnimationName !== currentAnimationName;
2726
+ if (wasPresent && isAnimating) send("ANIMATION_OUT");
2727
+ else send("UNMOUNT");
2728
+ }
2729
+ prevPresentRef.current = present;
2730
+ }
2731
+ }, [
2732
+ present,
2733
+ send
2734
+ ]);
2735
+ $9f79659886946c16$export$e5c5a5f917a5871c(() => {
2736
+ if (node1) {
2737
+ const handleAnimationEnd = (event) => {
2738
+ const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
2739
+ const isCurrentAnimation = currentAnimationName.includes(event.animationName);
2740
+ if (event.target === node1 && isCurrentAnimation)
2741
+ flushSync(
2742
+ () => send("ANIMATION_END")
2743
+ );
2744
+ };
2745
+ const handleAnimationStart = (event) => {
2746
+ if (event.target === node1)
2747
+ prevAnimationNameRef.current = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
2748
+ };
2749
+ node1.addEventListener("animationstart", handleAnimationStart);
2750
+ node1.addEventListener("animationcancel", handleAnimationEnd);
2751
+ node1.addEventListener("animationend", handleAnimationEnd);
2752
+ return () => {
2753
+ node1.removeEventListener("animationstart", handleAnimationStart);
2754
+ node1.removeEventListener("animationcancel", handleAnimationEnd);
2755
+ node1.removeEventListener("animationend", handleAnimationEnd);
2756
+ };
2757
+ } else
2758
+ send("ANIMATION_END");
2759
+ }, [
2760
+ node1,
2761
+ send
2762
+ ]);
2763
+ return {
2764
+ isPresent: [
2765
+ "mounted",
2766
+ "unmountSuspended"
2767
+ ].includes(state),
2768
+ ref: useCallback((node) => {
2769
+ if (node) stylesRef.current = getComputedStyle(node);
2770
+ setNode(node);
2771
+ }, [])
2772
+ };
2773
+ }
2774
+ function $921a889cee6df7e8$var$getAnimationName(styles) {
2775
+ return (styles === null || styles === void 0 ? void 0 : styles.animationName) || "none";
2776
+ }
2777
+ function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop, defaultProp, onChange = () => {
2778
+ } }) {
2779
+ const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
2780
+ defaultProp,
2781
+ onChange
2782
+ });
2783
+ const isControlled = prop !== void 0;
2784
+ const value1 = isControlled ? prop : uncontrolledProp;
2785
+ const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
2786
+ const setValue = useCallback((nextValue) => {
2787
+ if (isControlled) {
2788
+ const setter = nextValue;
2789
+ const value = typeof nextValue === "function" ? setter(prop) : nextValue;
2790
+ if (value !== prop) handleChange(value);
2791
+ } else setUncontrolledProp(nextValue);
2792
+ }, [
2793
+ isControlled,
2794
+ prop,
2795
+ setUncontrolledProp,
2796
+ handleChange
2797
+ ]);
2798
+ return [
2799
+ value1,
2800
+ setValue
2801
+ ];
2802
+ }
2803
+ function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp, onChange }) {
2804
+ const uncontrolledState = useState(defaultProp);
2805
+ const [value] = uncontrolledState;
2806
+ const prevValueRef = useRef(value);
2807
+ const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
2808
+ useEffect(() => {
2809
+ if (prevValueRef.current !== value) {
2810
+ handleChange(value);
2811
+ prevValueRef.current = value;
2812
+ }
2813
+ }, [
2814
+ value,
2815
+ prevValueRef,
2816
+ handleChange
2817
+ ]);
2818
+ return uncontrolledState;
2819
+ }
2820
+ const $ea1ef594cf570d83$export$439d29a4e110a164 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2821
+ return /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, props, {
2822
+ ref: forwardedRef,
2823
+ style: {
2824
+ // See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
2825
+ position: "absolute",
2826
+ border: 0,
2827
+ width: 1,
2828
+ height: 1,
2829
+ padding: 0,
2830
+ margin: -1,
2831
+ overflow: "hidden",
2832
+ clip: "rect(0, 0, 0, 0)",
2833
+ whiteSpace: "nowrap",
2834
+ wordWrap: "normal",
2835
+ ...props.style
2836
+ }
2837
+ }));
2838
+ });
2839
+ const $ea1ef594cf570d83$export$be92b6f5f03c0fe9 = $ea1ef594cf570d83$export$439d29a4e110a164;
2840
+ const [$a093c7e1ec25a057$var$createTooltipContext] = $c512c27ab02ef895$export$50c7b4e9d9f19c1("Tooltip", [
2841
+ $cf1ac5d9fe0e8206$export$722aac194ae923
2842
+ ]);
2843
+ const $a093c7e1ec25a057$var$usePopperScope = $cf1ac5d9fe0e8206$export$722aac194ae923();
2844
+ const $a093c7e1ec25a057$var$PROVIDER_NAME = "TooltipProvider";
2845
+ const $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION = 700;
2846
+ const $a093c7e1ec25a057$var$TOOLTIP_OPEN = "tooltip.open";
2847
+ const [$a093c7e1ec25a057$var$TooltipProviderContextProvider, $a093c7e1ec25a057$var$useTooltipProviderContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PROVIDER_NAME);
2848
+ const $a093c7e1ec25a057$export$f78649fb9ca566b8 = (props) => {
2849
+ const { __scopeTooltip, delayDuration = $a093c7e1ec25a057$var$DEFAULT_DELAY_DURATION, skipDelayDuration = 300, disableHoverableContent = false, children } = props;
2850
+ const [isOpenDelayed, setIsOpenDelayed] = useState(true);
2851
+ const isPointerInTransitRef = useRef(false);
2852
+ const skipDelayTimerRef = useRef(0);
2853
+ useEffect(() => {
2854
+ const skipDelayTimer = skipDelayTimerRef.current;
2855
+ return () => window.clearTimeout(skipDelayTimer);
2856
+ }, []);
2857
+ return /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipProviderContextProvider, {
2858
+ scope: __scopeTooltip,
2859
+ isOpenDelayed,
2860
+ delayDuration,
2861
+ onOpen: useCallback(() => {
2862
+ window.clearTimeout(skipDelayTimerRef.current);
2863
+ setIsOpenDelayed(false);
2864
+ }, []),
2865
+ onClose: useCallback(() => {
2866
+ window.clearTimeout(skipDelayTimerRef.current);
2867
+ skipDelayTimerRef.current = window.setTimeout(
2868
+ () => setIsOpenDelayed(true),
2869
+ skipDelayDuration
2870
+ );
2871
+ }, [
2872
+ skipDelayDuration
2873
+ ]),
2874
+ isPointerInTransitRef,
2875
+ onPointerInTransitChange: useCallback((inTransit) => {
2876
+ isPointerInTransitRef.current = inTransit;
2877
+ }, []),
2878
+ disableHoverableContent
2879
+ }, children);
2880
+ };
2881
+ const $a093c7e1ec25a057$var$TOOLTIP_NAME = "Tooltip";
2882
+ const [$a093c7e1ec25a057$var$TooltipContextProvider, $a093c7e1ec25a057$var$useTooltipContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$TOOLTIP_NAME);
2883
+ const $a093c7e1ec25a057$export$28c660c63b792dea = (props) => {
2884
+ const { __scopeTooltip, children, open: openProp, defaultOpen = false, onOpenChange, disableHoverableContent: disableHoverableContentProp, delayDuration: delayDurationProp } = props;
2885
+ const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TOOLTIP_NAME, props.__scopeTooltip);
2886
+ const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
2887
+ const [trigger, setTrigger] = useState(null);
2888
+ const contentId = $1746a345f3d73bb7$export$f680877a34711e37();
2889
+ const openTimerRef = useRef(0);
2890
+ const disableHoverableContent = disableHoverableContentProp !== null && disableHoverableContentProp !== void 0 ? disableHoverableContentProp : providerContext.disableHoverableContent;
2891
+ const delayDuration = delayDurationProp !== null && delayDurationProp !== void 0 ? delayDurationProp : providerContext.delayDuration;
2892
+ const wasOpenDelayedRef = useRef(false);
2893
+ const [open1 = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
2894
+ prop: openProp,
2895
+ defaultProp: defaultOpen,
2896
+ onChange: (open) => {
2897
+ if (open) {
2898
+ providerContext.onOpen();
2899
+ document.dispatchEvent(new CustomEvent($a093c7e1ec25a057$var$TOOLTIP_OPEN));
2900
+ } else providerContext.onClose();
2901
+ onOpenChange === null || onOpenChange === void 0 || onOpenChange(open);
2902
+ }
2903
+ });
2904
+ const stateAttribute = useMemo(() => {
2905
+ return open1 ? wasOpenDelayedRef.current ? "delayed-open" : "instant-open" : "closed";
2906
+ }, [
2907
+ open1
2908
+ ]);
2909
+ const handleOpen = useCallback(() => {
2910
+ window.clearTimeout(openTimerRef.current);
2911
+ wasOpenDelayedRef.current = false;
2912
+ setOpen(true);
2913
+ }, [
2914
+ setOpen
2915
+ ]);
2916
+ const handleClose = useCallback(() => {
2917
+ window.clearTimeout(openTimerRef.current);
2918
+ setOpen(false);
2919
+ }, [
2920
+ setOpen
2921
+ ]);
2922
+ const handleDelayedOpen = useCallback(() => {
2923
+ window.clearTimeout(openTimerRef.current);
2924
+ openTimerRef.current = window.setTimeout(() => {
2925
+ wasOpenDelayedRef.current = true;
2926
+ setOpen(true);
2927
+ }, delayDuration);
2928
+ }, [
2929
+ delayDuration,
2930
+ setOpen
2931
+ ]);
2932
+ useEffect(() => {
2933
+ return () => window.clearTimeout(openTimerRef.current);
2934
+ }, []);
2935
+ return /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$export$be92b6f5f03c0fe9, popperScope, /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContextProvider, {
2936
+ scope: __scopeTooltip,
2937
+ contentId,
2938
+ open: open1,
2939
+ stateAttribute,
2940
+ trigger,
2941
+ onTriggerChange: setTrigger,
2942
+ onTriggerEnter: useCallback(() => {
2943
+ if (providerContext.isOpenDelayed) handleDelayedOpen();
2944
+ else handleOpen();
2945
+ }, [
2946
+ providerContext.isOpenDelayed,
2947
+ handleDelayedOpen,
2948
+ handleOpen
2949
+ ]),
2950
+ onTriggerLeave: useCallback(() => {
2951
+ if (disableHoverableContent) handleClose();
2952
+ else
2953
+ window.clearTimeout(openTimerRef.current);
2954
+ }, [
2955
+ handleClose,
2956
+ disableHoverableContent
2957
+ ]),
2958
+ onOpen: handleOpen,
2959
+ onClose: handleClose,
2960
+ disableHoverableContent
2961
+ }, children));
2962
+ };
2963
+ const $a093c7e1ec25a057$var$TRIGGER_NAME = "TooltipTrigger";
2964
+ const $a093c7e1ec25a057$export$8c610744efcf8a1d = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
2965
+ const { __scopeTooltip, ...triggerProps } = props;
2966
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
2967
+ const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$TRIGGER_NAME, __scopeTooltip);
2968
+ const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
2969
+ const ref = useRef(null);
2970
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref, context.onTriggerChange);
2971
+ const isPointerDownRef = useRef(false);
2972
+ const hasPointerMoveOpenedRef = useRef(false);
2973
+ const handlePointerUp = useCallback(
2974
+ () => isPointerDownRef.current = false,
2975
+ []
2976
+ );
2977
+ useEffect(() => {
2978
+ return () => document.removeEventListener("pointerup", handlePointerUp);
2979
+ }, [
2980
+ handlePointerUp
2981
+ ]);
2982
+ return /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$export$b688253958b8dfe7, _extends({
2983
+ asChild: true
2984
+ }, popperScope), /* @__PURE__ */ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
2985
+ // We purposefully avoid adding `type=button` here because tooltip triggers are also
2986
+ // commonly anchors and the anchor `type` attribute signifies MIME type.
2987
+ "aria-describedby": context.open ? context.contentId : void 0,
2988
+ "data-state": context.stateAttribute
2989
+ }, triggerProps, {
2990
+ ref: composedRefs,
2991
+ onPointerMove: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerMove, (event) => {
2992
+ if (event.pointerType === "touch") return;
2993
+ if (!hasPointerMoveOpenedRef.current && !providerContext.isPointerInTransitRef.current) {
2994
+ context.onTriggerEnter();
2995
+ hasPointerMoveOpenedRef.current = true;
2996
+ }
2997
+ }),
2998
+ onPointerLeave: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerLeave, () => {
2999
+ context.onTriggerLeave();
3000
+ hasPointerMoveOpenedRef.current = false;
3001
+ }),
3002
+ onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDown, () => {
3003
+ isPointerDownRef.current = true;
3004
+ document.addEventListener("pointerup", handlePointerUp, {
3005
+ once: true
3006
+ });
3007
+ }),
3008
+ onFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocus, () => {
3009
+ if (!isPointerDownRef.current) context.onOpen();
3010
+ }),
3011
+ onBlur: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlur, context.onClose),
3012
+ onClick: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onClick, context.onClose)
3013
+ })));
3014
+ });
3015
+ const $a093c7e1ec25a057$var$PORTAL_NAME = "TooltipPortal";
3016
+ const [$a093c7e1ec25a057$var$PortalProvider, $a093c7e1ec25a057$var$usePortalContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, {
3017
+ forceMount: void 0
3018
+ });
3019
+ const $a093c7e1ec25a057$export$7b36b8f925ab7497 = (props) => {
3020
+ const { __scopeTooltip, forceMount, children, container } = props;
3021
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$PORTAL_NAME, __scopeTooltip);
3022
+ return /* @__PURE__ */ createElement($a093c7e1ec25a057$var$PortalProvider, {
3023
+ scope: __scopeTooltip,
3024
+ forceMount
3025
+ }, /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
3026
+ present: forceMount || context.open
3027
+ }, /* @__PURE__ */ createElement($f1701beae083dbae$export$602eac185826482c, {
3028
+ asChild: true,
3029
+ container
3030
+ }, children)));
3031
+ };
3032
+ const $a093c7e1ec25a057$var$CONTENT_NAME = "TooltipContent";
3033
+ const $a093c7e1ec25a057$export$e9003e2be37ec060 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3034
+ const portalContext = $a093c7e1ec25a057$var$usePortalContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3035
+ const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
3036
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3037
+ return /* @__PURE__ */ createElement($921a889cee6df7e8$export$99c2b779aa4e8b8b, {
3038
+ present: forceMount || context.open
3039
+ }, context.disableHoverableContent ? /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContentImpl, _extends({
3040
+ side
3041
+ }, contentProps, {
3042
+ ref: forwardedRef
3043
+ })) : /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContentHoverable, _extends({
3044
+ side
3045
+ }, contentProps, {
3046
+ ref: forwardedRef
3047
+ })));
3048
+ });
3049
+ const $a093c7e1ec25a057$var$TooltipContentHoverable = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3050
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3051
+ const providerContext = $a093c7e1ec25a057$var$useTooltipProviderContext($a093c7e1ec25a057$var$CONTENT_NAME, props.__scopeTooltip);
3052
+ const ref = useRef(null);
3053
+ const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
3054
+ const [pointerGraceArea, setPointerGraceArea] = useState(null);
3055
+ const { trigger, onClose } = context;
3056
+ const content = ref.current;
3057
+ const { onPointerInTransitChange } = providerContext;
3058
+ const handleRemoveGraceArea = useCallback(() => {
3059
+ setPointerGraceArea(null);
3060
+ onPointerInTransitChange(false);
3061
+ }, [
3062
+ onPointerInTransitChange
3063
+ ]);
3064
+ const handleCreateGraceArea = useCallback((event, hoverTarget) => {
3065
+ const currentTarget = event.currentTarget;
3066
+ const exitPoint = {
3067
+ x: event.clientX,
3068
+ y: event.clientY
3069
+ };
3070
+ const exitSide = $a093c7e1ec25a057$var$getExitSideFromRect(exitPoint, currentTarget.getBoundingClientRect());
3071
+ const paddedExitPoints = $a093c7e1ec25a057$var$getPaddedExitPoints(exitPoint, exitSide);
3072
+ const hoverTargetPoints = $a093c7e1ec25a057$var$getPointsFromRect(hoverTarget.getBoundingClientRect());
3073
+ const graceArea = $a093c7e1ec25a057$var$getHull([
3074
+ ...paddedExitPoints,
3075
+ ...hoverTargetPoints
3076
+ ]);
3077
+ setPointerGraceArea(graceArea);
3078
+ onPointerInTransitChange(true);
3079
+ }, [
3080
+ onPointerInTransitChange
3081
+ ]);
3082
+ useEffect(() => {
3083
+ return () => handleRemoveGraceArea();
3084
+ }, [
3085
+ handleRemoveGraceArea
3086
+ ]);
3087
+ useEffect(() => {
3088
+ if (trigger && content) {
3089
+ const handleTriggerLeave = (event) => handleCreateGraceArea(event, content);
3090
+ const handleContentLeave = (event) => handleCreateGraceArea(event, trigger);
3091
+ trigger.addEventListener("pointerleave", handleTriggerLeave);
3092
+ content.addEventListener("pointerleave", handleContentLeave);
3093
+ return () => {
3094
+ trigger.removeEventListener("pointerleave", handleTriggerLeave);
3095
+ content.removeEventListener("pointerleave", handleContentLeave);
3096
+ };
3097
+ }
3098
+ }, [
3099
+ trigger,
3100
+ content,
3101
+ handleCreateGraceArea,
3102
+ handleRemoveGraceArea
3103
+ ]);
3104
+ useEffect(() => {
3105
+ if (pointerGraceArea) {
3106
+ const handleTrackPointerGrace = (event) => {
3107
+ const target = event.target;
3108
+ const pointerPosition = {
3109
+ x: event.clientX,
3110
+ y: event.clientY
3111
+ };
3112
+ const hasEnteredTarget = (trigger === null || trigger === void 0 ? void 0 : trigger.contains(target)) || (content === null || content === void 0 ? void 0 : content.contains(target));
3113
+ const isPointerOutsideGraceArea = !$a093c7e1ec25a057$var$isPointInPolygon(pointerPosition, pointerGraceArea);
3114
+ if (hasEnteredTarget) handleRemoveGraceArea();
3115
+ else if (isPointerOutsideGraceArea) {
3116
+ handleRemoveGraceArea();
3117
+ onClose();
3118
+ }
3119
+ };
3120
+ document.addEventListener("pointermove", handleTrackPointerGrace);
3121
+ return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
3122
+ }
3123
+ }, [
3124
+ trigger,
3125
+ content,
3126
+ pointerGraceArea,
3127
+ onClose,
3128
+ handleRemoveGraceArea
3129
+ ]);
3130
+ return /* @__PURE__ */ createElement($a093c7e1ec25a057$var$TooltipContentImpl, _extends({}, props, {
3131
+ ref: composedRefs
3132
+ }));
3133
+ });
3134
+ const [$a093c7e1ec25a057$var$VisuallyHiddenContentContextProvider, $a093c7e1ec25a057$var$useVisuallyHiddenContentContext] = $a093c7e1ec25a057$var$createTooltipContext($a093c7e1ec25a057$var$TOOLTIP_NAME, {
3135
+ isInside: false
3136
+ });
3137
+ const $a093c7e1ec25a057$var$TooltipContentImpl = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3138
+ const { __scopeTooltip, children, "aria-label": ariaLabel, onEscapeKeyDown, onPointerDownOutside, ...contentProps } = props;
3139
+ const context = $a093c7e1ec25a057$var$useTooltipContext($a093c7e1ec25a057$var$CONTENT_NAME, __scopeTooltip);
3140
+ const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3141
+ const { onClose } = context;
3142
+ useEffect(() => {
3143
+ document.addEventListener($a093c7e1ec25a057$var$TOOLTIP_OPEN, onClose);
3144
+ return () => document.removeEventListener($a093c7e1ec25a057$var$TOOLTIP_OPEN, onClose);
3145
+ }, [
3146
+ onClose
3147
+ ]);
3148
+ useEffect(() => {
3149
+ if (context.trigger) {
3150
+ const handleScroll = (event) => {
3151
+ const target = event.target;
3152
+ if (target !== null && target !== void 0 && target.contains(context.trigger)) onClose();
3153
+ };
3154
+ window.addEventListener("scroll", handleScroll, {
3155
+ capture: true
3156
+ });
3157
+ return () => window.removeEventListener("scroll", handleScroll, {
3158
+ capture: true
3159
+ });
3160
+ }
3161
+ }, [
3162
+ context.trigger,
3163
+ onClose
3164
+ ]);
3165
+ return /* @__PURE__ */ createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, {
3166
+ asChild: true,
3167
+ disableOutsidePointerEvents: false,
3168
+ onEscapeKeyDown,
3169
+ onPointerDownOutside,
3170
+ onFocusOutside: (event) => event.preventDefault(),
3171
+ onDismiss: onClose
3172
+ }, /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$export$7c6e2c02157bb7d2, _extends({
3173
+ "data-state": context.stateAttribute
3174
+ }, popperScope, contentProps, {
3175
+ ref: forwardedRef,
3176
+ style: {
3177
+ ...contentProps.style,
3178
+ "--radix-tooltip-content-transform-origin": "var(--radix-popper-transform-origin)",
3179
+ "--radix-tooltip-content-available-width": "var(--radix-popper-available-width)",
3180
+ "--radix-tooltip-content-available-height": "var(--radix-popper-available-height)",
3181
+ "--radix-tooltip-trigger-width": "var(--radix-popper-anchor-width)",
3182
+ "--radix-tooltip-trigger-height": "var(--radix-popper-anchor-height)"
3183
+ }
3184
+ }), /* @__PURE__ */ createElement($5e63c961fc1ce211$export$d9f1ccf0bdb05d45, null, children), /* @__PURE__ */ createElement($a093c7e1ec25a057$var$VisuallyHiddenContentContextProvider, {
3185
+ scope: __scopeTooltip,
3186
+ isInside: true
3187
+ }, /* @__PURE__ */ createElement($ea1ef594cf570d83$export$be92b6f5f03c0fe9, {
3188
+ id: context.contentId,
3189
+ role: "tooltip"
3190
+ }, ariaLabel || children))));
3191
+ });
3192
+ const $a093c7e1ec25a057$var$ARROW_NAME = "TooltipArrow";
3193
+ const $a093c7e1ec25a057$export$c27ee0ad710f7559 = /* @__PURE__ */ forwardRef((props, forwardedRef) => {
3194
+ const { __scopeTooltip, ...arrowProps } = props;
3195
+ const popperScope = $a093c7e1ec25a057$var$usePopperScope(__scopeTooltip);
3196
+ const visuallyHiddenContentContext = $a093c7e1ec25a057$var$useVisuallyHiddenContentContext($a093c7e1ec25a057$var$ARROW_NAME, __scopeTooltip);
3197
+ return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ createElement($cf1ac5d9fe0e8206$export$21b07c8f274aebd5, _extends({}, popperScope, arrowProps, {
3198
+ ref: forwardedRef
3199
+ }));
3200
+ });
3201
+ function $a093c7e1ec25a057$var$getExitSideFromRect(point, rect) {
3202
+ const top = Math.abs(rect.top - point.y);
3203
+ const bottom = Math.abs(rect.bottom - point.y);
3204
+ const right = Math.abs(rect.right - point.x);
3205
+ const left = Math.abs(rect.left - point.x);
3206
+ switch (Math.min(top, bottom, right, left)) {
3207
+ case left:
3208
+ return "left";
3209
+ case right:
3210
+ return "right";
3211
+ case top:
3212
+ return "top";
3213
+ case bottom:
3214
+ return "bottom";
3215
+ default:
3216
+ throw new Error("unreachable");
3217
+ }
3218
+ }
3219
+ function $a093c7e1ec25a057$var$getPaddedExitPoints(exitPoint, exitSide, padding = 5) {
3220
+ const paddedExitPoints = [];
3221
+ switch (exitSide) {
3222
+ case "top":
3223
+ paddedExitPoints.push({
3224
+ x: exitPoint.x - padding,
3225
+ y: exitPoint.y + padding
3226
+ }, {
3227
+ x: exitPoint.x + padding,
3228
+ y: exitPoint.y + padding
3229
+ });
3230
+ break;
3231
+ case "bottom":
3232
+ paddedExitPoints.push({
3233
+ x: exitPoint.x - padding,
3234
+ y: exitPoint.y - padding
3235
+ }, {
3236
+ x: exitPoint.x + padding,
3237
+ y: exitPoint.y - padding
3238
+ });
3239
+ break;
3240
+ case "left":
3241
+ paddedExitPoints.push({
3242
+ x: exitPoint.x + padding,
3243
+ y: exitPoint.y - padding
3244
+ }, {
3245
+ x: exitPoint.x + padding,
3246
+ y: exitPoint.y + padding
3247
+ });
3248
+ break;
3249
+ case "right":
3250
+ paddedExitPoints.push({
3251
+ x: exitPoint.x - padding,
3252
+ y: exitPoint.y - padding
3253
+ }, {
3254
+ x: exitPoint.x - padding,
3255
+ y: exitPoint.y + padding
3256
+ });
3257
+ break;
3258
+ }
3259
+ return paddedExitPoints;
3260
+ }
3261
+ function $a093c7e1ec25a057$var$getPointsFromRect(rect) {
3262
+ const { top, right, bottom, left } = rect;
3263
+ return [
3264
+ {
3265
+ x: left,
3266
+ y: top
3267
+ },
3268
+ {
3269
+ x: right,
3270
+ y: top
3271
+ },
3272
+ {
3273
+ x: right,
3274
+ y: bottom
3275
+ },
3276
+ {
3277
+ x: left,
3278
+ y: bottom
3279
+ }
3280
+ ];
3281
+ }
3282
+ function $a093c7e1ec25a057$var$isPointInPolygon(point, polygon) {
3283
+ const { x, y } = point;
3284
+ let inside = false;
3285
+ for (let i = 0, j = polygon.length - 1; i < polygon.length; j = i++) {
3286
+ const xi = polygon[i].x;
3287
+ const yi = polygon[i].y;
3288
+ const xj = polygon[j].x;
3289
+ const yj = polygon[j].y;
3290
+ const intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
3291
+ if (intersect) inside = !inside;
3292
+ }
3293
+ return inside;
3294
+ }
3295
+ function $a093c7e1ec25a057$var$getHull(points) {
3296
+ const newPoints = points.slice();
3297
+ newPoints.sort((a, b) => {
3298
+ if (a.x < b.x) return -1;
3299
+ else if (a.x > b.x) return 1;
3300
+ else if (a.y < b.y) return -1;
3301
+ else if (a.y > b.y) return 1;
3302
+ else return 0;
3303
+ });
3304
+ return $a093c7e1ec25a057$var$getHullPresorted(newPoints);
3305
+ }
3306
+ function $a093c7e1ec25a057$var$getHullPresorted(points) {
3307
+ if (points.length <= 1) return points.slice();
3308
+ const upperHull = [];
3309
+ for (let i = 0; i < points.length; i++) {
3310
+ const p = points[i];
3311
+ while (upperHull.length >= 2) {
3312
+ const q = upperHull[upperHull.length - 1];
3313
+ const r = upperHull[upperHull.length - 2];
3314
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) upperHull.pop();
3315
+ else break;
3316
+ }
3317
+ upperHull.push(p);
3318
+ }
3319
+ upperHull.pop();
3320
+ const lowerHull = [];
3321
+ for (let i1 = points.length - 1; i1 >= 0; i1--) {
3322
+ const p = points[i1];
3323
+ while (lowerHull.length >= 2) {
3324
+ const q = lowerHull[lowerHull.length - 1];
3325
+ const r = lowerHull[lowerHull.length - 2];
3326
+ if ((q.x - r.x) * (p.y - r.y) >= (q.y - r.y) * (p.x - r.x)) lowerHull.pop();
3327
+ else break;
3328
+ }
3329
+ lowerHull.push(p);
3330
+ }
3331
+ lowerHull.pop();
3332
+ if (upperHull.length === 1 && lowerHull.length === 1 && upperHull[0].x === lowerHull[0].x && upperHull[0].y === lowerHull[0].y) return upperHull;
3333
+ else return upperHull.concat(lowerHull);
3334
+ }
3335
+ const $a093c7e1ec25a057$export$2881499e37b75b9a = $a093c7e1ec25a057$export$f78649fb9ca566b8;
3336
+ const $a093c7e1ec25a057$export$be92b6f5f03c0fe9 = $a093c7e1ec25a057$export$28c660c63b792dea;
3337
+ const $a093c7e1ec25a057$export$41fb9f06171c75f4 = $a093c7e1ec25a057$export$8c610744efcf8a1d;
3338
+ const $a093c7e1ec25a057$export$602eac185826482c = $a093c7e1ec25a057$export$7b36b8f925ab7497;
3339
+ const $a093c7e1ec25a057$export$7c6e2c02157bb7d2 = $a093c7e1ec25a057$export$e9003e2be37ec060;
3340
+ const $a093c7e1ec25a057$export$21b07c8f274aebd5 = $a093c7e1ec25a057$export$c27ee0ad710f7559;
3341
+ const TooltipIconButton = ({ children, label, variant, onClick, disabled, showBorder = false }) => {
3342
+ if (!label)
3343
+ return /* @__PURE__ */ jsx(IconButton, { variant, onClick, disabled, withTooltip: false, children });
3344
+ const tooltipContent = showBorder ? /* @__PURE__ */ jsxs(
3345
+ Box,
3346
+ {
3347
+ padding: 4,
3348
+ margin: 2,
3349
+ background: "neutral0",
3350
+ hasRadius: true,
3351
+ shadow: "filterShadow",
3352
+ children: [
3353
+ /* @__PURE__ */ jsx(Typography, { children: label }),
3354
+ /* @__PURE__ */ jsx($a093c7e1ec25a057$export$21b07c8f274aebd5, {})
3355
+ ]
3356
+ }
3357
+ ) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
3358
+ /* @__PURE__ */ jsx(Typography, { children: label }),
3359
+ /* @__PURE__ */ jsx($a093c7e1ec25a057$export$21b07c8f274aebd5, {})
3360
+ ] });
3361
+ return /* @__PURE__ */ jsx($a093c7e1ec25a057$export$2881499e37b75b9a, { children: /* @__PURE__ */ jsxs($a093c7e1ec25a057$export$be92b6f5f03c0fe9, { children: [
3362
+ /* @__PURE__ */ jsx($a093c7e1ec25a057$export$41fb9f06171c75f4, { asChild: true, children: /* @__PURE__ */ jsx(IconButton, { variant, onClick, disabled, withTooltip: false, children }) }),
3363
+ /* @__PURE__ */ jsx($a093c7e1ec25a057$export$602eac185826482c, { children: /* @__PURE__ */ jsx($a093c7e1ec25a057$export$7c6e2c02157bb7d2, { sideOffset: 5, children: tooltipContent }) })
3364
+ ] }) });
3365
+ };
3366
+ const SettingsTextField = (props) => {
3367
+ const {
3368
+ fieldName,
3369
+ displayName,
3370
+ required,
3371
+ value,
3372
+ updateItem,
3373
+ type,
3374
+ hasLabel = false,
3375
+ hasHint = false,
3376
+ hasTooltip = false,
3377
+ hasPlaceholder = false
3378
+ } = props;
3379
+ const { formatMessage } = useIntl();
3380
+ const [hasError, setHasError] = useState(false);
3381
+ const onItemChange = (newValue) => {
3382
+ setHasError(required && !newValue);
3383
+ updateItem(fieldName, newValue);
3384
+ };
3385
+ const label = hasLabel ? formatMessage({ id: getTranslation(`plugin.settings.${displayName}.label`) }) : "";
3386
+ const hint = hasHint ? formatMessage({ id: getTranslation(`plugin.settings.${displayName}.hint`) }) : "";
3387
+ const tooltip = hasTooltip ? formatMessage({ id: getTranslation(`plugin.settings.${displayName}.tooltip`) }) : "";
3388
+ const placeholder = hasPlaceholder ? formatMessage({ id: getTranslation(`plugin.settings.${displayName}.tooltip`) }) : "";
3389
+ return /* @__PURE__ */ jsxs(
3390
+ Field.Root,
3391
+ {
3392
+ name: `field_${displayName}`,
3393
+ required,
3394
+ error: hasError ? formatMessage({ id: getTranslation("plugin.settings.errors.required") }) : "",
3395
+ hint,
3396
+ children: [
3397
+ label && /* @__PURE__ */ jsx(Field.Label, { children: label }),
3398
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
3399
+ /* @__PURE__ */ jsx(Box, { style: { width: "100%" }, children: /* @__PURE__ */ jsx(
3400
+ TextInput,
3401
+ {
3402
+ name: displayName,
3403
+ placeholder,
3404
+ type,
3405
+ onChange: (e) => onItemChange(e.target.value),
3406
+ value
3407
+ }
3408
+ ) }),
3409
+ tooltip && /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(TooltipIconButton, { label: tooltip, showBorder: true, variant: "ghost", children: /* @__PURE__ */ jsx(Information, {}) }) })
3410
+ ] }),
3411
+ hint && /* @__PURE__ */ jsx(Field.Hint, {}),
3412
+ /* @__PURE__ */ jsx(Field.Error, {})
3413
+ ]
3414
+ }
3415
+ );
3416
+ };
3417
+ const SettingsToggleField = (props) => {
3418
+ const {
3419
+ fieldName,
3420
+ displayName,
3421
+ required,
3422
+ value,
3423
+ updateItem,
3424
+ type,
3425
+ hasLabel = false,
3426
+ hasHint = false,
3427
+ hasTooltip = false
3428
+ } = props;
3429
+ const { formatMessage } = useIntl();
3430
+ const [hasError, setHasError] = useState(false);
3431
+ const onItemChange = (newValue) => {
3432
+ setHasError(required && !newValue);
3433
+ updateItem(fieldName, newValue);
3434
+ };
3435
+ const label = hasLabel ? formatMessage({ id: getTranslation(`plugin.settings.${displayName}.label`) }) : "";
3436
+ const hint = hasHint ? formatMessage({ id: getTranslation(`plugin.settings.${displayName}.hint`) }) : "";
3437
+ const tooltip = hasTooltip ? formatMessage({ id: getTranslation(`plugin.settings.${displayName}.tooltip`) }) : "";
3438
+ return /* @__PURE__ */ jsxs(
3439
+ Field.Root,
3440
+ {
3441
+ name: `field_${displayName}`,
3442
+ required,
3443
+ error: hasError ? formatMessage({ id: getTranslation("plugin.settings.errors.required") }) : "",
3444
+ hint,
3445
+ children: [
3446
+ label && /* @__PURE__ */ jsx(Field.Label, { children: label }),
3447
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
3448
+ /* @__PURE__ */ jsx(Box, { style: { width: "100%" }, children: /* @__PURE__ */ jsx(
3449
+ Toggle,
3450
+ {
3451
+ checked: value,
3452
+ name: displayName,
3453
+ onLabel: formatMessage({ id: getTranslation("plugin.settings.buttons.on") }),
3454
+ offLabel: formatMessage({ id: getTranslation("plugin.settings.buttons.off") }),
3455
+ onChange: (e) => onItemChange(e.target.checked)
3456
+ }
3457
+ ) }),
3458
+ tooltip && /* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(TooltipIconButton, { label: tooltip, showBorder: true, variant: "ghost", children: /* @__PURE__ */ jsx(Information, {}) }) })
3459
+ ] }),
3460
+ hint && /* @__PURE__ */ jsx(Field.Hint, {}),
3461
+ /* @__PURE__ */ jsx(Field.Error, {})
3462
+ ]
3463
+ }
3464
+ );
3465
+ };
3466
+ const Settings = () => {
3467
+ const { formatMessage } = useIntl();
3468
+ const isMounted = useRef(true);
3469
+ const { get, post } = useFetchClient();
3470
+ useEffect(() => {
3471
+ const fetchData = async () => {
3472
+ const { data } = await get(`/drag-drop-content-types/settings`);
3473
+ setSettings(data.body);
3474
+ setIsLoading(false);
3475
+ };
3476
+ fetchData();
3477
+ return () => {
3478
+ isMounted.current = false;
3479
+ };
3480
+ }, []);
3481
+ const defaultSettingsBody = { title: "", subtitle: "", rank: "", triggerWebhooks: false };
3482
+ const [settings, setSettings] = useState(defaultSettingsBody);
3483
+ const [isSaving, setIsSaving] = useState(false);
3484
+ const [isLoading, setIsLoading] = useState(true);
3485
+ const { toggleNotification } = useNotification();
3486
+ const handleSubmit = async () => {
3487
+ if (!settings)
3488
+ return;
3489
+ setIsSaving(true);
3490
+ const res = await post(`/drag-drop-content-types/settings`, {
3491
+ method: "POST",
3492
+ body: settings
3493
+ });
3494
+ setSettings(res.data.body);
3495
+ setIsSaving(false);
3496
+ toggleNotification({
3497
+ type: "success",
3498
+ message: formatMessage({
3499
+ id: "plugin.settings.updated",
3500
+ defaultMessage: "Settings successfully updated"
3501
+ })
3502
+ });
3503
+ };
3504
+ const onUpdateSettings = (fieldName, value) => {
3505
+ if (!settings)
3506
+ return;
3507
+ try {
3508
+ const updatedSettings = { ...settings };
3509
+ updatedSettings[fieldName] = value;
3510
+ setSettings(updatedSettings);
3511
+ } catch (e) {
3512
+ console.log(e);
3513
+ }
3514
+ };
3515
+ const checkFormErrors = () => {
3516
+ return !settings.rank;
3517
+ };
3518
+ const hasFormError = checkFormErrors();
3519
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
3520
+ /* @__PURE__ */ jsx(
3521
+ Layouts.Header,
3522
+ {
3523
+ id: "title",
3524
+ title: formatMessage({ id: getTranslation("plugin.settings.title") }),
3525
+ subtitle: formatMessage({ id: getTranslation("plugin.settings.subtitle") }),
3526
+ primaryAction: isLoading ? /* @__PURE__ */ jsx(Fragment$1, {}) : /* @__PURE__ */ jsx(
3527
+ Button,
3528
+ {
3529
+ onClick: handleSubmit,
3530
+ startIcon: /* @__PURE__ */ jsx(Check, {}),
3531
+ size: "L",
3532
+ disabled: isSaving || hasFormError,
3533
+ loading: isSaving,
3534
+ children: formatMessage({ id: getTranslation("plugin.settings.buttons.save") })
3535
+ }
3536
+ )
3537
+ }
3538
+ ),
3539
+ isLoading ? /* @__PURE__ */ jsx(Page.Loading, {}) : /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsx(
3540
+ Box,
3541
+ {
3542
+ background: "neutral0",
3543
+ hasRadius: true,
3544
+ shadow: "filterShadow",
3545
+ paddingTop: 6,
3546
+ paddingBottom: 6,
3547
+ paddingLeft: 7,
3548
+ paddingRight: 7,
3549
+ children: /* @__PURE__ */ jsxs(Flex, { size: 3, direction: "column", children: [
3550
+ /* @__PURE__ */ jsx(Box, { paddingBottom: 6, children: /* @__PURE__ */ jsx(Typography, { variant: "beta", as: "h2", children: formatMessage({ id: getTranslation("plugin.settings.field-names") }) }) }),
3551
+ /* @__PURE__ */ jsxs(Grid.Root, { gap: 6, children: [
3552
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsx(Box, { padding: 0, style: { width: "100%" }, children: /* @__PURE__ */ jsx(
3553
+ SettingsTextField,
3554
+ {
3555
+ hasTooltip: true,
3556
+ hasHint: true,
3557
+ hasLabel: true,
3558
+ hasPlaceholder: true,
3559
+ fieldName: "rank",
3560
+ displayName: "rank",
3561
+ required: true,
3562
+ updateItem: onUpdateSettings,
3563
+ value: settings.rank
3564
+ }
3565
+ ) }) }),
3566
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsx(Box, { padding: 0, style: { width: "100%" }, children: /* @__PURE__ */ jsx(
3567
+ SettingsTextField,
3568
+ {
3569
+ hasTooltip: true,
3570
+ hasHint: true,
3571
+ hasLabel: true,
3572
+ hasPlaceholder: true,
3573
+ fieldName: "title",
3574
+ displayName: "title",
3575
+ required: false,
3576
+ updateItem: onUpdateSettings,
3577
+ value: settings.title
3578
+ }
3579
+ ) }) }),
3580
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsx(Box, { padding: 0, style: { width: "100%" }, children: /* @__PURE__ */ jsx(
3581
+ SettingsTextField,
3582
+ {
3583
+ hasTooltip: true,
3584
+ hasHint: true,
3585
+ hasLabel: true,
3586
+ hasPlaceholder: true,
3587
+ fieldName: "subtitle",
3588
+ displayName: "subtitle",
3589
+ required: false,
3590
+ updateItem: onUpdateSettings,
3591
+ value: settings.subtitle
3592
+ }
3593
+ ) }) }),
3594
+ /* @__PURE__ */ jsx(Grid.Item, { col: 6, s: 12, children: /* @__PURE__ */ jsx(Box, { padding: 0, style: { width: "100%" }, children: /* @__PURE__ */ jsx(
3595
+ SettingsToggleField,
3596
+ {
3597
+ hasTooltip: true,
3598
+ hasHint: true,
3599
+ hasLabel: true,
3600
+ fieldName: "triggerWebhooks",
3601
+ displayName: "triggerWebhooks",
3602
+ required: false,
3603
+ updateItem: onUpdateSettings,
3604
+ value: settings.triggerWebhooks
3605
+ }
3606
+ ) }) })
3607
+ ] })
3608
+ ] })
3609
+ }
3610
+ ) })
3611
+ ] });
3612
+ };
3613
+ export {
3614
+ Settings as default
3615
+ };