@dooherceg/tiptap-controlled-editor-with-table 0.0.7 → 0.0.9

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 (115) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/index.js +7 -0
  3. package/dist/assets/components/tiptap-node/blockquote-node/blockquote-node.css +1 -0
  4. package/dist/assets/components/tiptap-node/code-block-node/code-block-node.css +1 -0
  5. package/dist/assets/components/tiptap-node/heading-node/heading-node.css +1 -0
  6. package/dist/assets/components/tiptap-node/horizontal-rule-node/horizontal-rule-node.css +1 -0
  7. package/dist/assets/components/tiptap-node/image-node/image-node.css +1 -0
  8. package/dist/assets/components/tiptap-node/list-node/list-node.css +1 -0
  9. package/dist/assets/components/tiptap-node/paragraph-node/paragraph-node.css +1 -0
  10. package/dist/assets/components/tiptap-templates/simple/simple-editor.css +1 -0
  11. package/dist/assets/{badge.css → components/tiptap-ui-primitive/badge/badge-colors.css} +1 -1
  12. package/dist/assets/components/tiptap-ui-primitive/badge/badge-group.css +1 -0
  13. package/dist/assets/components/tiptap-ui-primitive/badge/badge.css +1 -0
  14. package/dist/assets/{button.css → components/tiptap-ui-primitive/button/button-colors.css} +1 -1
  15. package/dist/assets/components/tiptap-ui-primitive/button/button-group.css +1 -0
  16. package/dist/assets/components/tiptap-ui-primitive/button/button.css +1 -0
  17. package/dist/assets/styles/_keyframe-animations.css +1 -0
  18. package/dist/assets/styles/_variables.css +1 -0
  19. package/dist/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.js +6 -58
  20. package/dist/components/tiptap-node/image-upload-node/image-upload-node.js +4 -3
  21. package/dist/components/tiptap-templates/simple/simple-editor.d.ts +1 -3
  22. package/dist/components/tiptap-templates/simple/simple-editor.js +201 -1947
  23. package/dist/components/tiptap-ui/color-highlight-button/color-highlight-button.js +6 -5
  24. package/dist/components/tiptap-ui/color-highlight-button/use-color-highlight.js +1 -1
  25. package/dist/components/tiptap-ui/color-highlight-popover/color-highlight-popover.js +12 -12
  26. package/dist/components/tiptap-ui/image-upload-button/use-image-upload.js +16 -16
  27. package/dist/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.js +3 -3
  28. package/dist/components/tiptap-ui-primitive/badge/badge.js +19 -16
  29. package/dist/components/tiptap-ui-primitive/button/button.js +18 -15
  30. package/dist/components/tiptap-ui-primitive/card/card.js +13 -12
  31. package/dist/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.js +39 -1012
  32. package/dist/components/tiptap-ui-primitive/input/input.js +7 -6
  33. package/dist/components/tiptap-ui-primitive/popover/popover.js +24 -233
  34. package/dist/components/tiptap-ui-primitive/separator/separator.js +9 -8
  35. package/dist/components/tiptap-ui-primitive/toolbar/toolbar.js +2 -1
  36. package/dist/components/tiptap-ui-primitive/tooltip/tooltip.js +84 -1330
  37. package/dist/hooks/use-throttled-callback.js +13 -108
  38. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +527 -0
  39. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +402 -0
  40. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.js +932 -0
  41. package/dist/node_modules/@floating-ui/react/dist/floating-ui.react.utils.js +185 -0
  42. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +208 -0
  43. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  44. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -0
  45. package/dist/node_modules/@radix-ui/primitive/dist/index.js +9 -0
  46. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
  47. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
  48. package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +29 -0
  49. package/dist/node_modules/@radix-ui/react-context/dist/index.js +53 -0
  50. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
  51. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +127 -0
  52. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +221 -0
  53. package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +17 -0
  54. package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +136 -0
  55. package/dist/node_modules/@radix-ui/react-id/dist/index.js +13 -0
  56. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +636 -0
  57. package/dist/node_modules/@radix-ui/react-popover/dist/index.js +239 -0
  58. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +219 -0
  59. package/dist/node_modules/@radix-ui/react-portal/dist/index.js +15 -0
  60. package/dist/node_modules/@radix-ui/react-presence/dist/index.js +70 -0
  61. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +36 -0
  62. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
  63. package/dist/node_modules/@radix-ui/react-slot/dist/index.js +49 -0
  64. package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +10 -0
  65. package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +52 -0
  66. package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +14 -0
  67. package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +6 -0
  68. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
  69. package/dist/node_modules/@tiptap/extension-highlight/dist/index.js +84 -0
  70. package/dist/node_modules/@tiptap/extension-horizontal-rule/dist/index.js +57 -0
  71. package/dist/node_modules/@tiptap/extension-image/dist/index.js +128 -0
  72. package/dist/node_modules/@tiptap/extension-list/dist/index.js +713 -0
  73. package/dist/node_modules/@tiptap/extension-subscript/dist/index.js +40 -0
  74. package/dist/node_modules/@tiptap/extension-superscript/dist/index.js +40 -0
  75. package/dist/node_modules/@tiptap/extension-table/dist/index.js +380 -0
  76. package/dist/node_modules/@tiptap/extension-text-align/dist/index.js +46 -0
  77. package/dist/node_modules/@tiptap/extension-typography/dist/index.js +125 -0
  78. package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
  79. package/dist/node_modules/aria-hidden/dist/es2015/index.js +52 -0
  80. package/dist/node_modules/get-nonce/dist/es2015/index.js +7 -0
  81. package/dist/node_modules/lodash.throttle/index.js +95 -0
  82. package/dist/{index-Bqw9S4qP.js → node_modules/react-hotkeys-hook/packages/react-hotkeys-hook/dist/index.js} +57 -55
  83. package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +11 -0
  84. package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +112 -0
  85. package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +31 -0
  86. package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +16 -0
  87. package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +68 -0
  88. package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
  89. package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
  90. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +71 -0
  91. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +7 -0
  92. package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +25 -0
  93. package/dist/node_modules/react-style-singleton/dist/es2015/component.js +11 -0
  94. package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +15 -0
  95. package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +30 -0
  96. package/dist/node_modules/tabbable/dist/index.esm.js +197 -0
  97. package/dist/node_modules/tslib/tslib.es6.js +27 -0
  98. package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +6 -0
  99. package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +26 -0
  100. package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +25 -0
  101. package/dist/node_modules/use-sidecar/dist/es2015/exports.js +18 -0
  102. package/dist/node_modules/use-sidecar/dist/es2015/medium.js +67 -0
  103. package/package.json +1 -1
  104. package/dist/Combination-CO0ZtURs.js +0 -1333
  105. package/dist/assets/simple-editor.css +0 -1
  106. package/dist/floating-ui.react-dom-DgOuULHo.js +0 -1334
  107. /package/dist/assets/{image-upload-node.css → components/tiptap-node/image-upload-node/image-upload-node.css} +0 -0
  108. /package/dist/assets/{color-highlight-button.css → components/tiptap-ui/color-highlight-button/color-highlight-button.css} +0 -0
  109. /package/dist/assets/{card.css → components/tiptap-ui-primitive/card/card.css} +0 -0
  110. /package/dist/assets/{dropdown-menu.css → components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.css} +0 -0
  111. /package/dist/assets/{input.css → components/tiptap-ui-primitive/input/input.css} +0 -0
  112. /package/dist/assets/{popover.css → components/tiptap-ui-primitive/popover/popover.css} +0 -0
  113. /package/dist/assets/{separator.css → components/tiptap-ui-primitive/separator/separator.css} +0 -0
  114. /package/dist/assets/{toolbar.css → components/tiptap-ui-primitive/toolbar/toolbar.css} +0 -0
  115. /package/dist/assets/{tooltip.css → components/tiptap-ui-primitive/tooltip/tooltip.css} +0 -0
@@ -1,1374 +1,128 @@
1
- import { jsxs as ot, jsx as K } from "react/jsx-runtime";
2
- import * as a from "react";
3
- import { useLayoutEffect as st, createContext as it, forwardRef as _e, isValidElement as xe, version as ut, cloneElement as at, useContext as ct, useState as lt, useMemo as ft } from "react";
4
- import { i as dt, a as Re, b as vt, u as mt, c as A, g as pt, d as se, e as gt, f as ie, h as bt, j as ht, o as Rt, k as Et, s as yt, l as Ct } from "../../../floating-ui.react-dom-DgOuULHo.js";
5
- import * as xt from "react-dom";
6
- import '../../../assets/tooltip.css';var wt = ["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])"], ve = /* @__PURE__ */ wt.join(","), Be = typeof Element > "u", z = Be ? function() {
7
- } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector, re = !Be && Element.prototype.getRootNode ? function(t) {
8
- var e;
9
- return t == null || (e = t.getRootNode) === null || e === void 0 ? void 0 : e.call(t);
10
- } : function(t) {
11
- return t?.ownerDocument;
12
- }, Q = function(e, n) {
13
- var r;
14
- n === void 0 && (n = !0);
15
- var o = e == null || (r = e.getAttribute) === null || r === void 0 ? void 0 : r.call(e, "inert"), i = o === "" || o === "true", s = i || n && e && Q(e.parentNode);
16
- return s;
17
- }, Tt = function(e) {
18
- var n, r = e == null || (n = e.getAttribute) === null || n === void 0 ? void 0 : n.call(e, "contenteditable");
19
- return r === "" || r === "true";
20
- }, St = function(e, n, r) {
21
- if (Q(e))
22
- return [];
23
- var o = Array.prototype.slice.apply(e.querySelectorAll(ve));
24
- return n && z.call(e, ve) && o.unshift(e), o = o.filter(r), o;
25
- }, me = function(e, n, r) {
26
- for (var o = [], i = Array.from(e); i.length; ) {
27
- var s = i.shift();
28
- if (!Q(s, !1))
29
- if (s.tagName === "SLOT") {
30
- var u = s.assignedElements(), c = u.length ? u : s.children, l = me(c, !0, r);
31
- r.flatten ? o.push.apply(o, l) : o.push({
32
- scopeParent: s,
33
- candidates: l
34
- });
35
- } else {
36
- var v = z.call(s, ve);
37
- v && r.filter(s) && (n || !e.includes(s)) && o.push(s);
38
- var p = s.shadowRoot || // check for an undisclosed shadow
39
- typeof r.getShadowRoot == "function" && r.getShadowRoot(s), h = !Q(p, !1) && (!r.shadowRootFilter || r.shadowRootFilter(s));
40
- if (p && h) {
41
- var f = me(p === !0 ? s.children : p.children, !0, r);
42
- r.flatten ? o.push.apply(o, f) : o.push({
43
- scopeParent: s,
44
- candidates: f
45
- });
46
- } else
47
- i.unshift.apply(i, s.children);
48
- }
49
- }
50
- return o;
51
- }, Ke = function(e) {
52
- return !isNaN(parseInt(e.getAttribute("tabindex"), 10));
53
- }, Ve = function(e) {
54
- if (!e)
55
- throw new Error("No node provided");
56
- return e.tabIndex < 0 && (/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName) || Tt(e)) && !Ke(e) ? 0 : e.tabIndex;
57
- }, It = function(e, n) {
58
- var r = Ve(e);
59
- return r < 0 && n && !Ke(e) ? 0 : r;
60
- }, Pt = function(e, n) {
61
- return e.tabIndex === n.tabIndex ? e.documentOrder - n.documentOrder : e.tabIndex - n.tabIndex;
62
- }, $e = function(e) {
63
- return e.tagName === "INPUT";
64
- }, Mt = function(e) {
65
- return $e(e) && e.type === "hidden";
66
- }, Lt = function(e) {
67
- var n = e.tagName === "DETAILS" && Array.prototype.slice.apply(e.children).some(function(r) {
68
- return r.tagName === "SUMMARY";
69
- });
70
- return n;
71
- }, Ot = function(e, n) {
72
- for (var r = 0; r < e.length; r++)
73
- if (e[r].checked && e[r].form === n)
74
- return e[r];
75
- }, At = function(e) {
76
- if (!e.name)
77
- return !0;
78
- var n = e.form || re(e), r = function(u) {
79
- return n.querySelectorAll('input[type="radio"][name="' + u + '"]');
80
- }, o;
81
- if (typeof window < "u" && typeof window.CSS < "u" && typeof window.CSS.escape == "function")
82
- o = r(window.CSS.escape(e.name));
83
- else
84
- try {
85
- o = r(e.name);
86
- } catch (s) {
87
- return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", s.message), !1;
88
- }
89
- var i = Ot(o, e.form);
90
- return !i || i === e;
91
- }, Dt = function(e) {
92
- return $e(e) && e.type === "radio";
93
- }, Nt = function(e) {
94
- return Dt(e) && !At(e);
95
- }, Ft = function(e) {
96
- var n, r = e && re(e), o = (n = r) === null || n === void 0 ? void 0 : n.host, i = !1;
97
- if (r && r !== e) {
98
- var s, u, c;
99
- for (i = !!((s = o) !== null && s !== void 0 && (u = s.ownerDocument) !== null && u !== void 0 && u.contains(o) || e != null && (c = e.ownerDocument) !== null && c !== void 0 && c.contains(e)); !i && o; ) {
100
- var l, v, p;
101
- r = re(o), o = (l = r) === null || l === void 0 ? void 0 : l.host, i = !!((v = o) !== null && v !== void 0 && (p = v.ownerDocument) !== null && p !== void 0 && p.contains(o));
102
- }
103
- }
104
- return i;
105
- }, we = function(e) {
106
- var n = e.getBoundingClientRect(), r = n.width, o = n.height;
107
- return r === 0 && o === 0;
108
- }, kt = function(e, n) {
109
- var r = n.displayCheck, o = n.getShadowRoot;
110
- if (r === "full-native" && "checkVisibility" in e) {
111
- var i = e.checkVisibility({
112
- // Checking opacity might be desirable for some use cases, but natively,
113
- // opacity zero elements _are_ focusable and tabbable.
114
- checkOpacity: !1,
115
- opacityProperty: !1,
116
- contentVisibilityAuto: !0,
117
- visibilityProperty: !0,
118
- // This is an alias for `visibilityProperty`. Contemporary browsers
119
- // support both. However, this alias has wider browser support (Chrome
120
- // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so
121
- // we include it anyway.
122
- checkVisibilityCSS: !0
123
- });
124
- return !i;
125
- }
126
- if (getComputedStyle(e).visibility === "hidden")
127
- return !0;
128
- var s = z.call(e, "details>summary:first-of-type"), u = s ? e.parentElement : e;
129
- if (z.call(u, "details:not([open]) *"))
130
- return !0;
131
- if (!r || r === "full" || // full-native can run this branch when it falls through in case
132
- // Element#checkVisibility is unsupported
133
- r === "full-native" || r === "legacy-full") {
134
- if (typeof o == "function") {
135
- for (var c = e; e; ) {
136
- var l = e.parentElement, v = re(e);
137
- if (l && !l.shadowRoot && o(l) === !0)
138
- return we(e);
139
- e.assignedSlot ? e = e.assignedSlot : !l && v !== e.ownerDocument ? e = v.host : e = l;
140
- }
141
- e = c;
142
- }
143
- if (Ft(e))
144
- return !e.getClientRects().length;
145
- if (r !== "legacy-full")
146
- return !0;
147
- } else if (r === "non-zero-area")
148
- return we(e);
149
- return !1;
150
- }, _t = function(e) {
151
- if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))
152
- for (var n = e.parentElement; n; ) {
153
- if (n.tagName === "FIELDSET" && n.disabled) {
154
- for (var r = 0; r < n.children.length; r++) {
155
- var o = n.children.item(r);
156
- if (o.tagName === "LEGEND")
157
- return z.call(n, "fieldset[disabled] *") ? !0 : !o.contains(e);
158
- }
159
- return !0;
160
- }
161
- n = n.parentElement;
162
- }
163
- return !1;
164
- }, Bt = function(e, n) {
165
- return !(n.disabled || // we must do an inert look up to filter out any elements inside an inert ancestor
166
- // because we're limited in the type of selectors we can use in JSDom (see related
167
- // note related to `candidateSelectors`)
168
- Q(n) || Mt(n) || kt(n, e) || // For a details element with a summary, the summary element gets the focus
169
- Lt(n) || _t(n));
170
- }, Te = function(e, n) {
171
- return !(Nt(n) || Ve(n) < 0 || !Bt(e, n));
172
- }, Kt = function(e) {
173
- var n = parseInt(e.getAttribute("tabindex"), 10);
174
- return !!(isNaN(n) || n >= 0);
175
- }, Ue = function(e) {
176
- var n = [], r = [];
177
- return e.forEach(function(o, i) {
178
- var s = !!o.scopeParent, u = s ? o.scopeParent : o, c = It(u, s), l = s ? Ue(o.candidates) : u;
179
- c === 0 ? s ? n.push.apply(n, l) : n.push(u) : r.push({
180
- documentOrder: i,
181
- tabIndex: c,
182
- item: o,
183
- isScope: s,
184
- content: l
185
- });
186
- }), r.sort(Pt).reduce(function(o, i) {
187
- return i.isScope ? o.push.apply(o, i.content) : o.push(i.content), o;
188
- }, []).concat(n);
189
- }, We = function(e, n) {
190
- n = n || {};
191
- var r;
192
- return n.getShadowRoot ? r = me([e], n.includeContainer, {
193
- filter: Te.bind(null, n),
194
- flatten: !1,
195
- getShadowRoot: n.getShadowRoot,
196
- shadowRootFilter: Kt
197
- }) : r = St(e, n.includeContainer, Te.bind(null, n)), Ue(r);
198
- };
199
- function Vt() {
200
- const t = navigator.userAgentData;
201
- return t != null && t.platform ? t.platform : navigator.platform;
202
- }
203
- function $t() {
204
- const t = navigator.userAgentData;
205
- return t && Array.isArray(t.brands) ? t.brands.map((e) => {
206
- let {
207
- brand: n,
208
- version: r
209
- } = e;
210
- return n + "/" + r;
211
- }).join(" ") : navigator.userAgent;
212
- }
213
- function Ye() {
214
- return /apple/i.test(navigator.vendor);
215
- }
216
- function Ut() {
217
- return Vt().toLowerCase().startsWith("mac") && !navigator.maxTouchPoints;
218
- }
219
- function Wt() {
220
- return $t().includes("jsdom/");
221
- }
222
- const Se = "data-floating-ui-focusable", Yt = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
223
- function pe(t) {
224
- let e = t.activeElement;
225
- for (; ((n = e) == null || (n = n.shadowRoot) == null ? void 0 : n.activeElement) != null; ) {
226
- var n;
227
- e = e.shadowRoot.activeElement;
228
- }
229
- return e;
230
- }
231
- function Z(t, e) {
232
- if (!t || !e)
233
- return !1;
234
- const n = e.getRootNode == null ? void 0 : e.getRootNode();
235
- if (t.contains(e))
236
- return !0;
237
- if (n && dt(n)) {
238
- let r = e;
239
- for (; r; ) {
240
- if (t === r)
241
- return !0;
242
- r = r.parentNode || r.host;
243
- }
244
- }
245
- return !1;
246
- }
247
- function X(t) {
248
- return "composedPath" in t ? t.composedPath()[0] : t.target;
249
- }
250
- function ue(t, e) {
251
- if (e == null)
252
- return !1;
253
- if ("composedPath" in t)
254
- return t.composedPath().includes(e);
255
- const n = t;
256
- return n.target != null && e.contains(n.target);
257
- }
258
- function Ht(t) {
259
- return t.matches("html,body");
260
- }
261
- function W(t) {
262
- return t?.ownerDocument || document;
263
- }
264
- function jt(t) {
265
- return Re(t) && t.matches(Yt);
266
- }
267
- function qt(t) {
268
- if (!t || Wt()) return !0;
269
- try {
270
- return t.matches(":focus-visible");
271
- } catch {
272
- return !0;
273
- }
274
- }
275
- function Gt(t) {
276
- return t ? t.hasAttribute(Se) ? t : t.querySelector("[" + Se + "]") || t : null;
277
- }
278
- function ne(t, e, n) {
279
- return n === void 0 && (n = !0), t.filter((o) => {
280
- var i;
281
- return o.parentId === e && (!n || ((i = o.context) == null ? void 0 : i.open));
282
- }).flatMap((o) => [o, ...ne(t, o.id, n)]);
283
- }
284
- function Xt(t) {
285
- return "nativeEvent" in t;
286
- }
287
- function ge(t, e) {
288
- const n = ["mouse", "pen"];
289
- return n.push("", void 0), n.includes(t);
290
- }
291
- var Zt = typeof document < "u", Jt = function() {
292
- }, V = Zt ? st : Jt;
293
- const zt = {
294
- ...a
295
- };
296
- function te(t) {
297
- const e = a.useRef(t);
298
- return V(() => {
299
- e.current = t;
300
- }), e;
301
- }
302
- const Qt = zt.useInsertionEffect, en = Qt || ((t) => t());
303
- function U(t) {
304
- const e = a.useRef(() => {
305
- if (process.env.NODE_ENV !== "production")
306
- throw new Error("Cannot call an event handler while rendering.");
307
- });
308
- return en(() => {
309
- e.current = t;
310
- }), a.useCallback(function() {
311
- for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++)
312
- r[o] = arguments[o];
313
- return e.current == null ? void 0 : e.current(...r);
314
- }, []);
315
- }
316
- const He = () => ({
317
- getShadowRoot: !0,
318
- displayCheck: (
319
- // JSDOM does not support the `tabbable` library. To solve this we can
320
- // check if `ResizeObserver` is a real function (not polyfilled), which
321
- // determines if the current environment is JSDOM-like.
322
- typeof ResizeObserver == "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none"
323
- )
324
- });
325
- function je(t, e) {
326
- const n = We(t, He()), r = n.length;
327
- if (r === 0) return;
328
- const o = pe(W(t)), i = n.indexOf(o), s = i === -1 ? e === 1 ? 0 : r - 1 : i + e;
329
- return n[s];
330
- }
331
- function tn(t) {
332
- return je(W(t).body, 1) || t;
333
- }
334
- function nn(t) {
335
- return je(W(t).body, -1) || t;
336
- }
337
- function ae(t, e) {
338
- const n = e || t.currentTarget, r = t.relatedTarget;
339
- return !r || !Z(n, r);
340
- }
341
- function rn(t) {
342
- We(t, He()).forEach((n) => {
343
- n.dataset.tabindex = n.getAttribute("tabindex") || "", n.setAttribute("tabindex", "-1");
344
- });
345
- }
346
- function Ie(t) {
347
- t.querySelectorAll("[data-tabindex]").forEach((n) => {
348
- const r = n.dataset.tabindex;
349
- delete n.dataset.tabindex, r ? n.setAttribute("tabindex", r) : n.removeAttribute("tabindex");
350
- });
351
- }
352
- function qe(t) {
353
- const e = a.useRef(void 0), n = a.useCallback((r) => {
354
- const o = t.map((i) => {
355
- if (i != null) {
356
- if (typeof i == "function") {
357
- const s = i, u = s(r);
358
- return typeof u == "function" ? u : () => {
359
- s(null);
360
- };
361
- }
362
- return i.current = r, () => {
363
- i.current = null;
364
- };
365
- }
366
- });
367
- return () => {
368
- o.forEach((i) => i?.());
369
- };
370
- }, t);
371
- return a.useMemo(() => t.every((r) => r == null) ? null : (r) => {
372
- e.current && (e.current(), e.current = void 0), r != null && (e.current = n(r));
373
- }, t);
374
- }
375
- const on = "data-floating-ui-focusable", Pe = "active", Me = "selected", sn = {
376
- ...a
377
- };
378
- let Le = !1, un = 0;
379
- const Oe = () => (
380
- // Ensure the id is unique with multiple independent versions of Floating UI
381
- // on <React 18
382
- "floating-ui-" + Math.random().toString(36).slice(2, 6) + un++
383
- );
384
- function an() {
385
- const [t, e] = a.useState(() => Le ? Oe() : void 0);
386
- return V(() => {
387
- t == null && e(Oe());
388
- }, []), a.useEffect(() => {
389
- Le = !0;
390
- }, []), t;
391
- }
392
- const cn = sn.useId, Ee = cn || an;
393
- let be;
394
- process.env.NODE_ENV !== "production" && (be = /* @__PURE__ */ new Set());
395
- function ln() {
396
- for (var t, e = arguments.length, n = new Array(e), r = 0; r < e; r++)
397
- n[r] = arguments[r];
398
- const o = "Floating UI: " + n.join(" ");
399
- if (!((t = be) != null && t.has(o))) {
400
- var i;
401
- (i = be) == null || i.add(o), console.error(o);
402
- }
403
- }
404
- function fn() {
405
- const t = /* @__PURE__ */ new Map();
406
- return {
407
- emit(e, n) {
408
- var r;
409
- (r = t.get(e)) == null || r.forEach((o) => o(n));
410
- },
411
- on(e, n) {
412
- t.has(e) || t.set(e, /* @__PURE__ */ new Set()), t.get(e).add(n);
413
- },
414
- off(e, n) {
415
- var r;
416
- (r = t.get(e)) == null || r.delete(n);
417
- }
418
- };
419
- }
420
- const dn = /* @__PURE__ */ a.createContext(null), vn = /* @__PURE__ */ a.createContext(null), ye = () => {
421
- var t;
422
- return ((t = a.useContext(dn)) == null ? void 0 : t.id) || null;
423
- }, Ce = () => a.useContext(vn);
424
- function ee(t) {
425
- return "data-floating-ui-" + t;
426
- }
427
- function k(t) {
428
- t.current !== -1 && (clearTimeout(t.current), t.current = -1);
429
- }
430
- const Ae = /* @__PURE__ */ ee("safe-polygon");
431
- function ce(t, e, n) {
432
- if (n && !ge(n))
433
- return 0;
434
- if (typeof t == "number")
435
- return t;
436
- if (typeof t == "function") {
437
- const r = t();
438
- return typeof r == "number" ? r : r?.[e];
439
- }
440
- return t?.[e];
441
- }
442
- function le(t) {
443
- return typeof t == "function" ? t() : t;
444
- }
445
- function mn(t, e) {
446
- e === void 0 && (e = {});
447
- const {
448
- open: n,
449
- onOpenChange: r,
450
- dataRef: o,
451
- events: i,
452
- elements: s
453
- } = t, {
454
- enabled: u = !0,
455
- delay: c = 0,
456
- handleClose: l = null,
457
- mouseOnly: v = !1,
458
- restMs: p = 0,
459
- move: h = !0
460
- } = e, f = Ce(), R = ye(), m = te(l), E = te(c), T = te(n), y = te(p), x = a.useRef(), P = a.useRef(-1), N = a.useRef(), _ = a.useRef(-1), q = a.useRef(!0), F = a.useRef(!1), G = a.useRef(() => {
461
- }), $ = a.useRef(!1), H = U(() => {
462
- var g;
463
- const d = (g = o.current.openEvent) == null ? void 0 : g.type;
464
- return d?.includes("mouse") && d !== "mousedown";
465
- });
466
- a.useEffect(() => {
467
- if (!u) return;
468
- function g(d) {
469
- let {
470
- open: C
471
- } = d;
472
- C || (k(P), k(_), q.current = !0, $.current = !1);
473
- }
474
- return i.on("openchange", g), () => {
475
- i.off("openchange", g);
476
- };
477
- }, [u, i]), a.useEffect(() => {
478
- if (!u || !m.current || !n) return;
479
- function g(C) {
480
- H() && r(!1, C, "hover");
481
- }
482
- const d = W(s.floating).documentElement;
483
- return d.addEventListener("mouseleave", g), () => {
484
- d.removeEventListener("mouseleave", g);
485
- };
486
- }, [s.floating, n, r, u, m, H]);
487
- const j = a.useCallback(function(g, d, C) {
488
- d === void 0 && (d = !0), C === void 0 && (C = "hover");
489
- const S = ce(E.current, "close", x.current);
490
- S && !N.current ? (k(P), P.current = window.setTimeout(() => r(!1, g, C), S)) : d && (k(P), r(!1, g, C));
491
- }, [E, r]), B = U(() => {
492
- G.current(), N.current = void 0;
493
- }), b = U(() => {
494
- if (F.current) {
495
- const g = W(s.floating).body;
496
- g.style.pointerEvents = "", g.removeAttribute(Ae), F.current = !1;
497
- }
498
- }), I = U(() => o.current.openEvent ? ["click", "mousedown"].includes(o.current.openEvent.type) : !1);
499
- a.useEffect(() => {
500
- if (!u) return;
501
- function g(w) {
502
- if (k(P), q.current = !1, v && !ge(x.current) || le(y.current) > 0 && !ce(E.current, "open"))
503
- return;
504
- const M = ce(E.current, "open", x.current);
505
- M ? P.current = window.setTimeout(() => {
506
- T.current || r(!0, w, "hover");
507
- }, M) : n || r(!0, w, "hover");
508
- }
509
- function d(w) {
510
- if (I()) {
511
- b();
512
- return;
513
- }
514
- G.current();
515
- const M = W(s.floating);
516
- if (k(_), $.current = !1, m.current && o.current.floatingContext) {
517
- n || k(P), N.current = m.current({
518
- ...o.current.floatingContext,
519
- tree: f,
520
- x: w.clientX,
521
- y: w.clientY,
522
- onClose() {
523
- b(), B(), I() || j(w, !0, "safe-polygon");
524
- }
525
- });
526
- const L = N.current;
527
- M.addEventListener("mousemove", L), G.current = () => {
528
- M.removeEventListener("mousemove", L);
529
- };
530
- return;
531
- }
532
- (x.current === "touch" ? !Z(s.floating, w.relatedTarget) : !0) && j(w);
533
- }
534
- function C(w) {
535
- I() || o.current.floatingContext && (m.current == null || m.current({
536
- ...o.current.floatingContext,
537
- tree: f,
538
- x: w.clientX,
539
- y: w.clientY,
540
- onClose() {
541
- b(), B(), I() || j(w);
542
- }
543
- })(w));
544
- }
545
- function S() {
546
- k(P);
547
- }
548
- function D(w) {
549
- I() || j(w, !1);
550
- }
551
- if (A(s.domReference)) {
552
- const w = s.domReference, M = s.floating;
553
- return n && w.addEventListener("mouseleave", C), h && w.addEventListener("mousemove", g, {
554
- once: !0
555
- }), w.addEventListener("mouseenter", g), w.addEventListener("mouseleave", d), M && (M.addEventListener("mouseleave", C), M.addEventListener("mouseenter", S), M.addEventListener("mouseleave", D)), () => {
556
- n && w.removeEventListener("mouseleave", C), h && w.removeEventListener("mousemove", g), w.removeEventListener("mouseenter", g), w.removeEventListener("mouseleave", d), M && (M.removeEventListener("mouseleave", C), M.removeEventListener("mouseenter", S), M.removeEventListener("mouseleave", D));
557
- };
558
- }
559
- }, [s, u, t, v, h, j, B, b, r, n, T, f, E, m, o, I, y]), V(() => {
560
- var g;
561
- if (u && n && (g = m.current) != null && (g = g.__options) != null && g.blockPointerEvents && H()) {
562
- F.current = !0;
563
- const C = s.floating;
564
- if (A(s.domReference) && C) {
565
- var d;
566
- const S = W(s.floating).body;
567
- S.setAttribute(Ae, "");
568
- const D = s.domReference, w = f == null || (d = f.nodesRef.current.find((M) => M.id === R)) == null || (d = d.context) == null ? void 0 : d.elements.floating;
569
- return w && (w.style.pointerEvents = ""), S.style.pointerEvents = "none", D.style.pointerEvents = "auto", C.style.pointerEvents = "auto", () => {
570
- S.style.pointerEvents = "", D.style.pointerEvents = "", C.style.pointerEvents = "";
571
- };
572
- }
573
- }
574
- }, [u, n, R, s, f, m, H]), V(() => {
575
- n || (x.current = void 0, $.current = !1, B(), b());
576
- }, [n, B, b]), a.useEffect(() => () => {
577
- B(), k(P), k(_), b();
578
- }, [u, s.domReference, B, b]);
579
- const O = a.useMemo(() => {
580
- function g(d) {
581
- x.current = d.pointerType;
582
- }
583
- return {
584
- onPointerDown: g,
585
- onPointerEnter: g,
586
- onMouseMove(d) {
587
- const {
588
- nativeEvent: C
589
- } = d;
590
- function S() {
591
- !q.current && !T.current && r(!0, C, "hover");
592
- }
593
- v && !ge(x.current) || n || le(y.current) === 0 || $.current && d.movementX ** 2 + d.movementY ** 2 < 2 || (k(_), x.current === "touch" ? S() : ($.current = !0, _.current = window.setTimeout(S, le(y.current))));
594
- }
595
- };
596
- }, [v, r, n, T, y]);
597
- return a.useMemo(() => u ? {
598
- reference: O
599
- } : {}, [u, O]);
600
- }
601
- const De = () => {
602
- }, pn = /* @__PURE__ */ a.createContext({
603
- delay: 0,
604
- initialDelay: 0,
605
- timeoutMs: 0,
606
- currentId: null,
607
- setCurrentId: De,
608
- setState: De,
609
- isInstantPhase: !1
610
- });
611
- function gn(t) {
612
- const {
613
- children: e,
614
- delay: n,
615
- timeoutMs: r = 0
616
- } = t, [o, i] = a.useReducer((c, l) => ({
617
- ...c,
618
- ...l
619
- }), {
620
- delay: n,
621
- timeoutMs: r,
622
- initialDelay: n,
623
- currentId: null,
624
- isInstantPhase: !1
625
- }), s = a.useRef(null), u = a.useCallback((c) => {
626
- i({
627
- currentId: c
628
- });
629
- }, []);
630
- return V(() => {
631
- o.currentId ? s.current === null ? s.current = o.currentId : o.isInstantPhase || i({
632
- isInstantPhase: !0
633
- }) : (o.isInstantPhase && i({
634
- isInstantPhase: !1
635
- }), s.current = null);
636
- }, [o.currentId, o.isInstantPhase]), /* @__PURE__ */ K(pn.Provider, {
637
- value: a.useMemo(() => ({
638
- ...o,
639
- setState: i,
640
- setCurrentId: u
641
- }), [o, u]),
642
- children: e
643
- });
644
- }
645
- const Ge = {
646
- border: 0,
647
- clip: "rect(0 0 0 0)",
648
- height: "1px",
649
- margin: "-1px",
650
- overflow: "hidden",
651
- padding: 0,
652
- position: "fixed",
653
- whiteSpace: "nowrap",
654
- width: "1px",
655
- top: 0,
656
- left: 0
657
- }, Ne = /* @__PURE__ */ a.forwardRef(function(e, n) {
658
- const [r, o] = a.useState();
659
- V(() => {
660
- Ye() && o("button");
661
- }, []);
662
- const i = {
663
- ref: n,
664
- tabIndex: 0,
665
- // Role is only for VoiceOver
666
- role: r,
667
- "aria-hidden": r ? void 0 : !0,
668
- [ee("focus-guard")]: "",
669
- style: Ge
670
- };
671
- return /* @__PURE__ */ K("span", {
672
- ...e,
673
- ...i
674
- });
675
- }), Xe = /* @__PURE__ */ a.createContext(null), Fe = /* @__PURE__ */ ee("portal");
676
- function bn(t) {
677
- t === void 0 && (t = {});
678
- const {
679
- id: e,
680
- root: n
681
- } = t, r = Ee(), o = Rn(), [i, s] = a.useState(null), u = a.useRef(null);
682
- return V(() => () => {
683
- i?.remove(), queueMicrotask(() => {
684
- u.current = null;
685
- });
686
- }, [i]), V(() => {
687
- if (!r || u.current) return;
688
- const c = e ? document.getElementById(e) : null;
689
- if (!c) return;
690
- const l = document.createElement("div");
691
- l.id = r, l.setAttribute(Fe, ""), c.appendChild(l), u.current = l, s(l);
692
- }, [e, r]), V(() => {
693
- if (n === null || !r || u.current) return;
694
- let c = n || o?.portalNode;
695
- c && !vt(c) && (c = c.current), c = c || document.body;
696
- let l = null;
697
- e && (l = document.createElement("div"), l.id = e, c.appendChild(l));
698
- const v = document.createElement("div");
699
- v.id = r, v.setAttribute(Fe, ""), c = l || c, c.appendChild(v), u.current = v, s(v);
700
- }, [e, n, r, o]), i;
701
- }
702
- function hn(t) {
703
- const {
704
- children: e,
705
- id: n,
706
- root: r,
707
- preserveTabOrder: o = !0
708
- } = t, i = bn({
709
- id: n,
710
- root: r
711
- }), [s, u] = a.useState(null), c = a.useRef(null), l = a.useRef(null), v = a.useRef(null), p = a.useRef(null), h = s?.modal, f = s?.open, R = (
712
- // The FocusManager and therefore floating element are currently open/
713
- // rendered.
714
- !!s && // Guards are only for non-modal focus management.
715
- !s.modal && // Don't render if unmount is transitioning.
716
- s.open && o && !!(r || i)
717
- );
718
- return a.useEffect(() => {
719
- if (!i || !o || h)
720
- return;
721
- function m(E) {
722
- i && ae(E) && (E.type === "focusin" ? Ie : rn)(i);
723
- }
724
- return i.addEventListener("focusin", m, !0), i.addEventListener("focusout", m, !0), () => {
725
- i.removeEventListener("focusin", m, !0), i.removeEventListener("focusout", m, !0);
726
- };
727
- }, [i, o, h]), a.useEffect(() => {
728
- i && (f || Ie(i));
729
- }, [f, i]), /* @__PURE__ */ ot(Xe.Provider, {
730
- value: a.useMemo(() => ({
731
- preserveTabOrder: o,
732
- beforeOutsideRef: c,
733
- afterOutsideRef: l,
734
- beforeInsideRef: v,
735
- afterInsideRef: p,
736
- portalNode: i,
737
- setFocusManagerState: u
738
- }), [o, i]),
739
- children: [R && i && /* @__PURE__ */ K(Ne, {
740
- "data-type": "outside",
741
- ref: c,
742
- onFocus: (m) => {
743
- if (ae(m, i)) {
744
- var E;
745
- (E = v.current) == null || E.focus();
746
- } else {
747
- const T = s ? s.domReference : null, y = nn(T);
748
- y?.focus();
749
- }
750
- }
751
- }), R && i && /* @__PURE__ */ K("span", {
752
- "aria-owns": i.id,
753
- style: Ge
754
- }), i && /* @__PURE__ */ xt.createPortal(e, i), R && i && /* @__PURE__ */ K(Ne, {
755
- "data-type": "outside",
756
- ref: l,
757
- onFocus: (m) => {
758
- if (ae(m, i)) {
759
- var E;
760
- (E = p.current) == null || E.focus();
761
- } else {
762
- const T = s ? s.domReference : null, y = tn(T);
763
- y?.focus(), s?.closeOnFocusOut && s?.onOpenChange(!1, m.nativeEvent, "focus-out");
764
- }
765
- }
766
- })]
767
- });
768
- }
769
- const Rn = () => a.useContext(Xe), En = {
770
- pointerdown: "onPointerDown",
771
- mousedown: "onMouseDown",
772
- click: "onClick"
773
- }, yn = {
774
- pointerdown: "onPointerDownCapture",
775
- mousedown: "onMouseDownCapture",
776
- click: "onClickCapture"
777
- }, ke = (t) => {
778
- var e, n;
779
- return {
780
- escapeKey: typeof t == "boolean" ? t : (e = t?.escapeKey) != null ? e : !1,
781
- outsidePress: typeof t == "boolean" ? t : (n = t?.outsidePress) != null ? n : !0
782
- };
783
- };
784
- function Cn(t, e) {
785
- e === void 0 && (e = {});
786
- const {
787
- open: n,
788
- onOpenChange: r,
789
- elements: o,
790
- dataRef: i
791
- } = t, {
792
- enabled: s = !0,
793
- escapeKey: u = !0,
794
- outsidePress: c = !0,
795
- outsidePressEvent: l = "pointerdown",
796
- referencePress: v = !1,
797
- referencePressEvent: p = "pointerdown",
798
- ancestorScroll: h = !1,
799
- bubbles: f,
800
- capture: R
801
- } = e, m = Ce(), E = U(typeof c == "function" ? c : () => !1), T = typeof c == "function" ? E : c, y = a.useRef(!1), {
802
- escapeKey: x,
803
- outsidePress: P
804
- } = ke(f), {
805
- escapeKey: N,
806
- outsidePress: _
807
- } = ke(R), q = a.useRef(!1), F = U((b) => {
808
- var I;
809
- if (!n || !s || !u || b.key !== "Escape" || q.current)
810
- return;
811
- const O = (I = i.current.floatingContext) == null ? void 0 : I.nodeId, g = m ? ne(m.nodesRef.current, O) : [];
812
- if (!x && (b.stopPropagation(), g.length > 0)) {
813
- let d = !0;
814
- if (g.forEach((C) => {
815
- var S;
816
- if ((S = C.context) != null && S.open && !C.context.dataRef.current.__escapeKeyBubbles) {
817
- d = !1;
818
- return;
819
- }
820
- }), !d)
821
- return;
822
- }
823
- r(!1, Xt(b) ? b.nativeEvent : b, "escape-key");
824
- }), G = U((b) => {
825
- var I;
826
- const O = () => {
827
- var g;
828
- F(b), (g = X(b)) == null || g.removeEventListener("keydown", O);
829
- };
830
- (I = X(b)) == null || I.addEventListener("keydown", O);
831
- }), $ = U((b) => {
832
- var I;
833
- const O = i.current.insideReactTree;
834
- i.current.insideReactTree = !1;
835
- const g = y.current;
836
- if (y.current = !1, l === "click" && g || O || typeof T == "function" && !T(b))
837
- return;
838
- const d = X(b), C = "[" + ee("inert") + "]", S = W(o.floating).querySelectorAll(C);
839
- let D = A(d) ? d : null;
840
- for (; D && !ie(D); ) {
841
- const L = bt(D);
842
- if (ie(L) || !A(L))
843
- break;
844
- D = L;
845
- }
846
- if (S.length && A(d) && !Ht(d) && // Clicked on a direct ancestor (e.g. FloatingOverlay).
847
- !Z(d, o.floating) && // If the target root element contains none of the markers, then the
848
- // element was injected after the floating element rendered.
849
- Array.from(S).every((L) => !Z(D, L)))
850
- return;
851
- if (Re(d) && B) {
852
- const L = ie(d), Y = ht(d), J = /auto|scroll/, Je = L || J.test(Y.overflowX), ze = L || J.test(Y.overflowY), Qe = Je && d.clientWidth > 0 && d.scrollWidth > d.clientWidth, et = ze && d.clientHeight > 0 && d.scrollHeight > d.clientHeight, tt = Y.direction === "rtl", nt = et && (tt ? b.offsetX <= d.offsetWidth - d.clientWidth : b.offsetX > d.clientWidth), rt = Qe && b.offsetY > d.clientHeight;
853
- if (nt || rt)
854
- return;
855
- }
856
- const w = (I = i.current.floatingContext) == null ? void 0 : I.nodeId, M = m && ne(m.nodesRef.current, w).some((L) => {
857
- var Y;
858
- return ue(b, (Y = L.context) == null ? void 0 : Y.elements.floating);
859
- });
860
- if (ue(b, o.floating) || ue(b, o.domReference) || M)
861
- return;
862
- const oe = m ? ne(m.nodesRef.current, w) : [];
863
- if (oe.length > 0) {
864
- let L = !0;
865
- if (oe.forEach((Y) => {
866
- var J;
867
- if ((J = Y.context) != null && J.open && !Y.context.dataRef.current.__outsidePressBubbles) {
868
- L = !1;
869
- return;
870
- }
871
- }), !L)
872
- return;
873
- }
874
- r(!1, b, "outside-press");
875
- }), H = U((b) => {
876
- var I;
877
- const O = () => {
878
- var g;
879
- $(b), (g = X(b)) == null || g.removeEventListener(l, O);
880
- };
881
- (I = X(b)) == null || I.addEventListener(l, O);
882
- });
883
- a.useEffect(() => {
884
- if (!n || !s)
885
- return;
886
- i.current.__escapeKeyBubbles = x, i.current.__outsidePressBubbles = P;
887
- let b = -1;
888
- function I(S) {
889
- r(!1, S, "ancestor-scroll");
890
- }
891
- function O() {
892
- window.clearTimeout(b), q.current = !0;
893
- }
894
- function g() {
895
- b = window.setTimeout(
896
- () => {
897
- q.current = !1;
898
- },
899
- // 0ms or 1ms don't work in Safari. 5ms appears to consistently work.
900
- // Only apply to WebKit for the test to remain 0ms.
901
- gt() ? 5 : 0
902
- );
903
- }
904
- const d = W(o.floating);
905
- u && (d.addEventListener("keydown", N ? G : F, N), d.addEventListener("compositionstart", O), d.addEventListener("compositionend", g)), T && d.addEventListener(l, _ ? H : $, _);
906
- let C = [];
907
- return h && (A(o.domReference) && (C = se(o.domReference)), A(o.floating) && (C = C.concat(se(o.floating))), !A(o.reference) && o.reference && o.reference.contextElement && (C = C.concat(se(o.reference.contextElement)))), C = C.filter((S) => {
908
- var D;
909
- return S !== ((D = d.defaultView) == null ? void 0 : D.visualViewport);
910
- }), C.forEach((S) => {
911
- S.addEventListener("scroll", I, {
912
- passive: !0
913
- });
914
- }), () => {
915
- u && (d.removeEventListener("keydown", N ? G : F, N), d.removeEventListener("compositionstart", O), d.removeEventListener("compositionend", g)), T && d.removeEventListener(l, _ ? H : $, _), C.forEach((S) => {
916
- S.removeEventListener("scroll", I);
917
- }), window.clearTimeout(b);
918
- };
919
- }, [i, o, u, T, l, n, r, h, s, x, P, F, N, G, $, _, H]), a.useEffect(() => {
920
- i.current.insideReactTree = !1;
921
- }, [i, T, l]);
922
- const j = a.useMemo(() => ({
923
- onKeyDown: F,
924
- ...v && {
925
- [En[p]]: (b) => {
926
- r(!1, b.nativeEvent, "reference-press");
927
- },
928
- ...p !== "click" && {
929
- onClick(b) {
930
- r(!1, b.nativeEvent, "reference-press");
931
- }
932
- }
933
- }
934
- }), [F, r, v, p]), B = a.useMemo(() => ({
935
- onKeyDown: F,
936
- onMouseDown() {
937
- y.current = !0;
938
- },
939
- onMouseUp() {
940
- y.current = !0;
941
- },
942
- [yn[l]]: () => {
943
- i.current.insideReactTree = !0;
944
- }
945
- }), [F, l, i]);
946
- return a.useMemo(() => s ? {
947
- reference: j,
948
- floating: B
949
- } : {}, [s, j, B]);
950
- }
951
- function xn(t) {
952
- const {
953
- open: e = !1,
954
- onOpenChange: n,
955
- elements: r
956
- } = t, o = Ee(), i = a.useRef({}), [s] = a.useState(() => fn()), u = ye() != null;
957
- if (process.env.NODE_ENV !== "production") {
958
- const f = r.reference;
959
- f && !A(f) && ln("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `refs.setPositionReference()`", "instead.");
960
- }
961
- const [c, l] = a.useState(r.reference), v = U((f, R, m) => {
962
- i.current.openEvent = f ? R : void 0, s.emit("openchange", {
963
- open: f,
964
- event: R,
965
- reason: m,
966
- nested: u
967
- }), n?.(f, R, m);
968
- }), p = a.useMemo(() => ({
969
- setPositionReference: l
970
- }), []), h = a.useMemo(() => ({
971
- reference: c || r.reference || null,
972
- floating: r.floating || null,
973
- domReference: r.reference
974
- }), [c, r.reference, r.floating]);
975
- return a.useMemo(() => ({
976
- dataRef: i,
977
- open: e,
978
- onOpenChange: v,
979
- elements: h,
980
- events: s,
981
- floatingId: o,
982
- refs: p
983
- }), [e, v, h, s, o, p]);
984
- }
985
- function wn(t) {
986
- t === void 0 && (t = {});
987
- const {
988
- nodeId: e
989
- } = t, n = xn({
990
- ...t,
991
- elements: {
992
- reference: null,
993
- floating: null,
994
- ...t.elements
995
- }
996
- }), r = t.rootContext || n, o = r.elements, [i, s] = a.useState(null), [u, c] = a.useState(null), v = o?.domReference || i, p = a.useRef(null), h = Ce();
997
- V(() => {
998
- v && (p.current = v);
999
- }, [v]);
1000
- const f = mt({
1001
- ...t,
1002
- elements: {
1003
- ...o,
1004
- ...u && {
1005
- reference: u
1006
- }
1007
- }
1008
- }), R = a.useCallback((x) => {
1009
- const P = A(x) ? {
1010
- getBoundingClientRect: () => x.getBoundingClientRect(),
1011
- getClientRects: () => x.getClientRects(),
1012
- contextElement: x
1013
- } : x;
1014
- c(P), f.refs.setReference(P);
1015
- }, [f.refs]), m = a.useCallback((x) => {
1016
- (A(x) || x === null) && (p.current = x, s(x)), (A(f.refs.reference.current) || f.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
1017
- // `null` to support `positionReference` + an unstable `reference`
1018
- // callback ref.
1019
- x !== null && !A(x)) && f.refs.setReference(x);
1020
- }, [f.refs]), E = a.useMemo(() => ({
1021
- ...f.refs,
1022
- setReference: m,
1023
- setPositionReference: R,
1024
- domReference: p
1025
- }), [f.refs, m, R]), T = a.useMemo(() => ({
1026
- ...f.elements,
1027
- domReference: v
1028
- }), [f.elements, v]), y = a.useMemo(() => ({
1029
- ...f,
1030
- ...r,
1031
- refs: E,
1032
- elements: T,
1033
- nodeId: e
1034
- }), [f, E, T, e, r]);
1035
- return V(() => {
1036
- r.dataRef.current.floatingContext = y;
1037
- const x = h?.nodesRef.current.find((P) => P.id === e);
1038
- x && (x.context = y);
1039
- }), a.useMemo(() => ({
1040
- ...f,
1041
- context: y,
1042
- refs: E,
1043
- elements: T
1044
- }), [f, E, T, y]);
1045
- }
1046
- function fe() {
1047
- return Ut() && Ye();
1048
- }
1049
- function Tn(t, e) {
1050
- e === void 0 && (e = {});
1051
- const {
1052
- open: n,
1053
- onOpenChange: r,
1054
- events: o,
1055
- dataRef: i,
1056
- elements: s
1057
- } = t, {
1058
- enabled: u = !0,
1059
- visibleOnly: c = !0
1060
- } = e, l = a.useRef(!1), v = a.useRef(-1), p = a.useRef(!0);
1061
- a.useEffect(() => {
1062
- if (!u) return;
1063
- const f = pt(s.domReference);
1064
- function R() {
1065
- !n && Re(s.domReference) && s.domReference === pe(W(s.domReference)) && (l.current = !0);
1066
- }
1067
- function m() {
1068
- p.current = !0;
1069
- }
1070
- function E() {
1071
- p.current = !1;
1072
- }
1073
- return f.addEventListener("blur", R), fe() && (f.addEventListener("keydown", m, !0), f.addEventListener("pointerdown", E, !0)), () => {
1074
- f.removeEventListener("blur", R), fe() && (f.removeEventListener("keydown", m, !0), f.removeEventListener("pointerdown", E, !0));
1075
- };
1076
- }, [s.domReference, n, u]), a.useEffect(() => {
1077
- if (!u) return;
1078
- function f(R) {
1079
- let {
1080
- reason: m
1081
- } = R;
1082
- (m === "reference-press" || m === "escape-key") && (l.current = !0);
1083
- }
1084
- return o.on("openchange", f), () => {
1085
- o.off("openchange", f);
1086
- };
1087
- }, [o, u]), a.useEffect(() => () => {
1088
- k(v);
1089
- }, []);
1090
- const h = a.useMemo(() => ({
1091
- onMouseLeave() {
1092
- l.current = !1;
1093
- },
1094
- onFocus(f) {
1095
- if (l.current) return;
1096
- const R = X(f.nativeEvent);
1097
- if (c && A(R)) {
1098
- if (fe() && !f.relatedTarget) {
1099
- if (!p.current && !jt(R))
1100
- return;
1101
- } else if (!qt(R))
1102
- return;
1103
- }
1104
- r(!0, f.nativeEvent, "focus");
1105
- },
1106
- onBlur(f) {
1107
- l.current = !1;
1108
- const R = f.relatedTarget, m = f.nativeEvent, E = A(R) && R.hasAttribute(ee("focus-guard")) && R.getAttribute("data-type") === "outside";
1109
- v.current = window.setTimeout(() => {
1110
- var T;
1111
- const y = pe(s.domReference ? s.domReference.ownerDocument : document);
1112
- !R && y === s.domReference || Z((T = i.current.floatingContext) == null ? void 0 : T.refs.floating.current, y) || Z(s.domReference, y) || E || r(!1, m, "focus");
1113
- });
1114
- }
1115
- }), [i, s.domReference, r, c]);
1116
- return a.useMemo(() => u ? {
1117
- reference: h
1118
- } : {}, [u, h]);
1119
- }
1120
- function de(t, e, n) {
1121
- const r = /* @__PURE__ */ new Map(), o = n === "item";
1122
- let i = t;
1123
- if (o && t) {
1124
- const {
1125
- [Pe]: s,
1126
- [Me]: u,
1127
- ...c
1128
- } = t;
1129
- i = c;
1130
- }
1131
- return {
1132
- ...n === "floating" && {
1133
- tabIndex: -1,
1134
- [on]: ""
1135
- },
1136
- ...i,
1137
- ...e.map((s) => {
1138
- const u = s ? s[n] : null;
1139
- return typeof u == "function" ? t ? u(t) : null : u;
1140
- }).concat(t).reduce((s, u) => (u && Object.entries(u).forEach((c) => {
1141
- let [l, v] = c;
1142
- if (!(o && [Pe, Me].includes(l)))
1143
- if (l.indexOf("on") === 0) {
1144
- if (r.has(l) || r.set(l, []), typeof v == "function") {
1145
- var p;
1146
- (p = r.get(l)) == null || p.push(v), s[l] = function() {
1147
- for (var h, f = arguments.length, R = new Array(f), m = 0; m < f; m++)
1148
- R[m] = arguments[m];
1149
- return (h = r.get(l)) == null ? void 0 : h.map((E) => E(...R)).find((E) => E !== void 0);
1150
- };
1151
- }
1152
- } else
1153
- s[l] = v;
1154
- }), s), {})
1155
- };
1156
- }
1157
- function Sn(t) {
1158
- t === void 0 && (t = []);
1159
- const e = t.map((u) => u?.reference), n = t.map((u) => u?.floating), r = t.map((u) => u?.item), o = a.useCallback(
1160
- (u) => de(u, t, "reference"),
1161
- // eslint-disable-next-line react-hooks/exhaustive-deps
1162
- e
1163
- ), i = a.useCallback(
1164
- (u) => de(u, t, "floating"),
1165
- // eslint-disable-next-line react-hooks/exhaustive-deps
1166
- n
1167
- ), s = a.useCallback(
1168
- (u) => de(u, t, "item"),
1169
- // eslint-disable-next-line react-hooks/exhaustive-deps
1170
- r
1171
- );
1172
- return a.useMemo(() => ({
1173
- getReferenceProps: o,
1174
- getFloatingProps: i,
1175
- getItemProps: s
1176
- }), [o, i, s]);
1177
- }
1178
- const In = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", !1]]);
1179
- function Pn(t, e) {
1180
- var n, r;
1181
- e === void 0 && (e = {});
1182
- const {
1183
- open: o,
1184
- elements: i,
1185
- floatingId: s
1186
- } = t, {
1187
- enabled: u = !0,
1188
- role: c = "dialog"
1189
- } = e, l = Ee(), v = ((n = i.domReference) == null ? void 0 : n.id) || l, p = a.useMemo(() => {
1190
- var y;
1191
- return ((y = Gt(i.floating)) == null ? void 0 : y.id) || s;
1192
- }, [i.floating, s]), h = (r = In.get(c)) != null ? r : c, R = ye() != null, m = a.useMemo(() => h === "tooltip" || c === "label" ? {
1193
- ["aria-" + (c === "label" ? "labelledby" : "describedby")]: o ? p : void 0
1194
- } : {
1195
- "aria-expanded": o ? "true" : "false",
1196
- "aria-haspopup": h === "alertdialog" ? "dialog" : h,
1197
- "aria-controls": o ? p : void 0,
1198
- ...h === "listbox" && {
1199
- role: "combobox"
1200
- },
1201
- ...h === "menu" && {
1202
- id: v
1203
- },
1204
- ...h === "menu" && R && {
1205
- role: "menuitem"
1206
- },
1207
- ...c === "select" && {
1208
- "aria-autocomplete": "none"
1209
- },
1210
- ...c === "combobox" && {
1211
- "aria-autocomplete": "list"
1212
- }
1213
- }, [h, p, R, o, v, c]), E = a.useMemo(() => {
1214
- const y = {
1215
- id: p,
1216
- ...h && {
1217
- role: h
1218
- }
1219
- };
1220
- return h === "tooltip" || c === "label" ? y : {
1221
- ...y,
1222
- ...h === "menu" && {
1223
- "aria-labelledby": v
1224
- }
1225
- };
1226
- }, [h, p, v, c]), T = a.useCallback((y) => {
1227
- let {
1228
- active: x,
1229
- selected: P
1230
- } = y;
1231
- const N = {
1232
- role: "option",
1233
- ...x && {
1234
- id: p + "-fui-option"
1235
- }
1236
- };
1237
- switch (c) {
1238
- case "select":
1239
- case "combobox":
1240
- return {
1241
- ...N,
1242
- "aria-selected": P
1243
- };
1244
- }
1245
- return {};
1246
- }, [p, c]);
1247
- return a.useMemo(() => u ? {
1248
- reference: m,
1249
- floating: E,
1250
- item: T
1251
- } : {}, [u, m, E, T]);
1252
- }
1253
- function Mn({
1254
- initialOpen: t = !1,
1255
- placement: e = "top",
1256
- open: n,
1257
- onOpenChange: r,
1258
- delay: o = 600,
1259
- closeDelay: i = 0
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { createContext as R, forwardRef as T, isValidElement as g, version as w, cloneElement as F, useContext as D, useState as M, useMemo as E } from "react";
3
+ import { useMergeRefs as x, FloatingPortal as N, FloatingDelayGroup as O, useFloating as A, useHover as S, useFocus as j, useDismiss as G, useRole as I, useInteractions as U } from "../../../node_modules/@floating-ui/react/dist/floating-ui.react.js";
4
+ import '../../../assets/components/tiptap-ui-primitive/tooltip/tooltip.css';/* empty css */
5
+ import { offset as h, flip as k, shift as H } from "../../../node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js";
6
+ import { autoUpdate as V } from "../../../node_modules/@floating-ui/dom/dist/floating-ui.dom.js";
7
+ function q({
8
+ initialOpen: o = !1,
9
+ placement: t = "top",
10
+ open: e,
11
+ onOpenChange: i,
12
+ delay: p = 600,
13
+ closeDelay: n = 0
1260
14
  } = {}) {
1261
- const [s, u] = lt(t), c = n ?? s, l = r ?? u, v = wn({
1262
- placement: e,
1263
- open: c,
15
+ const [u, s] = M(o), r = e ?? u, l = i ?? s, f = A({
16
+ placement: t,
17
+ open: r,
1264
18
  onOpenChange: l,
1265
- whileElementsMounted: Ct,
19
+ whileElementsMounted: V,
1266
20
  middleware: [
1267
- Rt(4),
1268
- Et({
1269
- crossAxis: e.includes("-"),
21
+ h(4),
22
+ k({
23
+ crossAxis: t.includes("-"),
1270
24
  fallbackAxisSideDirection: "start",
1271
25
  padding: 4
1272
26
  }),
1273
- yt({ padding: 4 })
27
+ H({ padding: 4 })
1274
28
  ]
1275
- }), p = v.context, h = mn(p, {
29
+ }), c = f.context, v = S(c, {
1276
30
  mouseOnly: !0,
1277
31
  move: !1,
1278
- restMs: o,
1279
- enabled: n == null,
32
+ restMs: p,
33
+ enabled: e == null,
1280
34
  delay: {
1281
- close: i
35
+ close: n
1282
36
  }
1283
- }), f = Tn(p, {
1284
- enabled: n == null
1285
- }), R = Cn(p), m = Pn(p, { role: "tooltip" }), E = Sn([h, f, R, m]);
1286
- return ft(
37
+ }), C = j(c, {
38
+ enabled: e == null
39
+ }), b = G(c), P = I(c, { role: "tooltip" }), m = U([v, C, b, P]);
40
+ return E(
1287
41
  () => ({
1288
- open: c,
42
+ open: r,
1289
43
  setOpen: l,
1290
- ...E,
1291
- ...v
44
+ ...m,
45
+ ...f
1292
46
  }),
1293
- [c, l, E, v]
47
+ [r, l, m, f]
1294
48
  );
1295
49
  }
1296
- const he = it(null);
1297
- function Ze() {
1298
- const t = ct(he);
1299
- if (t == null)
50
+ const d = R(null);
51
+ function y() {
52
+ const o = D(d);
53
+ if (o == null)
1300
54
  throw new Error("Tooltip components must be wrapped in <TooltipProvider />");
1301
- return t;
55
+ return o;
1302
56
  }
1303
- function Ln({ children: t, ...e }) {
1304
- const n = Mn(e);
1305
- return e.useDelayGroup ? /* @__PURE__ */ K(
1306
- gn,
57
+ function z({ children: o, ...t }) {
58
+ const e = q(t);
59
+ return t.useDelayGroup ? /* @__PURE__ */ a(
60
+ O,
1307
61
  {
1308
- delay: { open: e.delay ?? 0, close: e.closeDelay ?? 0 },
1309
- timeoutMs: e.timeout,
1310
- children: /* @__PURE__ */ K(he.Provider, { value: n, children: t })
62
+ delay: { open: t.delay ?? 0, close: t.closeDelay ?? 0 },
63
+ timeoutMs: t.timeout,
64
+ children: /* @__PURE__ */ a(d.Provider, { value: e, children: o })
1311
65
  }
1312
- ) : /* @__PURE__ */ K(he.Provider, { value: n, children: t });
66
+ ) : /* @__PURE__ */ a(d.Provider, { value: e, children: o });
1313
67
  }
1314
- const On = _e(
1315
- function({ children: e, asChild: n = !1, ...r }, o) {
1316
- const i = Ze(), s = xe(e) ? parseInt(ut, 10) >= 19 ? (
68
+ const B = T(
69
+ function({ children: t, asChild: e = !1, ...i }, p) {
70
+ const n = y(), u = g(t) ? parseInt(w, 10) >= 19 ? (
1317
71
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1318
- e.props.ref
72
+ t.props.ref
1319
73
  ) : (
1320
74
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1321
- e.ref
1322
- ) : void 0, u = qe([i.refs.setReference, o, s]);
1323
- if (n && xe(e)) {
1324
- const c = {
1325
- "data-tooltip-state": i.open ? "open" : "closed"
75
+ t.ref
76
+ ) : void 0, s = x([n.refs.setReference, p, u]);
77
+ if (e && g(t)) {
78
+ const r = {
79
+ "data-tooltip-state": n.open ? "open" : "closed"
1326
80
  };
1327
- return at(
1328
- e,
1329
- i.getReferenceProps({
1330
- ref: u,
1331
- ...r,
1332
- ...typeof e.props == "object" ? e.props : {},
1333
- ...c
81
+ return F(
82
+ t,
83
+ n.getReferenceProps({
84
+ ref: s,
85
+ ...i,
86
+ ...typeof t.props == "object" ? t.props : {},
87
+ ...r
1334
88
  })
1335
89
  );
1336
90
  }
1337
- return /* @__PURE__ */ K(
91
+ return /* @__PURE__ */ a(
1338
92
  "button",
1339
93
  {
1340
- ref: u,
1341
- "data-tooltip-state": i.open ? "open" : "closed",
1342
- ...i.getReferenceProps(r),
1343
- children: e
94
+ ref: s,
95
+ "data-tooltip-state": n.open ? "open" : "closed",
96
+ ...n.getReferenceProps(i),
97
+ children: t
1344
98
  }
1345
99
  );
1346
100
  }
1347
- ), An = _e(
1348
- function({ style: e, children: n, portal: r = !0, portalProps: o = {}, ...i }, s) {
1349
- const u = Ze(), c = qe([u.refs.setFloating, s]);
1350
- if (!u.open) return null;
1351
- const l = /* @__PURE__ */ K(
101
+ ), J = T(
102
+ function({ style: t, children: e, portal: i = !0, portalProps: p = {}, ...n }, u) {
103
+ const s = y(), r = x([s.refs.setFloating, u]);
104
+ if (!s.open) return null;
105
+ const l = /* @__PURE__ */ a(
1352
106
  "div",
1353
107
  {
1354
- ref: c,
108
+ ref: r,
1355
109
  style: {
1356
- ...u.floatingStyles,
1357
- ...e
110
+ ...s.floatingStyles,
111
+ ...t
1358
112
  },
1359
- ...u.getFloatingProps(i),
113
+ ...s.getFloatingProps(n),
1360
114
  className: "tiptap-tooltip",
1361
- children: n
115
+ children: e
1362
116
  }
1363
117
  );
1364
- return r ? /* @__PURE__ */ K(hn, { ...o, children: l }) : l;
118
+ return i ? /* @__PURE__ */ a(N, { ...p, children: l }) : l;
1365
119
  }
1366
120
  );
1367
- Ln.displayName = "Tooltip";
1368
- On.displayName = "TooltipTrigger";
1369
- An.displayName = "TooltipContent";
121
+ z.displayName = "Tooltip";
122
+ B.displayName = "TooltipTrigger";
123
+ J.displayName = "TooltipContent";
1370
124
  export {
1371
- Ln as Tooltip,
1372
- An as TooltipContent,
1373
- On as TooltipTrigger
125
+ z as Tooltip,
126
+ J as TooltipContent,
127
+ B as TooltipTrigger
1374
128
  };