lizaui 9.0.13 → 9.0.15

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 (70) hide show
  1. package/dist/button/index.es.js +1 -1
  2. package/dist/calendar/index.es.js +1 -1
  3. package/dist/checkbox/index.es.js +1 -1
  4. package/dist/chunks/{button-CA3Y2GZ1.js → button-B0fpJrMg.js} +2 -2
  5. package/dist/chunks/{button-CA3Y2GZ1.js.map → button-B0fpJrMg.js.map} +1 -1
  6. package/dist/chunks/{checkbox-qzZKMLRN.js → checkbox-C1Sssumg.js} +2 -2
  7. package/dist/chunks/{checkbox-qzZKMLRN.js.map → checkbox-C1Sssumg.js.map} +1 -1
  8. package/dist/chunks/{floating-ui.dom-N5ROFCJy.js → floating-ui.dom-B9hvXzxg.js} +11 -1
  9. package/dist/chunks/{floating-ui.dom-N5ROFCJy.js.map → floating-ui.dom-B9hvXzxg.js.map} +1 -1
  10. package/dist/chunks/{floating-ui.dom-NqZWWqNg.js → floating-ui.dom-DRSBqyFN.js} +14 -4
  11. package/dist/chunks/{floating-ui.dom-NqZWWqNg.js.map → floating-ui.dom-DRSBqyFN.js.map} +1 -1
  12. package/dist/chunks/floating-ui.react-dom-BUZLdP4-.js +294 -0
  13. package/dist/chunks/floating-ui.react-dom-BUZLdP4-.js.map +1 -0
  14. package/dist/chunks/floating-ui.react-dom-CI1b2uK3.js +310 -0
  15. package/dist/chunks/floating-ui.react-dom-CI1b2uK3.js.map +1 -0
  16. package/dist/chunks/{index-DiC9dI6_.js → index-B4RTH1-D.js} +4 -4
  17. package/dist/chunks/{index-DiC9dI6_.js.map → index-B4RTH1-D.js.map} +1 -1
  18. package/dist/chunks/{scroll-area-CgJodNZ_.js → scroll-area-B-5YmafW.js} +27 -27
  19. package/dist/chunks/{scroll-area-CgJodNZ_.js.map → scroll-area-B-5YmafW.js.map} +1 -1
  20. package/dist/chunks/{scroll-area-BcM0NCEM.js → scroll-area-WNAy-5-i.js} +3 -3
  21. package/dist/chunks/{scroll-area-BcM0NCEM.js.map → scroll-area-WNAy-5-i.js.map} +1 -1
  22. package/dist/chunks/{select-DyihZY-4.js → select-C9BYUpJm.js} +439 -83
  23. package/dist/chunks/select-C9BYUpJm.js.map +1 -0
  24. package/dist/chunks/{select-DaKy-WhC.js → select-CLIZOVIj.js} +366 -10
  25. package/dist/chunks/select-CLIZOVIj.js.map +1 -0
  26. package/dist/chunks/{textarea-By2Vv44z.js → textarea-D2_KC-J4.js} +587 -36
  27. package/dist/chunks/textarea-D2_KC-J4.js.map +1 -0
  28. package/dist/chunks/{textarea-ClJsk9Gp.js → textarea-_HQpXiCX.js} +586 -35
  29. package/dist/chunks/textarea-_HQpXiCX.js.map +1 -0
  30. package/dist/chunks/tooltip-CjmRm1rv.js +1937 -0
  31. package/dist/chunks/tooltip-CjmRm1rv.js.map +1 -0
  32. package/dist/chunks/tooltip-o938-GAz.js +1921 -0
  33. package/dist/chunks/tooltip-o938-GAz.js.map +1 -0
  34. package/dist/components/tooltip/tooltip.d.ts +1 -1
  35. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  36. package/dist/divider/index.es.js +1 -1
  37. package/dist/modal/index.es.js +1 -1
  38. package/dist/pagination/index.cjs.js +2 -2
  39. package/dist/pagination/index.es.js +3 -3
  40. package/dist/phone-input/index.cjs.js +2 -2
  41. package/dist/phone-input/index.es.js +3 -3
  42. package/dist/select-input/index.cjs.js +1 -1
  43. package/dist/select-input/index.es.js +2 -2
  44. package/dist/table/index.cjs.js +1 -1
  45. package/dist/table/index.es.js +2 -2
  46. package/dist/time-input/index.cjs.js +1 -1
  47. package/dist/time-input/index.es.js +2 -2
  48. package/dist/tooltip/index.cjs.js +1 -1
  49. package/dist/tooltip/index.es.js +1 -1
  50. package/dist/ui/index.cjs.js +290 -292
  51. package/dist/ui/index.cjs.js.map +1 -1
  52. package/dist/ui/index.es.js +180 -182
  53. package/dist/ui/index.es.js.map +1 -1
  54. package/package.json +2 -2
  55. package/dist/chunks/index-CuySPbdY.js +0 -559
  56. package/dist/chunks/index-CuySPbdY.js.map +0 -1
  57. package/dist/chunks/index-DBDBh58Q.js +0 -575
  58. package/dist/chunks/index-DBDBh58Q.js.map +0 -1
  59. package/dist/chunks/index-DNSql2gU.js +0 -662
  60. package/dist/chunks/index-DNSql2gU.js.map +0 -1
  61. package/dist/chunks/index-DlZi5TkN.js +0 -646
  62. package/dist/chunks/index-DlZi5TkN.js.map +0 -1
  63. package/dist/chunks/select-DaKy-WhC.js.map +0 -1
  64. package/dist/chunks/select-DyihZY-4.js.map +0 -1
  65. package/dist/chunks/textarea-By2Vv44z.js.map +0 -1
  66. package/dist/chunks/textarea-ClJsk9Gp.js.map +0 -1
  67. package/dist/chunks/tooltip-D4UvkD2G.js +0 -525
  68. package/dist/chunks/tooltip-D4UvkD2G.js.map +0 -1
  69. package/dist/chunks/tooltip-WGeoFpGx.js +0 -541
  70. package/dist/chunks/tooltip-WGeoFpGx.js.map +0 -1
@@ -0,0 +1,1937 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const React = require("react");
4
+ const floatingUi_dom = require("./floating-ui.dom-B9hvXzxg.js");
5
+ const ReactDOM = require("react-dom");
6
+ const floatingUi_reactDom = require("./floating-ui.react-dom-CI1b2uK3.js");
7
+ const tailwindMerge = require("tailwind-merge");
8
+ const clsx = require("clsx");
9
+ function _interopNamespaceDefault(e) {
10
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
11
+ if (e) {
12
+ for (const k in e) {
13
+ if (k !== "default") {
14
+ const d = Object.getOwnPropertyDescriptor(e, k);
15
+ Object.defineProperty(n, k, d.get ? d : {
16
+ enumerable: true,
17
+ get: () => e[k]
18
+ });
19
+ }
20
+ }
21
+ }
22
+ n.default = e;
23
+ return Object.freeze(n);
24
+ }
25
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
26
+ const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
27
+ var candidateSelectors = ["input:not([inert])", "select:not([inert])", "textarea:not([inert])", "a[href]:not([inert])", "button:not([inert])", "[tabindex]:not(slot):not([inert])", "audio[controls]:not([inert])", "video[controls]:not([inert])", '[contenteditable]:not([contenteditable="false"]):not([inert])', "details>summary:first-of-type:not([inert])", "details:not([inert])"];
28
+ var candidateSelector = /* @__PURE__ */ candidateSelectors.join(",");
29
+ var NoElement = typeof Element === "undefined";
30
+ var matches = NoElement ? function() {
31
+ } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
32
+ var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) {
33
+ var _element$getRootNode;
34
+ return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
35
+ } : function(element) {
36
+ return element === null || element === void 0 ? void 0 : element.ownerDocument;
37
+ };
38
+ var isInert = function isInert2(node, lookUp) {
39
+ var _node$getAttribute;
40
+ if (lookUp === void 0) {
41
+ lookUp = true;
42
+ }
43
+ var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert");
44
+ var inert = inertAtt === "" || inertAtt === "true";
45
+ var result = inert || lookUp && node && isInert2(node.parentNode);
46
+ return result;
47
+ };
48
+ var isContentEditable = function isContentEditable2(node) {
49
+ var _node$getAttribute2;
50
+ var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable");
51
+ return attValue === "" || attValue === "true";
52
+ };
53
+ var getCandidates = function getCandidates2(el, includeContainer, filter) {
54
+ if (isInert(el)) {
55
+ return [];
56
+ }
57
+ var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector));
58
+ if (includeContainer && matches.call(el, candidateSelector)) {
59
+ candidates.unshift(el);
60
+ }
61
+ candidates = candidates.filter(filter);
62
+ return candidates;
63
+ };
64
+ var getCandidatesIteratively = function getCandidatesIteratively2(elements, includeContainer, options) {
65
+ var candidates = [];
66
+ var elementsToCheck = Array.from(elements);
67
+ while (elementsToCheck.length) {
68
+ var element = elementsToCheck.shift();
69
+ if (isInert(element, false)) {
70
+ continue;
71
+ }
72
+ if (element.tagName === "SLOT") {
73
+ var assigned = element.assignedElements();
74
+ var content = assigned.length ? assigned : element.children;
75
+ var nestedCandidates = getCandidatesIteratively2(content, true, options);
76
+ if (options.flatten) {
77
+ candidates.push.apply(candidates, nestedCandidates);
78
+ } else {
79
+ candidates.push({
80
+ scopeParent: element,
81
+ candidates: nestedCandidates
82
+ });
83
+ }
84
+ } else {
85
+ var validCandidate = matches.call(element, candidateSelector);
86
+ if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) {
87
+ candidates.push(element);
88
+ }
89
+ var shadowRoot = element.shadowRoot || // check for an undisclosed shadow
90
+ typeof options.getShadowRoot === "function" && options.getShadowRoot(element);
91
+ var validShadowRoot = !isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element));
92
+ if (shadowRoot && validShadowRoot) {
93
+ var _nestedCandidates = getCandidatesIteratively2(shadowRoot === true ? element.children : shadowRoot.children, true, options);
94
+ if (options.flatten) {
95
+ candidates.push.apply(candidates, _nestedCandidates);
96
+ } else {
97
+ candidates.push({
98
+ scopeParent: element,
99
+ candidates: _nestedCandidates
100
+ });
101
+ }
102
+ } else {
103
+ elementsToCheck.unshift.apply(elementsToCheck, element.children);
104
+ }
105
+ }
106
+ }
107
+ return candidates;
108
+ };
109
+ var hasTabIndex = function hasTabIndex2(node) {
110
+ return !isNaN(parseInt(node.getAttribute("tabindex"), 10));
111
+ };
112
+ var getTabIndex = function getTabIndex2(node) {
113
+ if (!node) {
114
+ throw new Error("No node provided");
115
+ }
116
+ if (node.tabIndex < 0) {
117
+ if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
118
+ return 0;
119
+ }
120
+ }
121
+ return node.tabIndex;
122
+ };
123
+ var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) {
124
+ var tabIndex = getTabIndex(node);
125
+ if (tabIndex < 0 && isScope && !hasTabIndex(node)) {
126
+ return 0;
127
+ }
128
+ return tabIndex;
129
+ };
130
+ var sortOrderedTabbables = function sortOrderedTabbables2(a, b) {
131
+ return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
132
+ };
133
+ var isInput = function isInput2(node) {
134
+ return node.tagName === "INPUT";
135
+ };
136
+ var isHiddenInput = function isHiddenInput2(node) {
137
+ return isInput(node) && node.type === "hidden";
138
+ };
139
+ var isDetailsWithSummary = function isDetailsWithSummary2(node) {
140
+ var r = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) {
141
+ return child.tagName === "SUMMARY";
142
+ });
143
+ return r;
144
+ };
145
+ var getCheckedRadio = function getCheckedRadio2(nodes, form) {
146
+ for (var i = 0; i < nodes.length; i++) {
147
+ if (nodes[i].checked && nodes[i].form === form) {
148
+ return nodes[i];
149
+ }
150
+ }
151
+ };
152
+ var isTabbableRadio = function isTabbableRadio2(node) {
153
+ if (!node.name) {
154
+ return true;
155
+ }
156
+ var radioScope = node.form || getRootNode(node);
157
+ var queryRadios = function queryRadios2(name) {
158
+ return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
159
+ };
160
+ var radioSet;
161
+ if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") {
162
+ radioSet = queryRadios(window.CSS.escape(node.name));
163
+ } else {
164
+ try {
165
+ radioSet = queryRadios(node.name);
166
+ } catch (err) {
167
+ return false;
168
+ }
169
+ }
170
+ var checked = getCheckedRadio(radioSet, node.form);
171
+ return !checked || checked === node;
172
+ };
173
+ var isRadio = function isRadio2(node) {
174
+ return isInput(node) && node.type === "radio";
175
+ };
176
+ var isNonTabbableRadio = function isNonTabbableRadio2(node) {
177
+ return isRadio(node) && !isTabbableRadio(node);
178
+ };
179
+ var isNodeAttached = function isNodeAttached2(node) {
180
+ var _nodeRoot;
181
+ var nodeRoot = node && getRootNode(node);
182
+ var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
183
+ var attached = false;
184
+ if (nodeRoot && nodeRoot !== node) {
185
+ var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
186
+ attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
187
+ while (!attached && nodeRootHost) {
188
+ var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
189
+ nodeRoot = getRootNode(nodeRootHost);
190
+ nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
191
+ attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
192
+ }
193
+ }
194
+ return attached;
195
+ };
196
+ var isZeroArea = function isZeroArea2(node) {
197
+ var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height;
198
+ return width === 0 && height === 0;
199
+ };
200
+ var isHidden = function isHidden2(node, _ref) {
201
+ var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot;
202
+ if (getComputedStyle(node).visibility === "hidden") {
203
+ return true;
204
+ }
205
+ var isDirectSummary = matches.call(node, "details>summary:first-of-type");
206
+ var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
207
+ if (matches.call(nodeUnderDetails, "details:not([open]) *")) {
208
+ return true;
209
+ }
210
+ if (!displayCheck || displayCheck === "full" || displayCheck === "legacy-full") {
211
+ if (typeof getShadowRoot === "function") {
212
+ var originalNode = node;
213
+ while (node) {
214
+ var parentElement = node.parentElement;
215
+ var rootNode = getRootNode(node);
216
+ if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) {
217
+ return isZeroArea(node);
218
+ } else if (node.assignedSlot) {
219
+ node = node.assignedSlot;
220
+ } else if (!parentElement && rootNode !== node.ownerDocument) {
221
+ node = rootNode.host;
222
+ } else {
223
+ node = parentElement;
224
+ }
225
+ }
226
+ node = originalNode;
227
+ }
228
+ if (isNodeAttached(node)) {
229
+ return !node.getClientRects().length;
230
+ }
231
+ if (displayCheck !== "legacy-full") {
232
+ return true;
233
+ }
234
+ } else if (displayCheck === "non-zero-area") {
235
+ return isZeroArea(node);
236
+ }
237
+ return false;
238
+ };
239
+ var isDisabledFromFieldset = function isDisabledFromFieldset2(node) {
240
+ if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
241
+ var parentNode = node.parentElement;
242
+ while (parentNode) {
243
+ if (parentNode.tagName === "FIELDSET" && parentNode.disabled) {
244
+ for (var i = 0; i < parentNode.children.length; i++) {
245
+ var child = parentNode.children.item(i);
246
+ if (child.tagName === "LEGEND") {
247
+ return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node);
248
+ }
249
+ }
250
+ return true;
251
+ }
252
+ parentNode = parentNode.parentElement;
253
+ }
254
+ }
255
+ return false;
256
+ };
257
+ var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) {
258
+ if (node.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
259
+ // because we're limited in the type of selectors we can use in JSDom (see related
260
+ // note related to `candidateSelectors`)
261
+ isInert(node) || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus
262
+ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
263
+ return false;
264
+ }
265
+ return true;
266
+ };
267
+ var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) {
268
+ if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
269
+ return false;
270
+ }
271
+ return true;
272
+ };
273
+ var isValidShadowRootTabbable = function isValidShadowRootTabbable2(shadowHostNode) {
274
+ var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10);
275
+ if (isNaN(tabIndex) || tabIndex >= 0) {
276
+ return true;
277
+ }
278
+ return false;
279
+ };
280
+ var sortByOrder = function sortByOrder2(candidates) {
281
+ var regularTabbables = [];
282
+ var orderedTabbables = [];
283
+ candidates.forEach(function(item, i) {
284
+ var isScope = !!item.scopeParent;
285
+ var element = isScope ? item.scopeParent : item;
286
+ var candidateTabindex = getSortOrderTabIndex(element, isScope);
287
+ var elements = isScope ? sortByOrder2(item.candidates) : element;
288
+ if (candidateTabindex === 0) {
289
+ isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element);
290
+ } else {
291
+ orderedTabbables.push({
292
+ documentOrder: i,
293
+ tabIndex: candidateTabindex,
294
+ item,
295
+ isScope,
296
+ content: elements
297
+ });
298
+ }
299
+ });
300
+ return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) {
301
+ sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content);
302
+ return acc;
303
+ }, []).concat(regularTabbables);
304
+ };
305
+ var tabbable = function tabbable2(container, options) {
306
+ options = options || {};
307
+ var candidates;
308
+ if (options.getShadowRoot) {
309
+ candidates = getCandidatesIteratively([container], options.includeContainer, {
310
+ filter: isNodeMatchingSelectorTabbable.bind(null, options),
311
+ flatten: false,
312
+ getShadowRoot: options.getShadowRoot,
313
+ shadowRootFilter: isValidShadowRootTabbable
314
+ });
315
+ } else {
316
+ candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options));
317
+ }
318
+ return sortByOrder(candidates);
319
+ };
320
+ function getPlatform() {
321
+ const uaData = navigator.userAgentData;
322
+ if (uaData != null && uaData.platform) {
323
+ return uaData.platform;
324
+ }
325
+ return navigator.platform;
326
+ }
327
+ function getUserAgent() {
328
+ const uaData = navigator.userAgentData;
329
+ if (uaData && Array.isArray(uaData.brands)) {
330
+ return uaData.brands.map((_ref) => {
331
+ let {
332
+ brand,
333
+ version
334
+ } = _ref;
335
+ return brand + "/" + version;
336
+ }).join(" ");
337
+ }
338
+ return navigator.userAgent;
339
+ }
340
+ function isSafari() {
341
+ return /apple/i.test(navigator.vendor);
342
+ }
343
+ function isMac() {
344
+ return getPlatform().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
345
+ }
346
+ function isJSDOM() {
347
+ return getUserAgent().includes("jsdom/");
348
+ }
349
+ const FOCUSABLE_ATTRIBUTE$1 = "data-floating-ui-focusable";
350
+ const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
351
+ function activeElement(doc) {
352
+ let activeElement2 = doc.activeElement;
353
+ while (((_activeElement = activeElement2) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null) {
354
+ var _activeElement;
355
+ activeElement2 = activeElement2.shadowRoot.activeElement;
356
+ }
357
+ return activeElement2;
358
+ }
359
+ function contains(parent, child) {
360
+ if (!parent || !child) {
361
+ return false;
362
+ }
363
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
364
+ if (parent.contains(child)) {
365
+ return true;
366
+ }
367
+ if (rootNode && floatingUi_dom.isShadowRoot(rootNode)) {
368
+ let next = child;
369
+ while (next) {
370
+ if (parent === next) {
371
+ return true;
372
+ }
373
+ next = next.parentNode || next.host;
374
+ }
375
+ }
376
+ return false;
377
+ }
378
+ function getTarget(event) {
379
+ if ("composedPath" in event) {
380
+ return event.composedPath()[0];
381
+ }
382
+ return event.target;
383
+ }
384
+ function isEventTargetWithin(event, node) {
385
+ if (node == null) {
386
+ return false;
387
+ }
388
+ if ("composedPath" in event) {
389
+ return event.composedPath().includes(node);
390
+ }
391
+ const e = event;
392
+ return e.target != null && node.contains(e.target);
393
+ }
394
+ function isRootElement(element) {
395
+ return element.matches("html,body");
396
+ }
397
+ function getDocument(node) {
398
+ return (node == null ? void 0 : node.ownerDocument) || document;
399
+ }
400
+ function isTypeableElement(element) {
401
+ return floatingUi_dom.isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR);
402
+ }
403
+ function matchesFocusVisible(element) {
404
+ if (!element || isJSDOM()) return true;
405
+ try {
406
+ return element.matches(":focus-visible");
407
+ } catch (_e) {
408
+ return true;
409
+ }
410
+ }
411
+ function getFloatingFocusElement(floatingElement) {
412
+ if (!floatingElement) {
413
+ return null;
414
+ }
415
+ return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE$1) ? floatingElement : floatingElement.querySelector("[" + FOCUSABLE_ATTRIBUTE$1 + "]") || floatingElement;
416
+ }
417
+ function getNodeChildren(nodes, id, onlyOpenChildren) {
418
+ if (onlyOpenChildren === void 0) {
419
+ onlyOpenChildren = true;
420
+ }
421
+ const directChildren = nodes.filter((node) => {
422
+ var _node$context;
423
+ return node.parentId === id && (!onlyOpenChildren || ((_node$context = node.context) == null ? void 0 : _node$context.open));
424
+ });
425
+ return directChildren.flatMap((child) => [child, ...getNodeChildren(nodes, child.id, onlyOpenChildren)]);
426
+ }
427
+ function isReactEvent(event) {
428
+ return "nativeEvent" in event;
429
+ }
430
+ function isMouseLikePointerType(pointerType, strict) {
431
+ const values = ["mouse", "pen"];
432
+ {
433
+ values.push("", void 0);
434
+ }
435
+ return values.includes(pointerType);
436
+ }
437
+ var isClient = typeof document !== "undefined";
438
+ var noop = function noop2() {
439
+ };
440
+ var index = isClient ? React.useLayoutEffect : noop;
441
+ const SafeReact$1 = {
442
+ ...React__namespace
443
+ };
444
+ function useLatestRef(value) {
445
+ const ref = React__namespace.useRef(value);
446
+ index(() => {
447
+ ref.current = value;
448
+ });
449
+ return ref;
450
+ }
451
+ const useInsertionEffect = SafeReact$1.useInsertionEffect;
452
+ const useSafeInsertionEffect = useInsertionEffect || ((fn) => fn());
453
+ function useEffectEvent(callback) {
454
+ const ref = React__namespace.useRef(() => {
455
+ if (process.env.NODE_ENV !== "production") {
456
+ throw new Error("Cannot call an event handler while rendering.");
457
+ }
458
+ });
459
+ useSafeInsertionEffect(() => {
460
+ ref.current = callback;
461
+ });
462
+ return React__namespace.useCallback(function() {
463
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
464
+ args[_key] = arguments[_key];
465
+ }
466
+ return ref.current == null ? void 0 : ref.current(...args);
467
+ }, []);
468
+ }
469
+ const getTabbableOptions = () => ({
470
+ getShadowRoot: true,
471
+ displayCheck: (
472
+ // JSDOM does not support the `tabbable` library. To solve this we can
473
+ // check if `ResizeObserver` is a real function (not polyfilled), which
474
+ // determines if the current environment is JSDOM-like.
475
+ typeof ResizeObserver === "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
476
+ )
477
+ });
478
+ function getTabbableIn(container, dir) {
479
+ const list = tabbable(container, getTabbableOptions());
480
+ const len = list.length;
481
+ if (len === 0) return;
482
+ const active = activeElement(getDocument(container));
483
+ const index2 = list.indexOf(active);
484
+ const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir;
485
+ return list[nextIndex];
486
+ }
487
+ function getNextTabbable(referenceElement) {
488
+ return getTabbableIn(getDocument(referenceElement).body, 1) || referenceElement;
489
+ }
490
+ function getPreviousTabbable(referenceElement) {
491
+ return getTabbableIn(getDocument(referenceElement).body, -1) || referenceElement;
492
+ }
493
+ function isOutsideEvent(event, container) {
494
+ const containerElement = container || event.currentTarget;
495
+ const relatedTarget = event.relatedTarget;
496
+ return !relatedTarget || !contains(containerElement, relatedTarget);
497
+ }
498
+ function disableFocusInside(container) {
499
+ const tabbableElements = tabbable(container, getTabbableOptions());
500
+ tabbableElements.forEach((element) => {
501
+ element.dataset.tabindex = element.getAttribute("tabindex") || "";
502
+ element.setAttribute("tabindex", "-1");
503
+ });
504
+ }
505
+ function enableFocusInside(container) {
506
+ const elements = container.querySelectorAll("[data-tabindex]");
507
+ elements.forEach((element) => {
508
+ const tabindex = element.dataset.tabindex;
509
+ delete element.dataset.tabindex;
510
+ if (tabindex) {
511
+ element.setAttribute("tabindex", tabindex);
512
+ } else {
513
+ element.removeAttribute("tabindex");
514
+ }
515
+ });
516
+ }
517
+ const FOCUSABLE_ATTRIBUTE = "data-floating-ui-focusable";
518
+ const ACTIVE_KEY = "active";
519
+ const SELECTED_KEY = "selected";
520
+ const SafeReact = {
521
+ ...React__namespace
522
+ };
523
+ let serverHandoffComplete = false;
524
+ let count = 0;
525
+ const genId = () => (
526
+ // Ensure the id is unique with multiple independent versions of Floating UI
527
+ // on <React 18
528
+ "floating-ui-" + Math.random().toString(36).slice(2, 6) + count++
529
+ );
530
+ function useFloatingId() {
531
+ const [id, setId] = React__namespace.useState(() => serverHandoffComplete ? genId() : void 0);
532
+ index(() => {
533
+ if (id == null) {
534
+ setId(genId());
535
+ }
536
+ }, []);
537
+ React__namespace.useEffect(() => {
538
+ serverHandoffComplete = true;
539
+ }, []);
540
+ return id;
541
+ }
542
+ const useReactId = SafeReact.useId;
543
+ const useId = useReactId || useFloatingId;
544
+ let devMessageSet;
545
+ if (process.env.NODE_ENV !== "production") {
546
+ devMessageSet = /* @__PURE__ */ new Set();
547
+ }
548
+ function warn() {
549
+ var _devMessageSet;
550
+ for (var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++) {
551
+ messages[_key] = arguments[_key];
552
+ }
553
+ const message = "Floating UI: " + messages.join(" ");
554
+ if (!((_devMessageSet = devMessageSet) != null && _devMessageSet.has(message))) {
555
+ var _devMessageSet2;
556
+ (_devMessageSet2 = devMessageSet) == null || _devMessageSet2.add(message);
557
+ }
558
+ }
559
+ function error() {
560
+ var _devMessageSet3;
561
+ for (var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
562
+ messages[_key2] = arguments[_key2];
563
+ }
564
+ const message = "Floating UI: " + messages.join(" ");
565
+ if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) {
566
+ var _devMessageSet4;
567
+ (_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message);
568
+ }
569
+ }
570
+ const FloatingArrow = /* @__PURE__ */ React__namespace.forwardRef(function FloatingArrow2(props, ref) {
571
+ const {
572
+ context: {
573
+ placement,
574
+ elements: {
575
+ floating
576
+ },
577
+ middlewareData: {
578
+ arrow,
579
+ shift
580
+ }
581
+ },
582
+ width = 14,
583
+ height = 7,
584
+ tipRadius = 0,
585
+ strokeWidth = 0,
586
+ staticOffset,
587
+ stroke,
588
+ d,
589
+ style: {
590
+ transform,
591
+ ...restStyle
592
+ } = {},
593
+ ...rest
594
+ } = props;
595
+ if (process.env.NODE_ENV !== "production") {
596
+ if (!ref) {
597
+ warn("The `ref` prop is required for `FloatingArrow`.");
598
+ }
599
+ }
600
+ const clipPathId = useId();
601
+ const [isRTL, setIsRTL] = React__namespace.useState(false);
602
+ index(() => {
603
+ if (!floating) return;
604
+ const isRTL2 = floatingUi_dom.getComputedStyle(floating).direction === "rtl";
605
+ if (isRTL2) {
606
+ setIsRTL(true);
607
+ }
608
+ }, [floating]);
609
+ if (!floating) {
610
+ return null;
611
+ }
612
+ const [side, alignment] = placement.split("-");
613
+ const isVerticalSide = side === "top" || side === "bottom";
614
+ let computedStaticOffset = staticOffset;
615
+ if (isVerticalSide && shift != null && shift.x || !isVerticalSide && shift != null && shift.y) {
616
+ computedStaticOffset = null;
617
+ }
618
+ const computedStrokeWidth = strokeWidth * 2;
619
+ const halfStrokeWidth = computedStrokeWidth / 2;
620
+ const svgX = width / 2 * (tipRadius / -8 + 1);
621
+ const svgY = height / 2 * tipRadius / 4;
622
+ const isCustomShape = !!d;
623
+ const yOffsetProp = computedStaticOffset && alignment === "end" ? "bottom" : "top";
624
+ let xOffsetProp = computedStaticOffset && alignment === "end" ? "right" : "left";
625
+ if (computedStaticOffset && isRTL) {
626
+ xOffsetProp = alignment === "end" ? "left" : "right";
627
+ }
628
+ const arrowX = (arrow == null ? void 0 : arrow.x) != null ? computedStaticOffset || arrow.x : "";
629
+ const arrowY = (arrow == null ? void 0 : arrow.y) != null ? computedStaticOffset || arrow.y : "";
630
+ const dValue = d || "M0,0" + (" H" + width) + (" L" + (width - svgX) + "," + (height - svgY)) + (" Q" + width / 2 + "," + height + " " + svgX + "," + (height - svgY)) + " Z";
631
+ const rotation = {
632
+ top: isCustomShape ? "rotate(180deg)" : "",
633
+ left: isCustomShape ? "rotate(90deg)" : "rotate(-90deg)",
634
+ bottom: isCustomShape ? "" : "rotate(180deg)",
635
+ right: isCustomShape ? "rotate(-90deg)" : "rotate(90deg)"
636
+ }[side];
637
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", {
638
+ ...rest,
639
+ "aria-hidden": true,
640
+ ref,
641
+ width: isCustomShape ? width : width + computedStrokeWidth,
642
+ height: width,
643
+ viewBox: "0 0 " + width + " " + (height > width ? height : width),
644
+ style: {
645
+ position: "absolute",
646
+ pointerEvents: "none",
647
+ [xOffsetProp]: arrowX,
648
+ [yOffsetProp]: arrowY,
649
+ [side]: isVerticalSide || isCustomShape ? "100%" : "calc(100% - " + computedStrokeWidth / 2 + "px)",
650
+ transform: [rotation, transform].filter((t) => !!t).join(" "),
651
+ ...restStyle
652
+ },
653
+ children: [computedStrokeWidth > 0 && /* @__PURE__ */ jsxRuntime.jsx("path", {
654
+ clipPath: "url(#" + clipPathId + ")",
655
+ fill: "none",
656
+ stroke,
657
+ strokeWidth: computedStrokeWidth + (d ? 0 : 1),
658
+ d: dValue
659
+ }), /* @__PURE__ */ jsxRuntime.jsx("path", {
660
+ stroke: computedStrokeWidth && !d ? rest.fill : "none",
661
+ d: dValue
662
+ }), /* @__PURE__ */ jsxRuntime.jsx("clipPath", {
663
+ id: clipPathId,
664
+ children: /* @__PURE__ */ jsxRuntime.jsx("rect", {
665
+ x: -halfStrokeWidth,
666
+ y: halfStrokeWidth * (isCustomShape ? -1 : 1),
667
+ width: width + computedStrokeWidth,
668
+ height: width
669
+ })
670
+ })]
671
+ });
672
+ });
673
+ function createEventEmitter() {
674
+ const map = /* @__PURE__ */ new Map();
675
+ return {
676
+ emit(event, data) {
677
+ var _map$get;
678
+ (_map$get = map.get(event)) == null || _map$get.forEach((listener) => listener(data));
679
+ },
680
+ on(event, listener) {
681
+ if (!map.has(event)) {
682
+ map.set(event, /* @__PURE__ */ new Set());
683
+ }
684
+ map.get(event).add(listener);
685
+ },
686
+ off(event, listener) {
687
+ var _map$get2;
688
+ (_map$get2 = map.get(event)) == null || _map$get2.delete(listener);
689
+ }
690
+ };
691
+ }
692
+ const FloatingNodeContext = /* @__PURE__ */ React__namespace.createContext(null);
693
+ const FloatingTreeContext = /* @__PURE__ */ React__namespace.createContext(null);
694
+ const useFloatingParentNodeId = () => {
695
+ var _React$useContext;
696
+ return ((_React$useContext = React__namespace.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null;
697
+ };
698
+ const useFloatingTree = () => React__namespace.useContext(FloatingTreeContext);
699
+ function createAttribute(name) {
700
+ return "data-floating-ui-" + name;
701
+ }
702
+ function clearTimeoutIfSet(timeoutRef) {
703
+ if (timeoutRef.current !== -1) {
704
+ clearTimeout(timeoutRef.current);
705
+ timeoutRef.current = -1;
706
+ }
707
+ }
708
+ const safePolygonIdentifier = /* @__PURE__ */ createAttribute("safe-polygon");
709
+ function getDelay(value, prop, pointerType) {
710
+ if (pointerType && !isMouseLikePointerType(pointerType)) {
711
+ return 0;
712
+ }
713
+ if (typeof value === "number") {
714
+ return value;
715
+ }
716
+ if (typeof value === "function") {
717
+ const result = value();
718
+ if (typeof result === "number") {
719
+ return result;
720
+ }
721
+ return result == null ? void 0 : result[prop];
722
+ }
723
+ return value == null ? void 0 : value[prop];
724
+ }
725
+ function getRestMs(value) {
726
+ if (typeof value === "function") {
727
+ return value();
728
+ }
729
+ return value;
730
+ }
731
+ function useHover(context, props) {
732
+ if (props === void 0) {
733
+ props = {};
734
+ }
735
+ const {
736
+ open,
737
+ onOpenChange,
738
+ dataRef,
739
+ events,
740
+ elements
741
+ } = context;
742
+ const {
743
+ enabled = true,
744
+ delay = 0,
745
+ handleClose = null,
746
+ mouseOnly = false,
747
+ restMs = 0,
748
+ move = true
749
+ } = props;
750
+ const tree = useFloatingTree();
751
+ const parentId = useFloatingParentNodeId();
752
+ const handleCloseRef = useLatestRef(handleClose);
753
+ const delayRef = useLatestRef(delay);
754
+ const openRef = useLatestRef(open);
755
+ const restMsRef = useLatestRef(restMs);
756
+ const pointerTypeRef = React__namespace.useRef();
757
+ const timeoutRef = React__namespace.useRef(-1);
758
+ const handlerRef = React__namespace.useRef();
759
+ const restTimeoutRef = React__namespace.useRef(-1);
760
+ const blockMouseMoveRef = React__namespace.useRef(true);
761
+ const performedPointerEventsMutationRef = React__namespace.useRef(false);
762
+ const unbindMouseMoveRef = React__namespace.useRef(() => {
763
+ });
764
+ const restTimeoutPendingRef = React__namespace.useRef(false);
765
+ const isHoverOpen = useEffectEvent(() => {
766
+ var _dataRef$current$open;
767
+ const type = (_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type;
768
+ return (type == null ? void 0 : type.includes("mouse")) && type !== "mousedown";
769
+ });
770
+ React__namespace.useEffect(() => {
771
+ if (!enabled) return;
772
+ function onOpenChange2(_ref) {
773
+ let {
774
+ open: open2
775
+ } = _ref;
776
+ if (!open2) {
777
+ clearTimeoutIfSet(timeoutRef);
778
+ clearTimeoutIfSet(restTimeoutRef);
779
+ blockMouseMoveRef.current = true;
780
+ restTimeoutPendingRef.current = false;
781
+ }
782
+ }
783
+ events.on("openchange", onOpenChange2);
784
+ return () => {
785
+ events.off("openchange", onOpenChange2);
786
+ };
787
+ }, [enabled, events]);
788
+ React__namespace.useEffect(() => {
789
+ if (!enabled) return;
790
+ if (!handleCloseRef.current) return;
791
+ if (!open) return;
792
+ function onLeave(event) {
793
+ if (isHoverOpen()) {
794
+ onOpenChange(false, event, "hover");
795
+ }
796
+ }
797
+ const html = getDocument(elements.floating).documentElement;
798
+ html.addEventListener("mouseleave", onLeave);
799
+ return () => {
800
+ html.removeEventListener("mouseleave", onLeave);
801
+ };
802
+ }, [elements.floating, open, onOpenChange, enabled, handleCloseRef, isHoverOpen]);
803
+ const closeWithDelay = React__namespace.useCallback(function(event, runElseBranch, reason) {
804
+ if (runElseBranch === void 0) {
805
+ runElseBranch = true;
806
+ }
807
+ if (reason === void 0) {
808
+ reason = "hover";
809
+ }
810
+ const closeDelay = getDelay(delayRef.current, "close", pointerTypeRef.current);
811
+ if (closeDelay && !handlerRef.current) {
812
+ clearTimeoutIfSet(timeoutRef);
813
+ timeoutRef.current = window.setTimeout(() => onOpenChange(false, event, reason), closeDelay);
814
+ } else if (runElseBranch) {
815
+ clearTimeoutIfSet(timeoutRef);
816
+ onOpenChange(false, event, reason);
817
+ }
818
+ }, [delayRef, onOpenChange]);
819
+ const cleanupMouseMoveHandler = useEffectEvent(() => {
820
+ unbindMouseMoveRef.current();
821
+ handlerRef.current = void 0;
822
+ });
823
+ const clearPointerEvents = useEffectEvent(() => {
824
+ if (performedPointerEventsMutationRef.current) {
825
+ const body = getDocument(elements.floating).body;
826
+ body.style.pointerEvents = "";
827
+ body.removeAttribute(safePolygonIdentifier);
828
+ performedPointerEventsMutationRef.current = false;
829
+ }
830
+ });
831
+ const isClickLikeOpenEvent = useEffectEvent(() => {
832
+ return dataRef.current.openEvent ? ["click", "mousedown"].includes(dataRef.current.openEvent.type) : false;
833
+ });
834
+ React__namespace.useEffect(() => {
835
+ if (!enabled) return;
836
+ function onReferenceMouseEnter(event) {
837
+ clearTimeoutIfSet(timeoutRef);
838
+ blockMouseMoveRef.current = false;
839
+ if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current) || getRestMs(restMsRef.current) > 0 && !getDelay(delayRef.current, "open")) {
840
+ return;
841
+ }
842
+ const openDelay = getDelay(delayRef.current, "open", pointerTypeRef.current);
843
+ if (openDelay) {
844
+ timeoutRef.current = window.setTimeout(() => {
845
+ if (!openRef.current) {
846
+ onOpenChange(true, event, "hover");
847
+ }
848
+ }, openDelay);
849
+ } else if (!open) {
850
+ onOpenChange(true, event, "hover");
851
+ }
852
+ }
853
+ function onReferenceMouseLeave(event) {
854
+ if (isClickLikeOpenEvent()) {
855
+ clearPointerEvents();
856
+ return;
857
+ }
858
+ unbindMouseMoveRef.current();
859
+ const doc = getDocument(elements.floating);
860
+ clearTimeoutIfSet(restTimeoutRef);
861
+ restTimeoutPendingRef.current = false;
862
+ if (handleCloseRef.current && dataRef.current.floatingContext) {
863
+ if (!open) {
864
+ clearTimeoutIfSet(timeoutRef);
865
+ }
866
+ handlerRef.current = handleCloseRef.current({
867
+ ...dataRef.current.floatingContext,
868
+ tree,
869
+ x: event.clientX,
870
+ y: event.clientY,
871
+ onClose() {
872
+ clearPointerEvents();
873
+ cleanupMouseMoveHandler();
874
+ if (!isClickLikeOpenEvent()) {
875
+ closeWithDelay(event, true, "safe-polygon");
876
+ }
877
+ }
878
+ });
879
+ const handler = handlerRef.current;
880
+ doc.addEventListener("mousemove", handler);
881
+ unbindMouseMoveRef.current = () => {
882
+ doc.removeEventListener("mousemove", handler);
883
+ };
884
+ return;
885
+ }
886
+ const shouldClose = pointerTypeRef.current === "touch" ? !contains(elements.floating, event.relatedTarget) : true;
887
+ if (shouldClose) {
888
+ closeWithDelay(event);
889
+ }
890
+ }
891
+ function onScrollMouseLeave(event) {
892
+ if (isClickLikeOpenEvent()) return;
893
+ if (!dataRef.current.floatingContext) return;
894
+ handleCloseRef.current == null || handleCloseRef.current({
895
+ ...dataRef.current.floatingContext,
896
+ tree,
897
+ x: event.clientX,
898
+ y: event.clientY,
899
+ onClose() {
900
+ clearPointerEvents();
901
+ cleanupMouseMoveHandler();
902
+ if (!isClickLikeOpenEvent()) {
903
+ closeWithDelay(event);
904
+ }
905
+ }
906
+ })(event);
907
+ }
908
+ function onFloatingMouseEnter() {
909
+ clearTimeoutIfSet(timeoutRef);
910
+ }
911
+ function onFloatingMouseLeave(event) {
912
+ if (!isClickLikeOpenEvent()) {
913
+ closeWithDelay(event, false);
914
+ }
915
+ }
916
+ if (floatingUi_dom.isElement(elements.domReference)) {
917
+ const reference2 = elements.domReference;
918
+ const floating = elements.floating;
919
+ if (open) {
920
+ reference2.addEventListener("mouseleave", onScrollMouseLeave);
921
+ }
922
+ if (move) {
923
+ reference2.addEventListener("mousemove", onReferenceMouseEnter, {
924
+ once: true
925
+ });
926
+ }
927
+ reference2.addEventListener("mouseenter", onReferenceMouseEnter);
928
+ reference2.addEventListener("mouseleave", onReferenceMouseLeave);
929
+ if (floating) {
930
+ floating.addEventListener("mouseleave", onScrollMouseLeave);
931
+ floating.addEventListener("mouseenter", onFloatingMouseEnter);
932
+ floating.addEventListener("mouseleave", onFloatingMouseLeave);
933
+ }
934
+ return () => {
935
+ if (open) {
936
+ reference2.removeEventListener("mouseleave", onScrollMouseLeave);
937
+ }
938
+ if (move) {
939
+ reference2.removeEventListener("mousemove", onReferenceMouseEnter);
940
+ }
941
+ reference2.removeEventListener("mouseenter", onReferenceMouseEnter);
942
+ reference2.removeEventListener("mouseleave", onReferenceMouseLeave);
943
+ if (floating) {
944
+ floating.removeEventListener("mouseleave", onScrollMouseLeave);
945
+ floating.removeEventListener("mouseenter", onFloatingMouseEnter);
946
+ floating.removeEventListener("mouseleave", onFloatingMouseLeave);
947
+ }
948
+ };
949
+ }
950
+ }, [elements, enabled, context, mouseOnly, move, closeWithDelay, cleanupMouseMoveHandler, clearPointerEvents, onOpenChange, open, openRef, tree, delayRef, handleCloseRef, dataRef, isClickLikeOpenEvent, restMsRef]);
951
+ index(() => {
952
+ var _handleCloseRef$curre;
953
+ if (!enabled) return;
954
+ if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && (_handleCloseRef$curre = _handleCloseRef$curre.__options) != null && _handleCloseRef$curre.blockPointerEvents && isHoverOpen()) {
955
+ performedPointerEventsMutationRef.current = true;
956
+ const floatingEl = elements.floating;
957
+ if (floatingUi_dom.isElement(elements.domReference) && floatingEl) {
958
+ var _tree$nodesRef$curren;
959
+ const body = getDocument(elements.floating).body;
960
+ body.setAttribute(safePolygonIdentifier, "");
961
+ const ref = elements.domReference;
962
+ const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find((node) => node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating;
963
+ if (parentFloating) {
964
+ parentFloating.style.pointerEvents = "";
965
+ }
966
+ body.style.pointerEvents = "none";
967
+ ref.style.pointerEvents = "auto";
968
+ floatingEl.style.pointerEvents = "auto";
969
+ return () => {
970
+ body.style.pointerEvents = "";
971
+ ref.style.pointerEvents = "";
972
+ floatingEl.style.pointerEvents = "";
973
+ };
974
+ }
975
+ }
976
+ }, [enabled, open, parentId, elements, tree, handleCloseRef, isHoverOpen]);
977
+ index(() => {
978
+ if (!open) {
979
+ pointerTypeRef.current = void 0;
980
+ restTimeoutPendingRef.current = false;
981
+ cleanupMouseMoveHandler();
982
+ clearPointerEvents();
983
+ }
984
+ }, [open, cleanupMouseMoveHandler, clearPointerEvents]);
985
+ React__namespace.useEffect(() => {
986
+ return () => {
987
+ cleanupMouseMoveHandler();
988
+ clearTimeoutIfSet(timeoutRef);
989
+ clearTimeoutIfSet(restTimeoutRef);
990
+ clearPointerEvents();
991
+ };
992
+ }, [enabled, elements.domReference, cleanupMouseMoveHandler, clearPointerEvents]);
993
+ const reference = React__namespace.useMemo(() => {
994
+ function setPointerRef(event) {
995
+ pointerTypeRef.current = event.pointerType;
996
+ }
997
+ return {
998
+ onPointerDown: setPointerRef,
999
+ onPointerEnter: setPointerRef,
1000
+ onMouseMove(event) {
1001
+ const {
1002
+ nativeEvent
1003
+ } = event;
1004
+ function handleMouseMove() {
1005
+ if (!blockMouseMoveRef.current && !openRef.current) {
1006
+ onOpenChange(true, nativeEvent, "hover");
1007
+ }
1008
+ }
1009
+ if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current)) {
1010
+ return;
1011
+ }
1012
+ if (open || getRestMs(restMsRef.current) === 0) {
1013
+ return;
1014
+ }
1015
+ if (restTimeoutPendingRef.current && event.movementX ** 2 + event.movementY ** 2 < 2) {
1016
+ return;
1017
+ }
1018
+ clearTimeoutIfSet(restTimeoutRef);
1019
+ if (pointerTypeRef.current === "touch") {
1020
+ handleMouseMove();
1021
+ } else {
1022
+ restTimeoutPendingRef.current = true;
1023
+ restTimeoutRef.current = window.setTimeout(handleMouseMove, getRestMs(restMsRef.current));
1024
+ }
1025
+ }
1026
+ };
1027
+ }, [mouseOnly, onOpenChange, open, openRef, restMsRef]);
1028
+ return React__namespace.useMemo(() => enabled ? {
1029
+ reference
1030
+ } : {}, [enabled, reference]);
1031
+ }
1032
+ const HIDDEN_STYLES = {
1033
+ border: 0,
1034
+ clip: "rect(0 0 0 0)",
1035
+ height: "1px",
1036
+ margin: "-1px",
1037
+ overflow: "hidden",
1038
+ padding: 0,
1039
+ position: "fixed",
1040
+ whiteSpace: "nowrap",
1041
+ width: "1px",
1042
+ top: 0,
1043
+ left: 0
1044
+ };
1045
+ const FocusGuard = /* @__PURE__ */ React__namespace.forwardRef(function FocusGuard2(props, ref) {
1046
+ const [role, setRole] = React__namespace.useState();
1047
+ index(() => {
1048
+ if (isSafari()) {
1049
+ setRole("button");
1050
+ }
1051
+ }, []);
1052
+ const restProps = {
1053
+ ref,
1054
+ tabIndex: 0,
1055
+ // Role is only for VoiceOver
1056
+ role,
1057
+ "aria-hidden": role ? void 0 : true,
1058
+ [createAttribute("focus-guard")]: "",
1059
+ style: HIDDEN_STYLES
1060
+ };
1061
+ return /* @__PURE__ */ jsxRuntime.jsx("span", {
1062
+ ...props,
1063
+ ...restProps
1064
+ });
1065
+ });
1066
+ const PortalContext = /* @__PURE__ */ React__namespace.createContext(null);
1067
+ const attr = /* @__PURE__ */ createAttribute("portal");
1068
+ function useFloatingPortalNode(props) {
1069
+ if (props === void 0) {
1070
+ props = {};
1071
+ }
1072
+ const {
1073
+ id,
1074
+ root
1075
+ } = props;
1076
+ const uniqueId = useId();
1077
+ const portalContext = usePortalContext();
1078
+ const [portalNode, setPortalNode] = React__namespace.useState(null);
1079
+ const portalNodeRef = React__namespace.useRef(null);
1080
+ index(() => {
1081
+ return () => {
1082
+ portalNode == null || portalNode.remove();
1083
+ queueMicrotask(() => {
1084
+ portalNodeRef.current = null;
1085
+ });
1086
+ };
1087
+ }, [portalNode]);
1088
+ index(() => {
1089
+ if (!uniqueId) return;
1090
+ if (portalNodeRef.current) return;
1091
+ const existingIdRoot = id ? document.getElementById(id) : null;
1092
+ if (!existingIdRoot) return;
1093
+ const subRoot = document.createElement("div");
1094
+ subRoot.id = uniqueId;
1095
+ subRoot.setAttribute(attr, "");
1096
+ existingIdRoot.appendChild(subRoot);
1097
+ portalNodeRef.current = subRoot;
1098
+ setPortalNode(subRoot);
1099
+ }, [id, uniqueId]);
1100
+ index(() => {
1101
+ if (root === null) return;
1102
+ if (!uniqueId) return;
1103
+ if (portalNodeRef.current) return;
1104
+ let container = root || (portalContext == null ? void 0 : portalContext.portalNode);
1105
+ if (container && !floatingUi_dom.isNode(container)) container = container.current;
1106
+ container = container || document.body;
1107
+ let idWrapper = null;
1108
+ if (id) {
1109
+ idWrapper = document.createElement("div");
1110
+ idWrapper.id = id;
1111
+ container.appendChild(idWrapper);
1112
+ }
1113
+ const subRoot = document.createElement("div");
1114
+ subRoot.id = uniqueId;
1115
+ subRoot.setAttribute(attr, "");
1116
+ container = idWrapper || container;
1117
+ container.appendChild(subRoot);
1118
+ portalNodeRef.current = subRoot;
1119
+ setPortalNode(subRoot);
1120
+ }, [id, root, uniqueId, portalContext]);
1121
+ return portalNode;
1122
+ }
1123
+ function FloatingPortal(props) {
1124
+ const {
1125
+ children,
1126
+ id,
1127
+ root,
1128
+ preserveTabOrder = true
1129
+ } = props;
1130
+ const portalNode = useFloatingPortalNode({
1131
+ id,
1132
+ root
1133
+ });
1134
+ const [focusManagerState, setFocusManagerState] = React__namespace.useState(null);
1135
+ const beforeOutsideRef = React__namespace.useRef(null);
1136
+ const afterOutsideRef = React__namespace.useRef(null);
1137
+ const beforeInsideRef = React__namespace.useRef(null);
1138
+ const afterInsideRef = React__namespace.useRef(null);
1139
+ const modal = focusManagerState == null ? void 0 : focusManagerState.modal;
1140
+ const open = focusManagerState == null ? void 0 : focusManagerState.open;
1141
+ const shouldRenderGuards = (
1142
+ // The FocusManager and therefore floating element are currently open/
1143
+ // rendered.
1144
+ !!focusManagerState && // Guards are only for non-modal focus management.
1145
+ !focusManagerState.modal && // Don't render if unmount is transitioning.
1146
+ focusManagerState.open && preserveTabOrder && !!(root || portalNode)
1147
+ );
1148
+ React__namespace.useEffect(() => {
1149
+ if (!portalNode || !preserveTabOrder || modal) {
1150
+ return;
1151
+ }
1152
+ function onFocus(event) {
1153
+ if (portalNode && isOutsideEvent(event)) {
1154
+ const focusing = event.type === "focusin";
1155
+ const manageFocus = focusing ? enableFocusInside : disableFocusInside;
1156
+ manageFocus(portalNode);
1157
+ }
1158
+ }
1159
+ portalNode.addEventListener("focusin", onFocus, true);
1160
+ portalNode.addEventListener("focusout", onFocus, true);
1161
+ return () => {
1162
+ portalNode.removeEventListener("focusin", onFocus, true);
1163
+ portalNode.removeEventListener("focusout", onFocus, true);
1164
+ };
1165
+ }, [portalNode, preserveTabOrder, modal]);
1166
+ React__namespace.useEffect(() => {
1167
+ if (!portalNode) return;
1168
+ if (open) return;
1169
+ enableFocusInside(portalNode);
1170
+ }, [open, portalNode]);
1171
+ return /* @__PURE__ */ jsxRuntime.jsxs(PortalContext.Provider, {
1172
+ value: React__namespace.useMemo(() => ({
1173
+ preserveTabOrder,
1174
+ beforeOutsideRef,
1175
+ afterOutsideRef,
1176
+ beforeInsideRef,
1177
+ afterInsideRef,
1178
+ portalNode,
1179
+ setFocusManagerState
1180
+ }), [preserveTabOrder, portalNode]),
1181
+ children: [shouldRenderGuards && portalNode && /* @__PURE__ */ jsxRuntime.jsx(FocusGuard, {
1182
+ "data-type": "outside",
1183
+ ref: beforeOutsideRef,
1184
+ onFocus: (event) => {
1185
+ if (isOutsideEvent(event, portalNode)) {
1186
+ var _beforeInsideRef$curr;
1187
+ (_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus();
1188
+ } else {
1189
+ const domReference = focusManagerState ? focusManagerState.domReference : null;
1190
+ const prevTabbable = getPreviousTabbable(domReference);
1191
+ prevTabbable == null || prevTabbable.focus();
1192
+ }
1193
+ }
1194
+ }), shouldRenderGuards && portalNode && /* @__PURE__ */ jsxRuntime.jsx("span", {
1195
+ "aria-owns": portalNode.id,
1196
+ style: HIDDEN_STYLES
1197
+ }), portalNode && /* @__PURE__ */ ReactDOM__namespace.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ jsxRuntime.jsx(FocusGuard, {
1198
+ "data-type": "outside",
1199
+ ref: afterOutsideRef,
1200
+ onFocus: (event) => {
1201
+ if (isOutsideEvent(event, portalNode)) {
1202
+ var _afterInsideRef$curre;
1203
+ (_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus();
1204
+ } else {
1205
+ const domReference = focusManagerState ? focusManagerState.domReference : null;
1206
+ const nextTabbable = getNextTabbable(domReference);
1207
+ nextTabbable == null || nextTabbable.focus();
1208
+ (focusManagerState == null ? void 0 : focusManagerState.closeOnFocusOut) && (focusManagerState == null ? void 0 : focusManagerState.onOpenChange(false, event.nativeEvent, "focus-out"));
1209
+ }
1210
+ }
1211
+ })]
1212
+ });
1213
+ }
1214
+ const usePortalContext = () => React__namespace.useContext(PortalContext);
1215
+ const bubbleHandlerKeys = {
1216
+ pointerdown: "onPointerDown",
1217
+ mousedown: "onMouseDown",
1218
+ click: "onClick"
1219
+ };
1220
+ const captureHandlerKeys = {
1221
+ pointerdown: "onPointerDownCapture",
1222
+ mousedown: "onMouseDownCapture",
1223
+ click: "onClickCapture"
1224
+ };
1225
+ const normalizeProp = (normalizable) => {
1226
+ var _normalizable$escapeK, _normalizable$outside;
1227
+ return {
1228
+ escapeKey: typeof normalizable === "boolean" ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false,
1229
+ outsidePress: typeof normalizable === "boolean" ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true
1230
+ };
1231
+ };
1232
+ function useDismiss(context, props) {
1233
+ if (props === void 0) {
1234
+ props = {};
1235
+ }
1236
+ const {
1237
+ open,
1238
+ onOpenChange,
1239
+ elements,
1240
+ dataRef
1241
+ } = context;
1242
+ const {
1243
+ enabled = true,
1244
+ escapeKey = true,
1245
+ outsidePress: unstable_outsidePress = true,
1246
+ outsidePressEvent = "pointerdown",
1247
+ referencePress = false,
1248
+ referencePressEvent = "pointerdown",
1249
+ ancestorScroll = false,
1250
+ bubbles,
1251
+ capture
1252
+ } = props;
1253
+ const tree = useFloatingTree();
1254
+ const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === "function" ? unstable_outsidePress : () => false);
1255
+ const outsidePress = typeof unstable_outsidePress === "function" ? outsidePressFn : unstable_outsidePress;
1256
+ const endedOrStartedInsideRef = React__namespace.useRef(false);
1257
+ const {
1258
+ escapeKey: escapeKeyBubbles,
1259
+ outsidePress: outsidePressBubbles
1260
+ } = normalizeProp(bubbles);
1261
+ const {
1262
+ escapeKey: escapeKeyCapture,
1263
+ outsidePress: outsidePressCapture
1264
+ } = normalizeProp(capture);
1265
+ const isComposingRef = React__namespace.useRef(false);
1266
+ const closeOnEscapeKeyDown = useEffectEvent((event) => {
1267
+ var _dataRef$current$floa;
1268
+ if (!open || !enabled || !escapeKey || event.key !== "Escape") {
1269
+ return;
1270
+ }
1271
+ if (isComposingRef.current) {
1272
+ return;
1273
+ }
1274
+ const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId;
1275
+ const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
1276
+ if (!escapeKeyBubbles) {
1277
+ event.stopPropagation();
1278
+ if (children.length > 0) {
1279
+ let shouldDismiss = true;
1280
+ children.forEach((child) => {
1281
+ var _child$context;
1282
+ if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) {
1283
+ shouldDismiss = false;
1284
+ return;
1285
+ }
1286
+ });
1287
+ if (!shouldDismiss) {
1288
+ return;
1289
+ }
1290
+ }
1291
+ }
1292
+ onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, "escape-key");
1293
+ });
1294
+ const closeOnEscapeKeyDownCapture = useEffectEvent((event) => {
1295
+ var _getTarget2;
1296
+ const callback = () => {
1297
+ var _getTarget;
1298
+ closeOnEscapeKeyDown(event);
1299
+ (_getTarget = getTarget(event)) == null || _getTarget.removeEventListener("keydown", callback);
1300
+ };
1301
+ (_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener("keydown", callback);
1302
+ });
1303
+ const closeOnPressOutside = useEffectEvent((event) => {
1304
+ var _dataRef$current$floa2;
1305
+ const insideReactTree = dataRef.current.insideReactTree;
1306
+ dataRef.current.insideReactTree = false;
1307
+ const endedOrStartedInside = endedOrStartedInsideRef.current;
1308
+ endedOrStartedInsideRef.current = false;
1309
+ if (outsidePressEvent === "click" && endedOrStartedInside) {
1310
+ return;
1311
+ }
1312
+ if (insideReactTree) {
1313
+ return;
1314
+ }
1315
+ if (typeof outsidePress === "function" && !outsidePress(event)) {
1316
+ return;
1317
+ }
1318
+ const target = getTarget(event);
1319
+ const inertSelector = "[" + createAttribute("inert") + "]";
1320
+ const markers = getDocument(elements.floating).querySelectorAll(inertSelector);
1321
+ let targetRootAncestor = floatingUi_dom.isElement(target) ? target : null;
1322
+ while (targetRootAncestor && !floatingUi_dom.isLastTraversableNode(targetRootAncestor)) {
1323
+ const nextParent = floatingUi_dom.getParentNode(targetRootAncestor);
1324
+ if (floatingUi_dom.isLastTraversableNode(nextParent) || !floatingUi_dom.isElement(nextParent)) {
1325
+ break;
1326
+ }
1327
+ targetRootAncestor = nextParent;
1328
+ }
1329
+ if (markers.length && floatingUi_dom.isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
1330
+ !contains(target, elements.floating) && // If the target root element contains none of the markers, then the
1331
+ // element was injected after the floating element rendered.
1332
+ Array.from(markers).every((marker) => !contains(targetRootAncestor, marker))) {
1333
+ return;
1334
+ }
1335
+ if (floatingUi_dom.isHTMLElement(target) && floating) {
1336
+ const lastTraversableNode = floatingUi_dom.isLastTraversableNode(target);
1337
+ const style = floatingUi_dom.getComputedStyle(target);
1338
+ const scrollRe = /auto|scroll/;
1339
+ const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX);
1340
+ const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY);
1341
+ const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth;
1342
+ const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight;
1343
+ const isRTL = style.direction === "rtl";
1344
+ const pressedVerticalScrollbar = canScrollY && (isRTL ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth);
1345
+ const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight;
1346
+ if (pressedVerticalScrollbar || pressedHorizontalScrollbar) {
1347
+ return;
1348
+ }
1349
+ }
1350
+ const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId;
1351
+ const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => {
1352
+ var _node$context;
1353
+ return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating);
1354
+ });
1355
+ if (isEventTargetWithin(event, elements.floating) || isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) {
1356
+ return;
1357
+ }
1358
+ const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : [];
1359
+ if (children.length > 0) {
1360
+ let shouldDismiss = true;
1361
+ children.forEach((child) => {
1362
+ var _child$context2;
1363
+ if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) {
1364
+ shouldDismiss = false;
1365
+ return;
1366
+ }
1367
+ });
1368
+ if (!shouldDismiss) {
1369
+ return;
1370
+ }
1371
+ }
1372
+ onOpenChange(false, event, "outside-press");
1373
+ });
1374
+ const closeOnPressOutsideCapture = useEffectEvent((event) => {
1375
+ var _getTarget4;
1376
+ const callback = () => {
1377
+ var _getTarget3;
1378
+ closeOnPressOutside(event);
1379
+ (_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback);
1380
+ };
1381
+ (_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback);
1382
+ });
1383
+ React__namespace.useEffect(() => {
1384
+ if (!open || !enabled) {
1385
+ return;
1386
+ }
1387
+ dataRef.current.__escapeKeyBubbles = escapeKeyBubbles;
1388
+ dataRef.current.__outsidePressBubbles = outsidePressBubbles;
1389
+ let compositionTimeout = -1;
1390
+ function onScroll(event) {
1391
+ onOpenChange(false, event, "ancestor-scroll");
1392
+ }
1393
+ function handleCompositionStart() {
1394
+ window.clearTimeout(compositionTimeout);
1395
+ isComposingRef.current = true;
1396
+ }
1397
+ function handleCompositionEnd() {
1398
+ compositionTimeout = window.setTimeout(
1399
+ () => {
1400
+ isComposingRef.current = false;
1401
+ },
1402
+ // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
1403
+ // Only apply to WebKit for the test to remain 0ms.
1404
+ floatingUi_dom.isWebKit() ? 5 : 0
1405
+ );
1406
+ }
1407
+ const doc = getDocument(elements.floating);
1408
+ if (escapeKey) {
1409
+ doc.addEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
1410
+ doc.addEventListener("compositionstart", handleCompositionStart);
1411
+ doc.addEventListener("compositionend", handleCompositionEnd);
1412
+ }
1413
+ outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
1414
+ let ancestors = [];
1415
+ if (ancestorScroll) {
1416
+ if (floatingUi_dom.isElement(elements.domReference)) {
1417
+ ancestors = floatingUi_dom.getOverflowAncestors(elements.domReference);
1418
+ }
1419
+ if (floatingUi_dom.isElement(elements.floating)) {
1420
+ ancestors = ancestors.concat(floatingUi_dom.getOverflowAncestors(elements.floating));
1421
+ }
1422
+ if (!floatingUi_dom.isElement(elements.reference) && elements.reference && elements.reference.contextElement) {
1423
+ ancestors = ancestors.concat(floatingUi_dom.getOverflowAncestors(elements.reference.contextElement));
1424
+ }
1425
+ }
1426
+ ancestors = ancestors.filter((ancestor) => {
1427
+ var _doc$defaultView;
1428
+ return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualViewport);
1429
+ });
1430
+ ancestors.forEach((ancestor) => {
1431
+ ancestor.addEventListener("scroll", onScroll, {
1432
+ passive: true
1433
+ });
1434
+ });
1435
+ return () => {
1436
+ if (escapeKey) {
1437
+ doc.removeEventListener("keydown", escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture);
1438
+ doc.removeEventListener("compositionstart", handleCompositionStart);
1439
+ doc.removeEventListener("compositionend", handleCompositionEnd);
1440
+ }
1441
+ outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture);
1442
+ ancestors.forEach((ancestor) => {
1443
+ ancestor.removeEventListener("scroll", onScroll);
1444
+ });
1445
+ window.clearTimeout(compositionTimeout);
1446
+ };
1447
+ }, [dataRef, elements, escapeKey, outsidePress, outsidePressEvent, open, onOpenChange, ancestorScroll, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, escapeKeyCapture, closeOnEscapeKeyDownCapture, closeOnPressOutside, outsidePressCapture, closeOnPressOutsideCapture]);
1448
+ React__namespace.useEffect(() => {
1449
+ dataRef.current.insideReactTree = false;
1450
+ }, [dataRef, outsidePress, outsidePressEvent]);
1451
+ const reference = React__namespace.useMemo(() => ({
1452
+ onKeyDown: closeOnEscapeKeyDown,
1453
+ ...referencePress && {
1454
+ [bubbleHandlerKeys[referencePressEvent]]: (event) => {
1455
+ onOpenChange(false, event.nativeEvent, "reference-press");
1456
+ },
1457
+ ...referencePressEvent !== "click" && {
1458
+ onClick(event) {
1459
+ onOpenChange(false, event.nativeEvent, "reference-press");
1460
+ }
1461
+ }
1462
+ }
1463
+ }), [closeOnEscapeKeyDown, onOpenChange, referencePress, referencePressEvent]);
1464
+ const floating = React__namespace.useMemo(() => ({
1465
+ onKeyDown: closeOnEscapeKeyDown,
1466
+ onMouseDown() {
1467
+ endedOrStartedInsideRef.current = true;
1468
+ },
1469
+ onMouseUp() {
1470
+ endedOrStartedInsideRef.current = true;
1471
+ },
1472
+ [captureHandlerKeys[outsidePressEvent]]: () => {
1473
+ dataRef.current.insideReactTree = true;
1474
+ }
1475
+ }), [closeOnEscapeKeyDown, outsidePressEvent, dataRef]);
1476
+ return React__namespace.useMemo(() => enabled ? {
1477
+ reference,
1478
+ floating
1479
+ } : {}, [enabled, reference, floating]);
1480
+ }
1481
+ function useFloatingRootContext(options) {
1482
+ const {
1483
+ open = false,
1484
+ onOpenChange: onOpenChangeProp,
1485
+ elements: elementsProp
1486
+ } = options;
1487
+ const floatingId = useId();
1488
+ const dataRef = React__namespace.useRef({});
1489
+ const [events] = React__namespace.useState(() => createEventEmitter());
1490
+ const nested = useFloatingParentNodeId() != null;
1491
+ if (process.env.NODE_ENV !== "production") {
1492
+ const optionDomReference = elementsProp.reference;
1493
+ if (optionDomReference && !floatingUi_dom.isElement(optionDomReference)) {
1494
+ error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
1495
+ }
1496
+ }
1497
+ const [positionReference, setPositionReference] = React__namespace.useState(elementsProp.reference);
1498
+ const onOpenChange = useEffectEvent((open2, event, reason) => {
1499
+ dataRef.current.openEvent = open2 ? event : void 0;
1500
+ events.emit("openchange", {
1501
+ open: open2,
1502
+ event,
1503
+ reason,
1504
+ nested
1505
+ });
1506
+ onOpenChangeProp == null || onOpenChangeProp(open2, event, reason);
1507
+ });
1508
+ const refs = React__namespace.useMemo(() => ({
1509
+ setPositionReference
1510
+ }), []);
1511
+ const elements = React__namespace.useMemo(() => ({
1512
+ reference: positionReference || elementsProp.reference || null,
1513
+ floating: elementsProp.floating || null,
1514
+ domReference: elementsProp.reference
1515
+ }), [positionReference, elementsProp.reference, elementsProp.floating]);
1516
+ return React__namespace.useMemo(() => ({
1517
+ dataRef,
1518
+ open,
1519
+ onOpenChange,
1520
+ elements,
1521
+ events,
1522
+ floatingId,
1523
+ refs
1524
+ }), [open, onOpenChange, elements, events, floatingId, refs]);
1525
+ }
1526
+ function useFloating(options) {
1527
+ if (options === void 0) {
1528
+ options = {};
1529
+ }
1530
+ const {
1531
+ nodeId
1532
+ } = options;
1533
+ const internalRootContext = useFloatingRootContext({
1534
+ ...options,
1535
+ elements: {
1536
+ reference: null,
1537
+ floating: null,
1538
+ ...options.elements
1539
+ }
1540
+ });
1541
+ const rootContext = options.rootContext || internalRootContext;
1542
+ const computedElements = rootContext.elements;
1543
+ const [_domReference, setDomReference] = React__namespace.useState(null);
1544
+ const [positionReference, _setPositionReference] = React__namespace.useState(null);
1545
+ const optionDomReference = computedElements == null ? void 0 : computedElements.domReference;
1546
+ const domReference = optionDomReference || _domReference;
1547
+ const domReferenceRef = React__namespace.useRef(null);
1548
+ const tree = useFloatingTree();
1549
+ index(() => {
1550
+ if (domReference) {
1551
+ domReferenceRef.current = domReference;
1552
+ }
1553
+ }, [domReference]);
1554
+ const position = floatingUi_reactDom.useFloating({
1555
+ ...options,
1556
+ elements: {
1557
+ ...computedElements,
1558
+ ...positionReference && {
1559
+ reference: positionReference
1560
+ }
1561
+ }
1562
+ });
1563
+ const setPositionReference = React__namespace.useCallback((node) => {
1564
+ const computedPositionReference = floatingUi_dom.isElement(node) ? {
1565
+ getBoundingClientRect: () => node.getBoundingClientRect(),
1566
+ getClientRects: () => node.getClientRects(),
1567
+ contextElement: node
1568
+ } : node;
1569
+ _setPositionReference(computedPositionReference);
1570
+ position.refs.setReference(computedPositionReference);
1571
+ }, [position.refs]);
1572
+ const setReference = React__namespace.useCallback((node) => {
1573
+ if (floatingUi_dom.isElement(node) || node === null) {
1574
+ domReferenceRef.current = node;
1575
+ setDomReference(node);
1576
+ }
1577
+ if (floatingUi_dom.isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1578
+ // `null` to support `positionReference` + an unstable `reference`
1579
+ // callback ref.
1580
+ node !== null && !floatingUi_dom.isElement(node)) {
1581
+ position.refs.setReference(node);
1582
+ }
1583
+ }, [position.refs]);
1584
+ const refs = React__namespace.useMemo(() => ({
1585
+ ...position.refs,
1586
+ setReference,
1587
+ setPositionReference,
1588
+ domReference: domReferenceRef
1589
+ }), [position.refs, setReference, setPositionReference]);
1590
+ const elements = React__namespace.useMemo(() => ({
1591
+ ...position.elements,
1592
+ domReference
1593
+ }), [position.elements, domReference]);
1594
+ const context = React__namespace.useMemo(() => ({
1595
+ ...position,
1596
+ ...rootContext,
1597
+ refs,
1598
+ elements,
1599
+ nodeId
1600
+ }), [position, refs, elements, nodeId, rootContext]);
1601
+ index(() => {
1602
+ rootContext.dataRef.current.floatingContext = context;
1603
+ const node = tree == null ? void 0 : tree.nodesRef.current.find((node2) => node2.id === nodeId);
1604
+ if (node) {
1605
+ node.context = context;
1606
+ }
1607
+ });
1608
+ return React__namespace.useMemo(() => ({
1609
+ ...position,
1610
+ context,
1611
+ refs,
1612
+ elements
1613
+ }), [position, refs, elements, context]);
1614
+ }
1615
+ function isMacSafari() {
1616
+ return isMac() && isSafari();
1617
+ }
1618
+ function useFocus(context, props) {
1619
+ if (props === void 0) {
1620
+ props = {};
1621
+ }
1622
+ const {
1623
+ open,
1624
+ onOpenChange,
1625
+ events,
1626
+ dataRef,
1627
+ elements
1628
+ } = context;
1629
+ const {
1630
+ enabled = true,
1631
+ visibleOnly = true
1632
+ } = props;
1633
+ const blockFocusRef = React__namespace.useRef(false);
1634
+ const timeoutRef = React__namespace.useRef(-1);
1635
+ const keyboardModalityRef = React__namespace.useRef(true);
1636
+ React__namespace.useEffect(() => {
1637
+ if (!enabled) return;
1638
+ const win = floatingUi_dom.getWindow(elements.domReference);
1639
+ function onBlur() {
1640
+ if (!open && floatingUi_dom.isHTMLElement(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference))) {
1641
+ blockFocusRef.current = true;
1642
+ }
1643
+ }
1644
+ function onKeyDown() {
1645
+ keyboardModalityRef.current = true;
1646
+ }
1647
+ function onPointerDown() {
1648
+ keyboardModalityRef.current = false;
1649
+ }
1650
+ win.addEventListener("blur", onBlur);
1651
+ if (isMacSafari()) {
1652
+ win.addEventListener("keydown", onKeyDown, true);
1653
+ win.addEventListener("pointerdown", onPointerDown, true);
1654
+ }
1655
+ return () => {
1656
+ win.removeEventListener("blur", onBlur);
1657
+ if (isMacSafari()) {
1658
+ win.removeEventListener("keydown", onKeyDown, true);
1659
+ win.removeEventListener("pointerdown", onPointerDown, true);
1660
+ }
1661
+ };
1662
+ }, [elements.domReference, open, enabled]);
1663
+ React__namespace.useEffect(() => {
1664
+ if (!enabled) return;
1665
+ function onOpenChange2(_ref) {
1666
+ let {
1667
+ reason
1668
+ } = _ref;
1669
+ if (reason === "reference-press" || reason === "escape-key") {
1670
+ blockFocusRef.current = true;
1671
+ }
1672
+ }
1673
+ events.on("openchange", onOpenChange2);
1674
+ return () => {
1675
+ events.off("openchange", onOpenChange2);
1676
+ };
1677
+ }, [events, enabled]);
1678
+ React__namespace.useEffect(() => {
1679
+ return () => {
1680
+ clearTimeoutIfSet(timeoutRef);
1681
+ };
1682
+ }, []);
1683
+ const reference = React__namespace.useMemo(() => ({
1684
+ onMouseLeave() {
1685
+ blockFocusRef.current = false;
1686
+ },
1687
+ onFocus(event) {
1688
+ if (blockFocusRef.current) return;
1689
+ const target = getTarget(event.nativeEvent);
1690
+ if (visibleOnly && floatingUi_dom.isElement(target)) {
1691
+ if (isMacSafari() && !event.relatedTarget) {
1692
+ if (!keyboardModalityRef.current && !isTypeableElement(target)) {
1693
+ return;
1694
+ }
1695
+ } else if (!matchesFocusVisible(target)) {
1696
+ return;
1697
+ }
1698
+ }
1699
+ onOpenChange(true, event.nativeEvent, "focus");
1700
+ },
1701
+ onBlur(event) {
1702
+ blockFocusRef.current = false;
1703
+ const relatedTarget = event.relatedTarget;
1704
+ const nativeEvent = event.nativeEvent;
1705
+ const movedToFocusGuard = floatingUi_dom.isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside";
1706
+ timeoutRef.current = window.setTimeout(() => {
1707
+ var _dataRef$current$floa;
1708
+ const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document);
1709
+ if (!relatedTarget && activeEl === elements.domReference) return;
1710
+ if (contains((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || contains(elements.domReference, activeEl) || movedToFocusGuard) {
1711
+ return;
1712
+ }
1713
+ onOpenChange(false, nativeEvent, "focus");
1714
+ });
1715
+ }
1716
+ }), [dataRef, elements.domReference, onOpenChange, visibleOnly]);
1717
+ return React__namespace.useMemo(() => enabled ? {
1718
+ reference
1719
+ } : {}, [enabled, reference]);
1720
+ }
1721
+ function mergeProps(userProps, propsList, elementKey) {
1722
+ const map = /* @__PURE__ */ new Map();
1723
+ const isItem = elementKey === "item";
1724
+ let domUserProps = userProps;
1725
+ if (isItem && userProps) {
1726
+ const {
1727
+ [ACTIVE_KEY]: _,
1728
+ [SELECTED_KEY]: __,
1729
+ ...validProps
1730
+ } = userProps;
1731
+ domUserProps = validProps;
1732
+ }
1733
+ return {
1734
+ ...elementKey === "floating" && {
1735
+ tabIndex: -1,
1736
+ [FOCUSABLE_ATTRIBUTE]: ""
1737
+ },
1738
+ ...domUserProps,
1739
+ ...propsList.map((value) => {
1740
+ const propsOrGetProps = value ? value[elementKey] : null;
1741
+ if (typeof propsOrGetProps === "function") {
1742
+ return userProps ? propsOrGetProps(userProps) : null;
1743
+ }
1744
+ return propsOrGetProps;
1745
+ }).concat(userProps).reduce((acc, props) => {
1746
+ if (!props) {
1747
+ return acc;
1748
+ }
1749
+ Object.entries(props).forEach((_ref) => {
1750
+ let [key, value] = _ref;
1751
+ if (isItem && [ACTIVE_KEY, SELECTED_KEY].includes(key)) {
1752
+ return;
1753
+ }
1754
+ if (key.indexOf("on") === 0) {
1755
+ if (!map.has(key)) {
1756
+ map.set(key, []);
1757
+ }
1758
+ if (typeof value === "function") {
1759
+ var _map$get;
1760
+ (_map$get = map.get(key)) == null || _map$get.push(value);
1761
+ acc[key] = function() {
1762
+ var _map$get2;
1763
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1764
+ args[_key] = arguments[_key];
1765
+ }
1766
+ return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map((fn) => fn(...args)).find((val) => val !== void 0);
1767
+ };
1768
+ }
1769
+ } else {
1770
+ acc[key] = value;
1771
+ }
1772
+ });
1773
+ return acc;
1774
+ }, {})
1775
+ };
1776
+ }
1777
+ function useInteractions(propsList) {
1778
+ if (propsList === void 0) {
1779
+ propsList = [];
1780
+ }
1781
+ const referenceDeps = propsList.map((key) => key == null ? void 0 : key.reference);
1782
+ const floatingDeps = propsList.map((key) => key == null ? void 0 : key.floating);
1783
+ const itemDeps = propsList.map((key) => key == null ? void 0 : key.item);
1784
+ const getReferenceProps = React__namespace.useCallback(
1785
+ (userProps) => mergeProps(userProps, propsList, "reference"),
1786
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1787
+ referenceDeps
1788
+ );
1789
+ const getFloatingProps = React__namespace.useCallback(
1790
+ (userProps) => mergeProps(userProps, propsList, "floating"),
1791
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1792
+ floatingDeps
1793
+ );
1794
+ const getItemProps = React__namespace.useCallback(
1795
+ (userProps) => mergeProps(userProps, propsList, "item"),
1796
+ // eslint-disable-next-line react-hooks/exhaustive-deps
1797
+ itemDeps
1798
+ );
1799
+ return React__namespace.useMemo(() => ({
1800
+ getReferenceProps,
1801
+ getFloatingProps,
1802
+ getItemProps
1803
+ }), [getReferenceProps, getFloatingProps, getItemProps]);
1804
+ }
1805
+ const componentRoleToAriaRoleMap = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", false]]);
1806
+ function useRole(context, props) {
1807
+ var _elements$domReferenc, _componentRoleToAriaR;
1808
+ if (props === void 0) {
1809
+ props = {};
1810
+ }
1811
+ const {
1812
+ open,
1813
+ elements,
1814
+ floatingId: defaultFloatingId
1815
+ } = context;
1816
+ const {
1817
+ enabled = true,
1818
+ role = "dialog"
1819
+ } = props;
1820
+ const defaultReferenceId = useId();
1821
+ const referenceId = ((_elements$domReferenc = elements.domReference) == null ? void 0 : _elements$domReferenc.id) || defaultReferenceId;
1822
+ const floatingId = React__namespace.useMemo(() => {
1823
+ var _getFloatingFocusElem;
1824
+ return ((_getFloatingFocusElem = getFloatingFocusElement(elements.floating)) == null ? void 0 : _getFloatingFocusElem.id) || defaultFloatingId;
1825
+ }, [elements.floating, defaultFloatingId]);
1826
+ const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role;
1827
+ const parentId = useFloatingParentNodeId();
1828
+ const isNested = parentId != null;
1829
+ const reference = React__namespace.useMemo(() => {
1830
+ if (ariaRole === "tooltip" || role === "label") {
1831
+ return {
1832
+ ["aria-" + (role === "label" ? "labelledby" : "describedby")]: open ? floatingId : void 0
1833
+ };
1834
+ }
1835
+ return {
1836
+ "aria-expanded": open ? "true" : "false",
1837
+ "aria-haspopup": ariaRole === "alertdialog" ? "dialog" : ariaRole,
1838
+ "aria-controls": open ? floatingId : void 0,
1839
+ ...ariaRole === "listbox" && {
1840
+ role: "combobox"
1841
+ },
1842
+ ...ariaRole === "menu" && {
1843
+ id: referenceId
1844
+ },
1845
+ ...ariaRole === "menu" && isNested && {
1846
+ role: "menuitem"
1847
+ },
1848
+ ...role === "select" && {
1849
+ "aria-autocomplete": "none"
1850
+ },
1851
+ ...role === "combobox" && {
1852
+ "aria-autocomplete": "list"
1853
+ }
1854
+ };
1855
+ }, [ariaRole, floatingId, isNested, open, referenceId, role]);
1856
+ const floating = React__namespace.useMemo(() => {
1857
+ const floatingProps = {
1858
+ id: floatingId,
1859
+ ...ariaRole && {
1860
+ role: ariaRole
1861
+ }
1862
+ };
1863
+ if (ariaRole === "tooltip" || role === "label") {
1864
+ return floatingProps;
1865
+ }
1866
+ return {
1867
+ ...floatingProps,
1868
+ ...ariaRole === "menu" && {
1869
+ "aria-labelledby": referenceId
1870
+ }
1871
+ };
1872
+ }, [ariaRole, floatingId, referenceId, role]);
1873
+ const item = React__namespace.useCallback((_ref) => {
1874
+ let {
1875
+ active,
1876
+ selected
1877
+ } = _ref;
1878
+ const commonProps = {
1879
+ role: "option",
1880
+ ...active && {
1881
+ id: floatingId + "-fui-option"
1882
+ }
1883
+ };
1884
+ switch (role) {
1885
+ case "select":
1886
+ case "combobox":
1887
+ return {
1888
+ ...commonProps,
1889
+ "aria-selected": selected
1890
+ };
1891
+ }
1892
+ return {};
1893
+ }, [floatingId, role]);
1894
+ return React__namespace.useMemo(() => enabled ? {
1895
+ reference,
1896
+ floating,
1897
+ item
1898
+ } : {}, [enabled, reference, floating, item]);
1899
+ }
1900
+ const Tooltip = ({ children, content, className, placement = "top", showArrow = true }) => {
1901
+ const [isOpen, setIsOpen] = React.useState(false);
1902
+ const arrowRef = React.useRef(null);
1903
+ const { refs, floatingStyles, context } = useFloating({
1904
+ open: isOpen,
1905
+ onOpenChange: setIsOpen,
1906
+ placement,
1907
+ strategy: "fixed",
1908
+ middleware: [floatingUi_reactDom.offset(8), floatingUi_reactDom.flip(), floatingUi_reactDom.shift(), floatingUi_reactDom.arrow({ element: arrowRef })],
1909
+ whileElementsMounted: floatingUi_dom.autoUpdate
1910
+ });
1911
+ const hover = useHover(context);
1912
+ const focus = useFocus(context);
1913
+ const dismiss = useDismiss(context);
1914
+ const role = useRole(context);
1915
+ const { getReferenceProps, getFloatingProps } = useInteractions([hover, focus, dismiss, role]);
1916
+ const mergedClass = tailwindMerge.twMerge(
1917
+ clsx("bg-content1 font-normal text-sm rounded-md filter-(--filter-drop-shadow-small) flex justify-center items-center z-10 px-2.5 py-1 outline-none box-border subpixel-antialiased normal-case", className)
1918
+ );
1919
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1920
+ /* @__PURE__ */ jsxRuntime.jsx("div", { ref: refs.setReference, ...getReferenceProps(), children }),
1921
+ isOpen && /* @__PURE__ */ jsxRuntime.jsx(FloatingPortal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
1922
+ "div",
1923
+ {
1924
+ ref: refs.setFloating,
1925
+ style: floatingStyles,
1926
+ ...getFloatingProps(),
1927
+ className: mergedClass,
1928
+ children: [
1929
+ content,
1930
+ showArrow && /* @__PURE__ */ jsxRuntime.jsx(FloatingArrow, { ref: arrowRef, context, className: "text-content1", fill: "currentColor" })
1931
+ ]
1932
+ }
1933
+ ) })
1934
+ ] });
1935
+ };
1936
+ exports.Tooltip = Tooltip;
1937
+ //# sourceMappingURL=tooltip-CjmRm1rv.js.map