reactjs-tiptap-editor 1.0.22 → 1.0.24

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 (159) hide show
  1. package/lib/{ActionMenuButton-BBDqKvKg.cjs → ActionMenuButton-B8NhVw5m.cjs} +1 -1
  2. package/lib/{ActionMenuButton-B1067mIC.js → ActionMenuButton-HYlhmRvw.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.js +4 -4
  5. package/lib/Blockquote.cjs +1 -1
  6. package/lib/Blockquote.js +2 -2
  7. package/lib/Bold.cjs +1 -1
  8. package/lib/Bold.js +2 -2
  9. package/lib/BulletList.cjs +1 -1
  10. package/lib/BulletList.js +2 -2
  11. package/lib/{Callout-lBlBlK_w.cjs → Callout-B-S2f0Qo.cjs} +1 -1
  12. package/lib/{Callout-V2mO6s2Y.js → Callout-CF7Y9yJ7.js} +4 -4
  13. package/lib/Callout.cjs +1 -1
  14. package/lib/Callout.js +4 -4
  15. package/lib/Clear.cjs +1 -1
  16. package/lib/Clear.js +2 -2
  17. package/lib/Code.cjs +1 -1
  18. package/lib/Code.js +6 -6
  19. package/lib/CodeBlock.cjs +1 -1
  20. package/lib/CodeBlock.js +27 -27
  21. package/lib/CodeView.cjs +1 -1
  22. package/lib/CodeView.js +2 -2
  23. package/lib/Color.cjs +1 -1
  24. package/lib/Color.js +3 -3
  25. package/lib/Column.cjs +1 -1
  26. package/lib/Column.js +7 -7
  27. package/lib/{Drawer-Cyv27orn.js → Drawer-CaXVhxo4.js} +21 -21
  28. package/lib/{Drawer-BeYo9jAG.cjs → Drawer-Was4hxYH.cjs} +1 -1
  29. package/lib/Drawer.cjs +1 -1
  30. package/lib/Drawer.js +4 -4
  31. package/lib/Emoji.cjs +1 -1
  32. package/lib/Emoji.js +4312 -1860
  33. package/lib/Excalidraw.cjs +1 -1
  34. package/lib/Excalidraw.js +3 -3
  35. package/lib/ExportPdf.cjs +1 -1
  36. package/lib/ExportPdf.js +2 -2
  37. package/lib/ExportWord.cjs +1 -1
  38. package/lib/ExportWord.js +2 -2
  39. package/lib/FontFamily.cjs +1 -1
  40. package/lib/FontFamily.js +5 -5
  41. package/lib/FontSize.cjs +1 -1
  42. package/lib/FontSize.js +9 -9
  43. package/lib/Heading.cjs +1 -1
  44. package/lib/Heading.js +5 -5
  45. package/lib/Highlight.cjs +1 -1
  46. package/lib/Highlight.js +69 -46
  47. package/lib/History.cjs +1 -1
  48. package/lib/History.js +556 -418
  49. package/lib/HorizontalRule.cjs +1 -1
  50. package/lib/HorizontalRule.js +2 -2
  51. package/lib/{Iframe-Bx-VDxSB.cjs → Iframe-BI0sq6pd.cjs} +1 -1
  52. package/lib/{Iframe-D9JVKzO0.js → Iframe-Bp986fj0.js} +3 -3
  53. package/lib/Iframe.cjs +1 -1
  54. package/lib/Iframe.js +3 -3
  55. package/lib/Image.cjs +1 -1
  56. package/lib/Image.js +3 -3
  57. package/lib/ImageGif.cjs +1 -1
  58. package/lib/ImageGif.js +47 -47
  59. package/lib/ImportWord.cjs +1 -1
  60. package/lib/ImportWord.js +3 -3
  61. package/lib/{Indent-B5tQ5Wfg.js → Indent-E6B8DkyN.js} +4 -4
  62. package/lib/{Indent-CCLO0KpG.cjs → Indent-FvM52kjA.cjs} +1 -1
  63. package/lib/Indent.cjs +1 -1
  64. package/lib/Indent.js +2 -2
  65. package/lib/Italic.cjs +1 -1
  66. package/lib/Italic.js +2 -2
  67. package/lib/{Katex-rtfVV2pl.cjs → Katex-DP6EjdKz.cjs} +1 -1
  68. package/lib/{Katex-w_c6vAMd.js → Katex-pzwyyiFJ.js} +5 -5
  69. package/lib/Katex.cjs +1 -1
  70. package/lib/Katex.js +3 -3
  71. package/lib/LineHeight.cjs +1 -1
  72. package/lib/LineHeight.js +4 -4
  73. package/lib/Link.cjs +1 -1
  74. package/lib/Link.js +2 -2
  75. package/lib/LinkEditBlock-Cmkmp2fW.cjs +5 -0
  76. package/lib/{LinkEditBlock-CTlU8YnO.js → LinkEditBlock-OjN4F2rM.js} +222 -224
  77. package/lib/MarkdownPaste.cjs +1 -1
  78. package/lib/MarkdownPaste.js +1 -1
  79. package/lib/Mention.cjs +1 -1
  80. package/lib/Mention.js +8 -8
  81. package/lib/Mermaid.cjs +1 -1
  82. package/lib/Mermaid.js +34 -34
  83. package/lib/MoreMark.cjs +1 -1
  84. package/lib/MoreMark.js +3 -3
  85. package/lib/OrderedList.cjs +1 -1
  86. package/lib/OrderedList.js +2 -2
  87. package/lib/SearchAndReplace.cjs +1 -1
  88. package/lib/SearchAndReplace.js +4 -4
  89. package/lib/SlashCommand.cjs +1 -1
  90. package/lib/SlashCommand.js +7 -7
  91. package/lib/{SlashCommandNodeView-CVKjpS6r.cjs → SlashCommandNodeView-DarAytvt.cjs} +1 -1
  92. package/lib/{SlashCommandNodeView-DNkpJuM3.js → SlashCommandNodeView-o323V8li.js} +2 -2
  93. package/lib/Strike.cjs +1 -1
  94. package/lib/Strike.js +2 -2
  95. package/lib/Table-CC9uNHPL.js +1984 -0
  96. package/lib/Table-Clnz-i4l.cjs +9 -0
  97. package/lib/Table.cjs +1 -1
  98. package/lib/Table.js +1 -1
  99. package/lib/TaskList.cjs +1 -1
  100. package/lib/TaskList.js +2 -2
  101. package/lib/TextAlign.cjs +1 -1
  102. package/lib/TextAlign.js +3 -3
  103. package/lib/TextDirection.cjs +1 -1
  104. package/lib/TextDirection.js +3 -3
  105. package/lib/TextUnderline.cjs +1 -1
  106. package/lib/TextUnderline.js +2 -2
  107. package/lib/{Twitter-BJjt8vv_.cjs → Twitter-0kmrijjL.cjs} +1 -1
  108. package/lib/{Twitter-CKm0M53B.js → Twitter-BVnXL8we.js} +5 -5
  109. package/lib/Twitter.cjs +1 -1
  110. package/lib/Twitter.js +3 -3
  111. package/lib/Video.cjs +1 -1
  112. package/lib/Video.js +3 -3
  113. package/lib/bubble.cjs +6 -6
  114. package/lib/bubble.js +1573 -1561
  115. package/lib/{clsx-Bg-2aTKh.js → clsx-0OU6n9va.js} +379 -353
  116. package/lib/clsx-D6gYQn3o.cjs +33 -0
  117. package/lib/{dropdown-menu-Dre693DD.cjs → dropdown-menu-BIGvxqiu.cjs} +1 -1
  118. package/lib/{dropdown-menu-AhMKS9PQ.js → dropdown-menu-BW2M6saA.js} +1 -1
  119. package/lib/index-BAb_UADw.cjs +1 -0
  120. package/lib/index-BF3EVCB1.cjs +2 -0
  121. package/lib/{index-D0EmqTpe.js → index-BblvcbTH.js} +1130 -1064
  122. package/lib/index-Bcj8cyOO.cjs +24 -0
  123. package/lib/{index-BfHAqkoX.js → index-BrsJsbds.js} +3 -3
  124. package/lib/index-CGjT-a9h.js +1377 -0
  125. package/lib/index-CPTpXLfX.cjs +11 -0
  126. package/lib/{index-C3dgmjIF.cjs → index-CUvjYuRp.cjs} +1 -1
  127. package/lib/{index-C4aGVY2E.cjs → index-CWw4s87s.cjs} +1 -1
  128. package/lib/{index-DXtVL0al.js → index-Cal5SPfB.js} +189 -134
  129. package/lib/{index-CjLxMm5d.js → index-D-Ouz0vF.js} +1 -1
  130. package/lib/{index-83hp1lZH.cjs → index-deubsx3z.cjs} +1 -1
  131. package/lib/{index-DtVRewGA.js → index-oj858lQO.js} +229 -31
  132. package/lib/{index-CbkpBnTX.js → index-zw-Kd38i.js} +47 -50
  133. package/lib/index.cjs +1 -1
  134. package/lib/index.js +2 -2
  135. package/lib/locale-bundle.cjs +1 -1
  136. package/lib/locale-bundle.js +7 -6
  137. package/lib/locales/index.d.ts +199 -1
  138. package/lib/locales/ja.d.ts +198 -0
  139. package/lib/{popover-B1ptDngu.js → popover-BIVHT1W9.js} +1 -1
  140. package/lib/{popover-D7w_FVSV.cjs → popover-DoSfJsFS.cjs} +1 -1
  141. package/lib/{renderNodeView-CbxCTni3.js → renderNodeView-CfWJK4rG.js} +2 -2
  142. package/lib/{renderNodeView-DFVrJy0l.cjs → renderNodeView-D--fDFov.cjs} +1 -1
  143. package/lib/{separator-C_7KkuoG.cjs → separator-SRbPfmGa.cjs} +1 -1
  144. package/lib/{separator-CDoF4Z4Z.js → separator-b-qOPJmp.js} +3 -3
  145. package/lib/{textarea-CNzZnjjW.js → textarea-CpxXPky_.js} +1 -1
  146. package/lib/{textarea-CEtXap1b.cjs → textarea-DbGw9oCU.cjs} +1 -1
  147. package/lib/updatePosition-BwzAsiY0.js +16 -0
  148. package/lib/{updatePosition-CQE1ct18.cjs → updatePosition-DGPtRfWN.cjs} +1 -1
  149. package/package.json +60 -60
  150. package/lib/LinkEditBlock-_41zgSyl.cjs +0 -5
  151. package/lib/Table-BFiU40iW.cjs +0 -9
  152. package/lib/Table-yZtD5Qo1.js +0 -1945
  153. package/lib/clsx-DSAWW32g.cjs +0 -33
  154. package/lib/index-C4WLt4NA.cjs +0 -24
  155. package/lib/index-DlxZt4_j.cjs +0 -1
  156. package/lib/index-P5_MyY0i.js +0 -1362
  157. package/lib/index-TcJ2UKnv.cjs +0 -1
  158. package/lib/index-fbGGohBT.cjs +0 -12
  159. package/lib/updatePosition-BGD41Hbg.js +0 -16
@@ -1,1362 +0,0 @@
1
- import { PluginKey as Gt, Plugin as Jt } from "@tiptap/pm/state";
2
- import { DecorationSet as Qt, Decoration as Zt } from "@tiptap/pm/view";
3
- import { I as te } from "./index-D0EmqTpe.js";
4
- const kt = ["top", "right", "bottom", "left"], At = ["start", "end"], Ct = /* @__PURE__ */ kt.reduce((t, e) => t.concat(e, e + "-" + At[0], e + "-" + At[1]), []), X = Math.min, M = Math.max, ct = Math.round, V = (t) => ({
5
- x: t,
6
- y: t
7
- }), ee = {
8
- left: "right",
9
- right: "left",
10
- bottom: "top",
11
- top: "bottom"
12
- };
13
- function wt(t, e, i) {
14
- return M(t, X(e, i));
15
- }
16
- function j(t, e) {
17
- return typeof t == "function" ? t(e) : t;
18
- }
19
- function F(t) {
20
- return t.split("-")[0];
21
- }
22
- function W(t) {
23
- return t.split("-")[1];
24
- }
25
- function Nt(t) {
26
- return t === "x" ? "y" : "x";
27
- }
28
- function yt(t) {
29
- return t === "y" ? "height" : "width";
30
- }
31
- function H(t) {
32
- const e = t[0];
33
- return e === "t" || e === "b" ? "y" : "x";
34
- }
35
- function vt(t) {
36
- return Nt(H(t));
37
- }
38
- function Ft(t, e, i) {
39
- i === void 0 && (i = !1);
40
- const n = W(t), o = vt(t), r = yt(o);
41
- let s = o === "x" ? n === (i ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
42
- return e.reference[r] > e.floating[r] && (s = at(s)), [s, at(s)];
43
- }
44
- function ne(t) {
45
- const e = at(t);
46
- return [lt(t), e, lt(e)];
47
- }
48
- function lt(t) {
49
- return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
50
- }
51
- const Pt = ["left", "right"], Et = ["right", "left"], oe = ["top", "bottom"], ie = ["bottom", "top"];
52
- function re(t, e, i) {
53
- switch (t) {
54
- case "top":
55
- case "bottom":
56
- return i ? e ? Et : Pt : e ? Pt : Et;
57
- case "left":
58
- case "right":
59
- return e ? oe : ie;
60
- default:
61
- return [];
62
- }
63
- }
64
- function se(t, e, i, n) {
65
- const o = W(t);
66
- let r = re(F(t), i === "start", n);
67
- return o && (r = r.map((s) => s + "-" + o), e && (r = r.concat(r.map(lt)))), r;
68
- }
69
- function at(t) {
70
- const e = F(t);
71
- return ee[e] + t.slice(e.length);
72
- }
73
- function ce(t) {
74
- return {
75
- top: 0,
76
- right: 0,
77
- bottom: 0,
78
- left: 0,
79
- ...t
80
- };
81
- }
82
- function bt(t) {
83
- return typeof t != "number" ? ce(t) : {
84
- top: t,
85
- right: t,
86
- bottom: t,
87
- left: t
88
- };
89
- }
90
- function Z(t) {
91
- const {
92
- x: e,
93
- y: i,
94
- width: n,
95
- height: o
96
- } = t;
97
- return {
98
- width: n,
99
- height: o,
100
- top: i,
101
- left: e,
102
- right: e + n,
103
- bottom: i + o,
104
- x: e,
105
- y: i
106
- };
107
- }
108
- function Dt(t, e, i) {
109
- let {
110
- reference: n,
111
- floating: o
112
- } = t;
113
- const r = H(e), s = vt(e), c = yt(s), a = F(e), m = r === "y", f = n.x + n.width / 2 - o.width / 2, l = n.y + n.height / 2 - o.height / 2, g = n[c] / 2 - o[c] / 2;
114
- let u;
115
- switch (a) {
116
- case "top":
117
- u = {
118
- x: f,
119
- y: n.y - o.height
120
- };
121
- break;
122
- case "bottom":
123
- u = {
124
- x: f,
125
- y: n.y + n.height
126
- };
127
- break;
128
- case "right":
129
- u = {
130
- x: n.x + n.width,
131
- y: l
132
- };
133
- break;
134
- case "left":
135
- u = {
136
- x: n.x - o.width,
137
- y: l
138
- };
139
- break;
140
- default:
141
- u = {
142
- x: n.x,
143
- y: n.y
144
- };
145
- }
146
- switch (W(e)) {
147
- case "start":
148
- u[s] -= g * (i && m ? -1 : 1);
149
- break;
150
- case "end":
151
- u[s] += g * (i && m ? -1 : 1);
152
- break;
153
- }
154
- return u;
155
- }
156
- async function le(t, e) {
157
- var i;
158
- e === void 0 && (e = {});
159
- const {
160
- x: n,
161
- y: o,
162
- platform: r,
163
- rects: s,
164
- elements: c,
165
- strategy: a
166
- } = t, {
167
- boundary: m = "clippingAncestors",
168
- rootBoundary: f = "viewport",
169
- elementContext: l = "floating",
170
- altBoundary: g = !1,
171
- padding: u = 0
172
- } = j(e, t), h = bt(u), p = c[g ? l === "floating" ? "reference" : "floating" : l], b = Z(await r.getClippingRect({
173
- element: (i = await (r.isElement == null ? void 0 : r.isElement(p))) == null || i ? p : p.contextElement || await (r.getDocumentElement == null ? void 0 : r.getDocumentElement(c.floating)),
174
- boundary: m,
175
- rootBoundary: f,
176
- strategy: a
177
- })), d = l === "floating" ? {
178
- x: n,
179
- y: o,
180
- width: s.floating.width,
181
- height: s.floating.height
182
- } : s.reference, S = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(c.floating)), O = await (r.isElement == null ? void 0 : r.isElement(S)) ? await (r.getScale == null ? void 0 : r.getScale(S)) || {
183
- x: 1,
184
- y: 1
185
- } : {
186
- x: 1,
187
- y: 1
188
- }, _ = Z(r.convertOffsetParentRelativeRectToViewportRelativeRect ? await r.convertOffsetParentRelativeRectToViewportRelativeRect({
189
- elements: c,
190
- rect: d,
191
- offsetParent: S,
192
- strategy: a
193
- }) : d);
194
- return {
195
- top: (b.top - _.top + h.top) / O.y,
196
- bottom: (_.bottom - b.bottom + h.bottom) / O.y,
197
- left: (b.left - _.left + h.left) / O.x,
198
- right: (_.right - b.right + h.right) / O.x
199
- };
200
- }
201
- const ae = 50, fe = async (t, e, i) => {
202
- const {
203
- placement: n = "bottom",
204
- strategy: o = "absolute",
205
- middleware: r = [],
206
- platform: s
207
- } = i, c = s.detectOverflow ? s : {
208
- ...s,
209
- detectOverflow: le
210
- }, a = await (s.isRTL == null ? void 0 : s.isRTL(e));
211
- let m = await s.getElementRects({
212
- reference: t,
213
- floating: e,
214
- strategy: o
215
- }), {
216
- x: f,
217
- y: l
218
- } = Dt(m, n, a), g = n, u = 0;
219
- const h = {};
220
- for (let v = 0; v < r.length; v++) {
221
- const p = r[v];
222
- if (!p)
223
- continue;
224
- const {
225
- name: b,
226
- fn: d
227
- } = p, {
228
- x: S,
229
- y: O,
230
- data: _,
231
- reset: D
232
- } = await d({
233
- x: f,
234
- y: l,
235
- initialPlacement: n,
236
- placement: g,
237
- strategy: o,
238
- middlewareData: h,
239
- rects: m,
240
- platform: c,
241
- elements: {
242
- reference: t,
243
- floating: e
244
- }
245
- });
246
- f = S ?? f, l = O ?? l, h[b] = {
247
- ...h[b],
248
- ..._
249
- }, D && u < ae && (u++, typeof D == "object" && (D.placement && (g = D.placement), D.rects && (m = D.rects === !0 ? await s.getElementRects({
250
- reference: t,
251
- floating: e,
252
- strategy: o
253
- }) : D.rects), {
254
- x: f,
255
- y: l
256
- } = Dt(m, g, a)), v = -1);
257
- }
258
- return {
259
- x: f,
260
- y: l,
261
- placement: g,
262
- strategy: o,
263
- middlewareData: h
264
- };
265
- }, ue = (t) => ({
266
- name: "arrow",
267
- options: t,
268
- async fn(e) {
269
- const {
270
- x: i,
271
- y: n,
272
- placement: o,
273
- rects: r,
274
- platform: s,
275
- elements: c,
276
- middlewareData: a
277
- } = e, {
278
- element: m,
279
- padding: f = 0
280
- } = j(t, e) || {};
281
- if (m == null)
282
- return {};
283
- const l = bt(f), g = {
284
- x: i,
285
- y: n
286
- }, u = vt(o), h = yt(u), v = await s.getDimensions(m), p = u === "y", b = p ? "top" : "left", d = p ? "bottom" : "right", S = p ? "clientHeight" : "clientWidth", O = r.reference[h] + r.reference[u] - g[u] - r.floating[h], _ = g[u] - r.reference[u], D = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(m));
287
- let y = D ? D[S] : 0;
288
- (!y || !await (s.isElement == null ? void 0 : s.isElement(D))) && (y = c.floating[S] || r.floating[h]);
289
- const A = O / 2 - _ / 2, C = y / 2 - v[h] / 2 - 1, w = X(l[b], C), R = X(l[d], C), P = w, T = y - v[h] - R, L = y / 2 - v[h] / 2 + A, B = wt(P, L, T), x = !a.arrow && W(o) != null && L !== B && r.reference[h] / 2 - (L < P ? w : R) - v[h] / 2 < 0, $ = x ? L < P ? L - P : L - T : 0;
290
- return {
291
- [u]: g[u] + $,
292
- data: {
293
- [u]: B,
294
- centerOffset: L - B - $,
295
- ...x && {
296
- alignmentOffset: $
297
- }
298
- },
299
- reset: x
300
- };
301
- }
302
- });
303
- function de(t, e, i) {
304
- return (t ? [...i.filter((o) => W(o) === t), ...i.filter((o) => W(o) !== t)] : i.filter((o) => F(o) === o)).filter((o) => t ? W(o) === t || (e ? lt(o) !== o : !1) : !0);
305
- }
306
- const me = function(t) {
307
- return t === void 0 && (t = {}), {
308
- name: "autoPlacement",
309
- options: t,
310
- async fn(e) {
311
- var i, n, o;
312
- const {
313
- rects: r,
314
- middlewareData: s,
315
- placement: c,
316
- platform: a,
317
- elements: m
318
- } = e, {
319
- crossAxis: f = !1,
320
- alignment: l,
321
- allowedPlacements: g = Ct,
322
- autoAlignment: u = !0,
323
- ...h
324
- } = j(t, e), v = l !== void 0 || g === Ct ? de(l || null, u, g) : g, p = await a.detectOverflow(e, h), b = ((i = s.autoPlacement) == null ? void 0 : i.index) || 0, d = v[b];
325
- if (d == null)
326
- return {};
327
- const S = Ft(d, r, await (a.isRTL == null ? void 0 : a.isRTL(m.floating)));
328
- if (c !== d)
329
- return {
330
- reset: {
331
- placement: v[0]
332
- }
333
- };
334
- const O = [p[F(d)], p[S[0]], p[S[1]]], _ = [...((n = s.autoPlacement) == null ? void 0 : n.overflows) || [], {
335
- placement: d,
336
- overflows: O
337
- }], D = v[b + 1];
338
- if (D)
339
- return {
340
- data: {
341
- index: b + 1,
342
- overflows: _
343
- },
344
- reset: {
345
- placement: D
346
- }
347
- };
348
- const y = _.map((w) => {
349
- const R = W(w.placement);
350
- return [w.placement, R && f ? (
351
- // Check along the mainAxis and main crossAxis side.
352
- w.overflows.slice(0, 2).reduce((P, T) => P + T, 0)
353
- ) : (
354
- // Check only the mainAxis.
355
- w.overflows[0]
356
- ), w.overflows];
357
- }).sort((w, R) => w[1] - R[1]), C = ((o = y.filter((w) => w[2].slice(
358
- 0,
359
- // Aligned placements should not check their opposite crossAxis
360
- // side.
361
- W(w[0]) ? 2 : 3
362
- ).every((R) => R <= 0))[0]) == null ? void 0 : o[0]) || y[0][0];
363
- return C !== c ? {
364
- data: {
365
- index: b + 1,
366
- overflows: _
367
- },
368
- reset: {
369
- placement: C
370
- }
371
- } : {};
372
- }
373
- };
374
- }, ge = function(t) {
375
- return t === void 0 && (t = {}), {
376
- name: "flip",
377
- options: t,
378
- async fn(e) {
379
- var i, n;
380
- const {
381
- placement: o,
382
- middlewareData: r,
383
- rects: s,
384
- initialPlacement: c,
385
- platform: a,
386
- elements: m
387
- } = e, {
388
- mainAxis: f = !0,
389
- crossAxis: l = !0,
390
- fallbackPlacements: g,
391
- fallbackStrategy: u = "bestFit",
392
- fallbackAxisSideDirection: h = "none",
393
- flipAlignment: v = !0,
394
- ...p
395
- } = j(t, e);
396
- if ((i = r.arrow) != null && i.alignmentOffset)
397
- return {};
398
- const b = F(o), d = H(c), S = F(c) === c, O = await (a.isRTL == null ? void 0 : a.isRTL(m.floating)), _ = g || (S || !v ? [at(c)] : ne(c)), D = h !== "none";
399
- !g && D && _.push(...se(c, v, h, O));
400
- const y = [c, ..._], A = await a.detectOverflow(e, p), C = [];
401
- let w = ((n = r.flip) == null ? void 0 : n.overflows) || [];
402
- if (f && C.push(A[b]), l) {
403
- const L = Ft(o, s, O);
404
- C.push(A[L[0]], A[L[1]]);
405
- }
406
- if (w = [...w, {
407
- placement: o,
408
- overflows: C
409
- }], !C.every((L) => L <= 0)) {
410
- var R, P;
411
- const L = (((R = r.flip) == null ? void 0 : R.index) || 0) + 1, B = y[L];
412
- if (B && (!(l === "alignment" ? d !== H(B) : !1) || // We leave the current main axis only if every placement on that axis
413
- // overflows the main axis.
414
- w.every((E) => H(E.placement) === d ? E.overflows[0] > 0 : !0)))
415
- return {
416
- data: {
417
- index: L,
418
- overflows: w
419
- },
420
- reset: {
421
- placement: B
422
- }
423
- };
424
- let x = (P = w.filter(($) => $.overflows[0] <= 0).sort(($, E) => $.overflows[1] - E.overflows[1])[0]) == null ? void 0 : P.placement;
425
- if (!x)
426
- switch (u) {
427
- case "bestFit": {
428
- var T;
429
- const $ = (T = w.filter((E) => {
430
- if (D) {
431
- const k = H(E.placement);
432
- return k === d || // Create a bias to the `y` side axis due to horizontal
433
- // reading directions favoring greater width.
434
- k === "y";
435
- }
436
- return !0;
437
- }).map((E) => [E.placement, E.overflows.filter((k) => k > 0).reduce((k, G) => k + G, 0)]).sort((E, k) => E[1] - k[1])[0]) == null ? void 0 : T[0];
438
- $ && (x = $);
439
- break;
440
- }
441
- case "initialPlacement":
442
- x = c;
443
- break;
444
- }
445
- if (o !== x)
446
- return {
447
- reset: {
448
- placement: x
449
- }
450
- };
451
- }
452
- return {};
453
- }
454
- };
455
- };
456
- function Tt(t, e) {
457
- return {
458
- top: t.top - e.height,
459
- right: t.right - e.width,
460
- bottom: t.bottom - e.height,
461
- left: t.left - e.width
462
- };
463
- }
464
- function Lt(t) {
465
- return kt.some((e) => t[e] >= 0);
466
- }
467
- const he = function(t) {
468
- return t === void 0 && (t = {}), {
469
- name: "hide",
470
- options: t,
471
- async fn(e) {
472
- const {
473
- rects: i,
474
- platform: n
475
- } = e, {
476
- strategy: o = "referenceHidden",
477
- ...r
478
- } = j(t, e);
479
- switch (o) {
480
- case "referenceHidden": {
481
- const s = await n.detectOverflow(e, {
482
- ...r,
483
- elementContext: "reference"
484
- }), c = Tt(s, i.reference);
485
- return {
486
- data: {
487
- referenceHiddenOffsets: c,
488
- referenceHidden: Lt(c)
489
- }
490
- };
491
- }
492
- case "escaped": {
493
- const s = await n.detectOverflow(e, {
494
- ...r,
495
- altBoundary: !0
496
- }), c = Tt(s, i.floating);
497
- return {
498
- data: {
499
- escapedOffsets: c,
500
- escaped: Lt(c)
501
- }
502
- };
503
- }
504
- default:
505
- return {};
506
- }
507
- }
508
- };
509
- };
510
- function Wt(t) {
511
- const e = X(...t.map((r) => r.left)), i = X(...t.map((r) => r.top)), n = M(...t.map((r) => r.right)), o = M(...t.map((r) => r.bottom));
512
- return {
513
- x: e,
514
- y: i,
515
- width: n - e,
516
- height: o - i
517
- };
518
- }
519
- function pe(t) {
520
- const e = t.slice().sort((o, r) => o.y - r.y), i = [];
521
- let n = null;
522
- for (let o = 0; o < e.length; o++) {
523
- const r = e[o];
524
- !n || r.y - n.y > n.height / 2 ? i.push([r]) : i[i.length - 1].push(r), n = r;
525
- }
526
- return i.map((o) => Z(Wt(o)));
527
- }
528
- const we = function(t) {
529
- return t === void 0 && (t = {}), {
530
- name: "inline",
531
- options: t,
532
- async fn(e) {
533
- const {
534
- placement: i,
535
- elements: n,
536
- rects: o,
537
- platform: r,
538
- strategy: s
539
- } = e, {
540
- padding: c = 2,
541
- x: a,
542
- y: m
543
- } = j(t, e), f = Array.from(await (r.getClientRects == null ? void 0 : r.getClientRects(n.reference)) || []), l = pe(f), g = Z(Wt(f)), u = bt(c);
544
- function h() {
545
- if (l.length === 2 && l[0].left > l[1].right && a != null && m != null)
546
- return l.find((p) => a > p.left - u.left && a < p.right + u.right && m > p.top - u.top && m < p.bottom + u.bottom) || g;
547
- if (l.length >= 2) {
548
- if (H(i) === "y") {
549
- const w = l[0], R = l[l.length - 1], P = F(i) === "top", T = w.top, L = R.bottom, B = P ? w.left : R.left, x = P ? w.right : R.right, $ = x - B, E = L - T;
550
- return {
551
- top: T,
552
- bottom: L,
553
- left: B,
554
- right: x,
555
- width: $,
556
- height: E,
557
- x: B,
558
- y: T
559
- };
560
- }
561
- const p = F(i) === "left", b = M(...l.map((w) => w.right)), d = X(...l.map((w) => w.left)), S = l.filter((w) => p ? w.left === d : w.right === b), O = S[0].top, _ = S[S.length - 1].bottom, D = d, y = b, A = y - D, C = _ - O;
562
- return {
563
- top: O,
564
- bottom: _,
565
- left: D,
566
- right: y,
567
- width: A,
568
- height: C,
569
- x: D,
570
- y: O
571
- };
572
- }
573
- return g;
574
- }
575
- const v = await r.getElementRects({
576
- reference: {
577
- getBoundingClientRect: h
578
- },
579
- floating: n.floating,
580
- strategy: s
581
- });
582
- return o.reference.x !== v.reference.x || o.reference.y !== v.reference.y || o.reference.width !== v.reference.width || o.reference.height !== v.reference.height ? {
583
- reset: {
584
- rects: v
585
- }
586
- } : {};
587
- }
588
- };
589
- }, xe = /* @__PURE__ */ new Set(["left", "top"]);
590
- async function ye(t, e) {
591
- const {
592
- placement: i,
593
- platform: n,
594
- elements: o
595
- } = t, r = await (n.isRTL == null ? void 0 : n.isRTL(o.floating)), s = F(i), c = W(i), a = H(i) === "y", m = xe.has(s) ? -1 : 1, f = r && a ? -1 : 1, l = j(e, t);
596
- let {
597
- mainAxis: g,
598
- crossAxis: u,
599
- alignmentAxis: h
600
- } = typeof l == "number" ? {
601
- mainAxis: l,
602
- crossAxis: 0,
603
- alignmentAxis: null
604
- } : {
605
- mainAxis: l.mainAxis || 0,
606
- crossAxis: l.crossAxis || 0,
607
- alignmentAxis: l.alignmentAxis
608
- };
609
- return c && typeof h == "number" && (u = c === "end" ? h * -1 : h), a ? {
610
- x: u * f,
611
- y: g * m
612
- } : {
613
- x: g * m,
614
- y: u * f
615
- };
616
- }
617
- const ve = function(t) {
618
- return t === void 0 && (t = 0), {
619
- name: "offset",
620
- options: t,
621
- async fn(e) {
622
- var i, n;
623
- const {
624
- x: o,
625
- y: r,
626
- placement: s,
627
- middlewareData: c
628
- } = e, a = await ye(e, t);
629
- return s === ((i = c.offset) == null ? void 0 : i.placement) && (n = c.arrow) != null && n.alignmentOffset ? {} : {
630
- x: o + a.x,
631
- y: r + a.y,
632
- data: {
633
- ...a,
634
- placement: s
635
- }
636
- };
637
- }
638
- };
639
- }, be = function(t) {
640
- return t === void 0 && (t = {}), {
641
- name: "shift",
642
- options: t,
643
- async fn(e) {
644
- const {
645
- x: i,
646
- y: n,
647
- placement: o,
648
- platform: r
649
- } = e, {
650
- mainAxis: s = !0,
651
- crossAxis: c = !1,
652
- limiter: a = {
653
- fn: (b) => {
654
- let {
655
- x: d,
656
- y: S
657
- } = b;
658
- return {
659
- x: d,
660
- y: S
661
- };
662
- }
663
- },
664
- ...m
665
- } = j(t, e), f = {
666
- x: i,
667
- y: n
668
- }, l = await r.detectOverflow(e, m), g = H(F(o)), u = Nt(g);
669
- let h = f[u], v = f[g];
670
- if (s) {
671
- const b = u === "y" ? "top" : "left", d = u === "y" ? "bottom" : "right", S = h + l[b], O = h - l[d];
672
- h = wt(S, h, O);
673
- }
674
- if (c) {
675
- const b = g === "y" ? "top" : "left", d = g === "y" ? "bottom" : "right", S = v + l[b], O = v - l[d];
676
- v = wt(S, v, O);
677
- }
678
- const p = a.fn({
679
- ...e,
680
- [u]: h,
681
- [g]: v
682
- });
683
- return {
684
- ...p,
685
- data: {
686
- x: p.x - i,
687
- y: p.y - n,
688
- enabled: {
689
- [u]: s,
690
- [g]: c
691
- }
692
- }
693
- };
694
- }
695
- };
696
- }, Re = function(t) {
697
- return t === void 0 && (t = {}), {
698
- name: "size",
699
- options: t,
700
- async fn(e) {
701
- var i, n;
702
- const {
703
- placement: o,
704
- rects: r,
705
- platform: s,
706
- elements: c
707
- } = e, {
708
- apply: a = () => {
709
- },
710
- ...m
711
- } = j(t, e), f = await s.detectOverflow(e, m), l = F(o), g = W(o), u = H(o) === "y", {
712
- width: h,
713
- height: v
714
- } = r.floating;
715
- let p, b;
716
- l === "top" || l === "bottom" ? (p = l, b = g === (await (s.isRTL == null ? void 0 : s.isRTL(c.floating)) ? "start" : "end") ? "left" : "right") : (b = l, p = g === "end" ? "top" : "bottom");
717
- const d = v - f.top - f.bottom, S = h - f.left - f.right, O = X(v - f[p], d), _ = X(h - f[b], S), D = !e.middlewareData.shift;
718
- let y = O, A = _;
719
- if ((i = e.middlewareData.shift) != null && i.enabled.x && (A = S), (n = e.middlewareData.shift) != null && n.enabled.y && (y = d), D && !g) {
720
- const w = M(f.left, 0), R = M(f.right, 0), P = M(f.top, 0), T = M(f.bottom, 0);
721
- u ? A = h - 2 * (w !== 0 || R !== 0 ? w + R : M(f.left, f.right)) : y = v - 2 * (P !== 0 || T !== 0 ? P + T : M(f.top, f.bottom));
722
- }
723
- await a({
724
- ...e,
725
- availableWidth: A,
726
- availableHeight: y
727
- });
728
- const C = await s.getDimensions(c.floating);
729
- return h !== C.width || v !== C.height ? {
730
- reset: {
731
- rects: !0
732
- }
733
- } : {};
734
- }
735
- };
736
- };
737
- function ft() {
738
- return typeof window < "u";
739
- }
740
- function et(t) {
741
- return It(t) ? (t.nodeName || "").toLowerCase() : "#document";
742
- }
743
- function N(t) {
744
- var e;
745
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
746
- }
747
- function Y(t) {
748
- var e;
749
- return (e = (It(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
750
- }
751
- function It(t) {
752
- return ft() ? t instanceof Node || t instanceof N(t).Node : !1;
753
- }
754
- function I(t) {
755
- return ft() ? t instanceof Element || t instanceof N(t).Element : !1;
756
- }
757
- function K(t) {
758
- return ft() ? t instanceof HTMLElement || t instanceof N(t).HTMLElement : !1;
759
- }
760
- function $t(t) {
761
- return !ft() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof N(t).ShadowRoot;
762
- }
763
- function rt(t) {
764
- const {
765
- overflow: e,
766
- overflowX: i,
767
- overflowY: n,
768
- display: o
769
- } = q(t);
770
- return /auto|scroll|overlay|hidden|clip/.test(e + n + i) && o !== "inline" && o !== "contents";
771
- }
772
- function Se(t) {
773
- return /^(table|td|th)$/.test(et(t));
774
- }
775
- function ut(t) {
776
- try {
777
- if (t.matches(":popover-open"))
778
- return !0;
779
- } catch {
780
- }
781
- try {
782
- return t.matches(":modal");
783
- } catch {
784
- return !1;
785
- }
786
- }
787
- const Oe = /transform|translate|scale|rotate|perspective|filter/, Ae = /paint|layout|strict|content/, U = (t) => !!t && t !== "none";
788
- let ht;
789
- function Rt(t) {
790
- const e = I(t) ? q(t) : t;
791
- return U(e.transform) || U(e.translate) || U(e.scale) || U(e.rotate) || U(e.perspective) || !St() && (U(e.backdropFilter) || U(e.filter)) || Oe.test(e.willChange || "") || Ae.test(e.contain || "");
792
- }
793
- function Ce(t) {
794
- let e = z(t);
795
- for (; K(e) && !tt(e); ) {
796
- if (Rt(e))
797
- return e;
798
- if (ut(e))
799
- return null;
800
- e = z(e);
801
- }
802
- return null;
803
- }
804
- function St() {
805
- return ht == null && (ht = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), ht;
806
- }
807
- function tt(t) {
808
- return /^(html|body|#document)$/.test(et(t));
809
- }
810
- function q(t) {
811
- return N(t).getComputedStyle(t);
812
- }
813
- function dt(t) {
814
- return I(t) ? {
815
- scrollLeft: t.scrollLeft,
816
- scrollTop: t.scrollTop
817
- } : {
818
- scrollLeft: t.scrollX,
819
- scrollTop: t.scrollY
820
- };
821
- }
822
- function z(t) {
823
- if (et(t) === "html")
824
- return t;
825
- const e = (
826
- // Step into the shadow DOM of the parent of a slotted node.
827
- t.assignedSlot || // DOM Element detected.
828
- t.parentNode || // ShadowRoot detected.
829
- $t(t) && t.host || // Fallback.
830
- Y(t)
831
- );
832
- return $t(e) ? e.host : e;
833
- }
834
- function qt(t) {
835
- const e = z(t);
836
- return tt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : K(e) && rt(e) ? e : qt(e);
837
- }
838
- function Ht(t, e, i) {
839
- var n;
840
- e === void 0 && (e = []);
841
- const o = qt(t), r = o === ((n = t.ownerDocument) == null ? void 0 : n.body), s = N(o);
842
- return r ? (xt(s), e.concat(s, s.visualViewport || [], rt(o) ? o : [], [])) : e.concat(o, Ht(o, []));
843
- }
844
- function xt(t) {
845
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
846
- }
847
- function Vt(t) {
848
- const e = q(t);
849
- let i = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
850
- const o = K(t), r = o ? t.offsetWidth : i, s = o ? t.offsetHeight : n, c = ct(i) !== r || ct(n) !== s;
851
- return c && (i = r, n = s), {
852
- width: i,
853
- height: n,
854
- $: c
855
- };
856
- }
857
- function Xt(t) {
858
- return I(t) ? t : t.contextElement;
859
- }
860
- function Q(t) {
861
- const e = Xt(t);
862
- if (!K(e))
863
- return V(1);
864
- const i = e.getBoundingClientRect(), {
865
- width: n,
866
- height: o,
867
- $: r
868
- } = Vt(e);
869
- let s = (r ? ct(i.width) : i.width) / n, c = (r ? ct(i.height) : i.height) / o;
870
- return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), {
871
- x: s,
872
- y: c
873
- };
874
- }
875
- const Pe = /* @__PURE__ */ V(0);
876
- function jt(t) {
877
- const e = N(t);
878
- return !St() || !e.visualViewport ? Pe : {
879
- x: e.visualViewport.offsetLeft,
880
- y: e.visualViewport.offsetTop
881
- };
882
- }
883
- function Ee(t, e, i) {
884
- return e === void 0 && (e = !1), !i || e && i !== N(t) ? !1 : e;
885
- }
886
- function it(t, e, i, n) {
887
- e === void 0 && (e = !1), i === void 0 && (i = !1);
888
- const o = t.getBoundingClientRect(), r = Xt(t);
889
- let s = V(1);
890
- e && (n ? I(n) && (s = Q(n)) : s = Q(t));
891
- const c = Ee(r, i, n) ? jt(r) : V(0);
892
- let a = (o.left + c.x) / s.x, m = (o.top + c.y) / s.y, f = o.width / s.x, l = o.height / s.y;
893
- if (r) {
894
- const g = N(r), u = n && I(n) ? N(n) : n;
895
- let h = g, v = xt(h);
896
- for (; v && n && u !== h; ) {
897
- const p = Q(v), b = v.getBoundingClientRect(), d = q(v), S = b.left + (v.clientLeft + parseFloat(d.paddingLeft)) * p.x, O = b.top + (v.clientTop + parseFloat(d.paddingTop)) * p.y;
898
- a *= p.x, m *= p.y, f *= p.x, l *= p.y, a += S, m += O, h = N(v), v = xt(h);
899
- }
900
- }
901
- return Z({
902
- width: f,
903
- height: l,
904
- x: a,
905
- y: m
906
- });
907
- }
908
- function mt(t, e) {
909
- const i = dt(t).scrollLeft;
910
- return e ? e.left + i : it(Y(t)).left + i;
911
- }
912
- function Yt(t, e) {
913
- const i = t.getBoundingClientRect(), n = i.left + e.scrollLeft - mt(t, i), o = i.top + e.scrollTop;
914
- return {
915
- x: n,
916
- y: o
917
- };
918
- }
919
- function De(t) {
920
- let {
921
- elements: e,
922
- rect: i,
923
- offsetParent: n,
924
- strategy: o
925
- } = t;
926
- const r = o === "fixed", s = Y(n), c = e ? ut(e.floating) : !1;
927
- if (n === s || c && r)
928
- return i;
929
- let a = {
930
- scrollLeft: 0,
931
- scrollTop: 0
932
- }, m = V(1);
933
- const f = V(0), l = K(n);
934
- if ((l || !l && !r) && ((et(n) !== "body" || rt(s)) && (a = dt(n)), l)) {
935
- const u = it(n);
936
- m = Q(n), f.x = u.x + n.clientLeft, f.y = u.y + n.clientTop;
937
- }
938
- const g = s && !l && !r ? Yt(s, a) : V(0);
939
- return {
940
- width: i.width * m.x,
941
- height: i.height * m.y,
942
- x: i.x * m.x - a.scrollLeft * m.x + f.x + g.x,
943
- y: i.y * m.y - a.scrollTop * m.y + f.y + g.y
944
- };
945
- }
946
- function Te(t) {
947
- return Array.from(t.getClientRects());
948
- }
949
- function Le(t) {
950
- const e = Y(t), i = dt(t), n = t.ownerDocument.body, o = M(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), r = M(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
951
- let s = -i.scrollLeft + mt(t);
952
- const c = -i.scrollTop;
953
- return q(n).direction === "rtl" && (s += M(e.clientWidth, n.clientWidth) - o), {
954
- width: o,
955
- height: r,
956
- x: s,
957
- y: c
958
- };
959
- }
960
- const _t = 25;
961
- function $e(t, e) {
962
- const i = N(t), n = Y(t), o = i.visualViewport;
963
- let r = n.clientWidth, s = n.clientHeight, c = 0, a = 0;
964
- if (o) {
965
- r = o.width, s = o.height;
966
- const f = St();
967
- (!f || f && e === "fixed") && (c = o.offsetLeft, a = o.offsetTop);
968
- }
969
- const m = mt(n);
970
- if (m <= 0) {
971
- const f = n.ownerDocument, l = f.body, g = getComputedStyle(l), u = f.compatMode === "CSS1Compat" && parseFloat(g.marginLeft) + parseFloat(g.marginRight) || 0, h = Math.abs(n.clientWidth - l.clientWidth - u);
972
- h <= _t && (r -= h);
973
- } else m <= _t && (r += m);
974
- return {
975
- width: r,
976
- height: s,
977
- x: c,
978
- y: a
979
- };
980
- }
981
- function _e(t, e) {
982
- const i = it(t, !0, e === "fixed"), n = i.top + t.clientTop, o = i.left + t.clientLeft, r = K(t) ? Q(t) : V(1), s = t.clientWidth * r.x, c = t.clientHeight * r.y, a = o * r.x, m = n * r.y;
983
- return {
984
- width: s,
985
- height: c,
986
- x: a,
987
- y: m
988
- };
989
- }
990
- function Bt(t, e, i) {
991
- let n;
992
- if (e === "viewport")
993
- n = $e(t, i);
994
- else if (e === "document")
995
- n = Le(Y(t));
996
- else if (I(e))
997
- n = _e(e, i);
998
- else {
999
- const o = jt(t);
1000
- n = {
1001
- x: e.x - o.x,
1002
- y: e.y - o.y,
1003
- width: e.width,
1004
- height: e.height
1005
- };
1006
- }
1007
- return Z(n);
1008
- }
1009
- function Kt(t, e) {
1010
- const i = z(t);
1011
- return i === e || !I(i) || tt(i) ? !1 : q(i).position === "fixed" || Kt(i, e);
1012
- }
1013
- function Be(t, e) {
1014
- const i = e.get(t);
1015
- if (i)
1016
- return i;
1017
- let n = Ht(t, []).filter((c) => I(c) && et(c) !== "body"), o = null;
1018
- const r = q(t).position === "fixed";
1019
- let s = r ? z(t) : t;
1020
- for (; I(s) && !tt(s); ) {
1021
- const c = q(s), a = Rt(s);
1022
- !a && c.position === "fixed" && (o = null), (r ? !a && !o : !a && c.position === "static" && !!o && (o.position === "absolute" || o.position === "fixed") || rt(s) && !a && Kt(t, s)) ? n = n.filter((f) => f !== s) : o = c, s = z(s);
1023
- }
1024
- return e.set(t, n), n;
1025
- }
1026
- function Me(t) {
1027
- let {
1028
- element: e,
1029
- boundary: i,
1030
- rootBoundary: n,
1031
- strategy: o
1032
- } = t;
1033
- const s = [...i === "clippingAncestors" ? ut(e) ? [] : Be(e, this._c) : [].concat(i), n], c = Bt(e, s[0], o);
1034
- let a = c.top, m = c.right, f = c.bottom, l = c.left;
1035
- for (let g = 1; g < s.length; g++) {
1036
- const u = Bt(e, s[g], o);
1037
- a = M(u.top, a), m = X(u.right, m), f = X(u.bottom, f), l = M(u.left, l);
1038
- }
1039
- return {
1040
- width: m - l,
1041
- height: f - a,
1042
- x: l,
1043
- y: a
1044
- };
1045
- }
1046
- function ke(t) {
1047
- const {
1048
- width: e,
1049
- height: i
1050
- } = Vt(t);
1051
- return {
1052
- width: e,
1053
- height: i
1054
- };
1055
- }
1056
- function Ne(t, e, i) {
1057
- const n = K(e), o = Y(e), r = i === "fixed", s = it(t, !0, r, e);
1058
- let c = {
1059
- scrollLeft: 0,
1060
- scrollTop: 0
1061
- };
1062
- const a = V(0);
1063
- function m() {
1064
- a.x = mt(o);
1065
- }
1066
- if (n || !n && !r)
1067
- if ((et(e) !== "body" || rt(o)) && (c = dt(e)), n) {
1068
- const u = it(e, !0, r, e);
1069
- a.x = u.x + e.clientLeft, a.y = u.y + e.clientTop;
1070
- } else o && m();
1071
- r && !n && o && m();
1072
- const f = o && !n && !r ? Yt(o, c) : V(0), l = s.left + c.scrollLeft - a.x - f.x, g = s.top + c.scrollTop - a.y - f.y;
1073
- return {
1074
- x: l,
1075
- y: g,
1076
- width: s.width,
1077
- height: s.height
1078
- };
1079
- }
1080
- function pt(t) {
1081
- return q(t).position === "static";
1082
- }
1083
- function Mt(t, e) {
1084
- if (!K(t) || q(t).position === "fixed")
1085
- return null;
1086
- if (e)
1087
- return e(t);
1088
- let i = t.offsetParent;
1089
- return Y(t) === i && (i = i.ownerDocument.body), i;
1090
- }
1091
- function zt(t, e) {
1092
- const i = N(t);
1093
- if (ut(t))
1094
- return i;
1095
- if (!K(t)) {
1096
- let o = z(t);
1097
- for (; o && !tt(o); ) {
1098
- if (I(o) && !pt(o))
1099
- return o;
1100
- o = z(o);
1101
- }
1102
- return i;
1103
- }
1104
- let n = Mt(t, e);
1105
- for (; n && Se(n) && pt(n); )
1106
- n = Mt(n, e);
1107
- return n && tt(n) && pt(n) && !Rt(n) ? i : n || Ce(t) || i;
1108
- }
1109
- const Fe = async function(t) {
1110
- const e = this.getOffsetParent || zt, i = this.getDimensions, n = await i(t.floating);
1111
- return {
1112
- reference: Ne(t.reference, await e(t.floating), t.strategy),
1113
- floating: {
1114
- x: 0,
1115
- y: 0,
1116
- width: n.width,
1117
- height: n.height
1118
- }
1119
- };
1120
- };
1121
- function We(t) {
1122
- return q(t).direction === "rtl";
1123
- }
1124
- const Ie = {
1125
- convertOffsetParentRelativeRectToViewportRelativeRect: De,
1126
- getDocumentElement: Y,
1127
- getClippingRect: Me,
1128
- getOffsetParent: zt,
1129
- getElementRects: Fe,
1130
- getClientRects: Te,
1131
- getDimensions: ke,
1132
- getScale: Q,
1133
- isElement: I,
1134
- isRTL: We
1135
- }, Ke = ve, ze = me, Ue = be, Ge = ge, Je = Re, Qe = he, Ze = ue, tn = we, en = (t, e, i) => {
1136
- const n = /* @__PURE__ */ new Map(), o = {
1137
- platform: Ie,
1138
- ...i
1139
- }, r = {
1140
- ...o.platform,
1141
- _c: n
1142
- };
1143
- return fe(t, e, {
1144
- ...o,
1145
- platform: r
1146
- });
1147
- };
1148
- function qe(t) {
1149
- var e;
1150
- const { char: i, allowSpaces: n, allowToIncludeChar: o, allowedPrefixes: r, startOfLine: s, $position: c } = t, a = n && !o, m = te(i), f = new RegExp(`\\s${m}$`), l = s ? "^" : "", g = o ? "" : m, u = a ? new RegExp(`${l}${m}.*?(?=\\s${g}|$)`, "gm") : new RegExp(`${l}(?:^)?${m}[^\\s${g}]*`, "gm"), h = ((e = c.nodeBefore) == null ? void 0 : e.isText) && c.nodeBefore.text;
1151
- if (!h)
1152
- return null;
1153
- const v = c.pos - h.length, p = Array.from(h.matchAll(u)).pop();
1154
- if (!p || p.input === void 0 || p.index === void 0)
1155
- return null;
1156
- const b = p.input.slice(Math.max(0, p.index - 1), p.index), d = new RegExp(`^[${r == null ? void 0 : r.join("")}\0]?$`).test(b);
1157
- if (r !== null && !d)
1158
- return null;
1159
- const S = v + p.index;
1160
- let O = S + p[0].length;
1161
- return a && f.test(h.slice(O - 1, O + 1)) && (p[0] += " ", O += 1), S < c.pos && O >= c.pos ? {
1162
- range: {
1163
- from: S,
1164
- to: O
1165
- },
1166
- query: p[0].slice(i.length),
1167
- text: p[0]
1168
- } : null;
1169
- }
1170
- var He = new Gt("suggestion");
1171
- function Ve({
1172
- pluginKey: t = He,
1173
- editor: e,
1174
- char: i = "@",
1175
- allowSpaces: n = !1,
1176
- allowToIncludeChar: o = !1,
1177
- allowedPrefixes: r = [" "],
1178
- startOfLine: s = !1,
1179
- decorationTag: c = "span",
1180
- decorationClass: a = "suggestion",
1181
- decorationContent: m = "",
1182
- decorationEmptyClass: f = "is-empty",
1183
- command: l = () => null,
1184
- items: g = () => [],
1185
- render: u = () => ({}),
1186
- allow: h = () => !0,
1187
- findSuggestionMatch: v = qe,
1188
- shouldShow: p
1189
- }) {
1190
- let b;
1191
- const d = u == null ? void 0 : u(), S = () => {
1192
- const y = e.state.selection.$anchor.pos, A = e.view.coordsAtPos(y), { top: C, right: w, bottom: R, left: P } = A;
1193
- try {
1194
- return new DOMRect(P, C, w - P, R - C);
1195
- } catch {
1196
- return null;
1197
- }
1198
- }, O = (y, A) => A ? () => {
1199
- const C = t.getState(e.state), w = C == null ? void 0 : C.decorationId, R = y.dom.querySelector(`[data-decoration-id="${w}"]`);
1200
- return (R == null ? void 0 : R.getBoundingClientRect()) || null;
1201
- } : S;
1202
- function _(y, A) {
1203
- var C;
1204
- try {
1205
- const R = t.getState(y.state), P = R != null && R.decorationId ? y.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`) : null, T = {
1206
- // @ts-ignore editor is available in closure
1207
- editor: e,
1208
- range: (R == null ? void 0 : R.range) || { from: 0, to: 0 },
1209
- query: (R == null ? void 0 : R.query) || null,
1210
- text: (R == null ? void 0 : R.text) || null,
1211
- items: [],
1212
- command: (L) => l({ editor: e, range: (R == null ? void 0 : R.range) || { from: 0, to: 0 }, props: L }),
1213
- decorationNode: P,
1214
- clientRect: O(y, P)
1215
- };
1216
- (C = d == null ? void 0 : d.onExit) == null || C.call(d, T);
1217
- } catch {
1218
- }
1219
- const w = y.state.tr.setMeta(A, { exit: !0 });
1220
- y.dispatch(w);
1221
- }
1222
- const D = new Jt({
1223
- key: t,
1224
- view() {
1225
- return {
1226
- update: async (y, A) => {
1227
- var C, w, R, P, T, L, B;
1228
- const x = (C = this.key) == null ? void 0 : C.getState(A), $ = (w = this.key) == null ? void 0 : w.getState(y.state), E = x.active && $.active && x.range.from !== $.range.from, k = !x.active && $.active, G = x.active && !$.active, nt = !k && !G && x.query !== $.query, ot = k || E && nt, st = nt || E, gt = G || E && nt;
1229
- if (!ot && !st && !gt)
1230
- return;
1231
- const J = gt && !ot ? x : $, Ot = y.dom.querySelector(`[data-decoration-id="${J.decorationId}"]`);
1232
- b = {
1233
- editor: e,
1234
- range: J.range,
1235
- query: J.query,
1236
- text: J.text,
1237
- items: [],
1238
- command: (Ut) => l({
1239
- editor: e,
1240
- range: J.range,
1241
- props: Ut
1242
- }),
1243
- decorationNode: Ot,
1244
- clientRect: O(y, Ot)
1245
- }, ot && ((R = d == null ? void 0 : d.onBeforeStart) == null || R.call(d, b)), st && ((P = d == null ? void 0 : d.onBeforeUpdate) == null || P.call(d, b)), (st || ot) && (b.items = await g({
1246
- editor: e,
1247
- query: J.query
1248
- })), gt && ((T = d == null ? void 0 : d.onExit) == null || T.call(d, b)), st && ((L = d == null ? void 0 : d.onUpdate) == null || L.call(d, b)), ot && ((B = d == null ? void 0 : d.onStart) == null || B.call(d, b));
1249
- },
1250
- destroy: () => {
1251
- var y;
1252
- b && ((y = d == null ? void 0 : d.onExit) == null || y.call(d, b));
1253
- }
1254
- };
1255
- },
1256
- state: {
1257
- // Initialize the plugin's internal state.
1258
- init() {
1259
- return {
1260
- active: !1,
1261
- range: {
1262
- from: 0,
1263
- to: 0
1264
- },
1265
- query: null,
1266
- text: null,
1267
- composing: !1
1268
- };
1269
- },
1270
- // Apply changes to the plugin state from a view transaction.
1271
- apply(y, A, C, w) {
1272
- const { isEditable: R } = e, { composing: P } = e.view, { selection: T } = y, { empty: L, from: B } = T, x = { ...A }, $ = y.getMeta(t);
1273
- if ($ && $.exit)
1274
- return x.active = !1, x.decorationId = null, x.range = { from: 0, to: 0 }, x.query = null, x.text = null, x;
1275
- if (x.composing = P, R && (L || e.view.composing)) {
1276
- (B < A.range.from || B > A.range.to) && !P && !A.composing && (x.active = !1);
1277
- const E = v({
1278
- char: i,
1279
- allowSpaces: n,
1280
- allowToIncludeChar: o,
1281
- allowedPrefixes: r,
1282
- startOfLine: s,
1283
- $position: T.$from
1284
- }), k = `id_${Math.floor(Math.random() * 4294967295)}`;
1285
- E && h({
1286
- editor: e,
1287
- state: w,
1288
- range: E.range,
1289
- isActive: A.active
1290
- }) && (!p || p({
1291
- editor: e,
1292
- range: E.range,
1293
- query: E.query,
1294
- text: E.text,
1295
- transaction: y
1296
- })) ? (x.active = !0, x.decorationId = A.decorationId ? A.decorationId : k, x.range = E.range, x.query = E.query, x.text = E.text) : x.active = !1;
1297
- } else
1298
- x.active = !1;
1299
- return x.active || (x.decorationId = null, x.range = { from: 0, to: 0 }, x.query = null, x.text = null), x;
1300
- }
1301
- },
1302
- props: {
1303
- // Call the keydown hook if suggestion is active.
1304
- handleKeyDown(y, A) {
1305
- var C, w, R, P;
1306
- const { active: T, range: L } = D.getState(y.state);
1307
- if (!T)
1308
- return !1;
1309
- if (A.key === "Escape" || A.key === "Esc") {
1310
- const x = D.getState(y.state), $ = (C = b == null ? void 0 : b.decorationNode) != null ? C : null, E = $ ?? (x != null && x.decorationId ? y.dom.querySelector(`[data-decoration-id="${x.decorationId}"]`) : null);
1311
- if (((w = d == null ? void 0 : d.onKeyDown) == null ? void 0 : w.call(d, { view: y, event: A, range: x.range })) || !1)
1312
- return !0;
1313
- const G = {
1314
- editor: e,
1315
- range: x.range,
1316
- query: x.query,
1317
- text: x.text,
1318
- items: [],
1319
- command: (nt) => l({ editor: e, range: x.range, props: nt }),
1320
- decorationNode: E,
1321
- // If we have a cached decoration node, use it for the clientRect
1322
- // to avoid another DOM lookup. If not, leave clientRect null and
1323
- // let consumer decide if they want to query.
1324
- clientRect: E ? () => E.getBoundingClientRect() || null : null
1325
- };
1326
- return (R = d == null ? void 0 : d.onExit) == null || R.call(d, G), _(y, t), !0;
1327
- }
1328
- return ((P = d == null ? void 0 : d.onKeyDown) == null ? void 0 : P.call(d, { view: y, event: A, range: L })) || !1;
1329
- },
1330
- // Setup decorator on the currently active suggestion.
1331
- decorations(y) {
1332
- const { active: A, range: C, decorationId: w, query: R } = D.getState(y);
1333
- if (!A)
1334
- return null;
1335
- const P = !(R != null && R.length), T = [a];
1336
- return P && T.push(f), Qt.create(y.doc, [
1337
- Zt.inline(C.from, C.to, {
1338
- nodeName: c,
1339
- class: T.join(" "),
1340
- "data-decoration-id": w,
1341
- "data-decoration-content": m
1342
- })
1343
- ]);
1344
- }
1345
- }
1346
- });
1347
- return D;
1348
- }
1349
- var nn = Ve;
1350
- export {
1351
- Ve as S,
1352
- Ze as a,
1353
- Je as b,
1354
- en as c,
1355
- ze as d,
1356
- tn as e,
1357
- Ge as f,
1358
- Qe as h,
1359
- nn as i,
1360
- Ke as o,
1361
- Ue as s
1362
- };