@clevertask/scribe 0.1.3 → 0.1.5

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 (85) hide show
  1. package/README.md +3 -0
  2. package/dist/BarMenu-V1uRL3bt.js +272 -0
  3. package/dist/assets/index.css +1 -1
  4. package/dist/components/Menu/BarMenu.d.ts.map +1 -1
  5. package/dist/components/Menu/BarMenu.js +2 -10
  6. package/dist/components/Menu/BubbleMenu.d.ts.map +1 -1
  7. package/dist/components/Menu/BubbleMenu.js +165 -2090
  8. package/dist/components/Menu/LinkBubbleMenu.d.ts +8 -0
  9. package/dist/components/Menu/LinkBubbleMenu.d.ts.map +1 -0
  10. package/dist/components/Menu/LinkBubbleMenu.js +78 -0
  11. package/dist/components/Menu/LinkEditor.d.ts +14 -0
  12. package/dist/components/Menu/LinkEditor.d.ts.map +1 -0
  13. package/dist/components/Menu/LinkEditor.js +140 -0
  14. package/dist/components/Menu/Mobile/ListOptionBar.d.ts +1 -1
  15. package/dist/components/Menu/Mobile/ListOptionBar.d.ts.map +1 -1
  16. package/dist/components/Menu/Mobile/ListOptionBar.js +38 -44
  17. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts +5 -0
  18. package/dist/components/Menu/linkBubbleMenuPlugin.d.ts.map +1 -0
  19. package/dist/components/Menu/linkBubbleMenuPlugin.js +7 -0
  20. package/dist/components/Menu/linkUrl.d.ts +2 -0
  21. package/dist/components/Menu/linkUrl.d.ts.map +1 -0
  22. package/dist/components/Menu/linkUrl.js +21 -0
  23. package/dist/components/Scribe/extension/emoji/EmojiList.js +58 -45
  24. package/dist/components/Scribe/extension/emoji/suggest.d.ts +2 -2
  25. package/dist/components/Scribe/extension/emoji/suggest.d.ts.map +1 -1
  26. package/dist/components/Scribe/extension/emoji/suggest.js +39 -43
  27. package/dist/components/Scribe/extension/extension-link.d.ts.map +1 -1
  28. package/dist/components/Scribe/extension/extension-link.js +2 -4
  29. package/dist/components/Scribe/extension/extension-markdown-paste.d.ts.map +1 -1
  30. package/dist/components/Scribe/extension/extension-markdown-paste.js +50 -45
  31. package/dist/components/Scribe/extension/extension-selectedText.d.ts.map +1 -1
  32. package/dist/components/Scribe/extension/extension-selectedText.js +10 -12
  33. package/dist/components/Scribe/extension/getPopupMountTarget.d.ts.map +1 -1
  34. package/dist/components/Scribe/extension/getPopupMountTarget.js +12 -15
  35. package/dist/components/Scribe/extension/index.d.ts +4 -4
  36. package/dist/components/Scribe/extension/index.d.ts.map +1 -1
  37. package/dist/components/Scribe/extension/index.js +2 -37169
  38. package/dist/components/Scribe/extension/slashCommand/SlashCommandList.js +3369 -3731
  39. package/dist/components/Scribe/extension/slashCommand/index.js +2 -6
  40. package/dist/components/Scribe/extension/slashCommand/items.d.ts.map +1 -1
  41. package/dist/components/Scribe/extension/slashCommand/items.js +177 -176
  42. package/dist/components/Scribe/extension/slashCommand/renderItems.d.ts.map +1 -1
  43. package/dist/components/Scribe/extension/slashCommand/renderItems.js +35 -41
  44. package/dist/components/Scribe/extension/tableOfContents.js +153 -180
  45. package/dist/components/Scribe/index.d.ts.map +1 -1
  46. package/dist/components/Scribe/index.js +113 -153
  47. package/dist/dist-BQjH-i-q.js +7016 -0
  48. package/dist/dist-CnXCIcnl.js +3506 -0
  49. package/dist/dist-RuuEA1GJ.js +686 -0
  50. package/dist/extension-CZOsheCI.js +56236 -0
  51. package/dist/extension-link-DZID_SYl.js +908 -0
  52. package/dist/floating-ui.dom-rih69525.js +928 -0
  53. package/dist/html-to-markdown-CrNOkSye.js +497 -0
  54. package/dist/icons/ToolbarIcons.d.ts.map +1 -1
  55. package/dist/icons/ToolbarIcons.js +76 -135
  56. package/dist/main.css +10 -0
  57. package/dist/main.js +7 -15
  58. package/dist/markdown-to-html-DEczPfuq.js +1458 -0
  59. package/dist/menus-CzX7kyXn.js +633 -0
  60. package/dist/purify.es-DF9CW1cl.js +767 -0
  61. package/dist/rolldown-runtime-B8UxIWdF.js +7 -0
  62. package/dist/slashCommand-B7CRIaKG.js +429 -0
  63. package/dist/tables-CjOC70rm.js +1345 -0
  64. package/dist/tippy.esm-D9LL2xiE.js +1713 -0
  65. package/dist/utils/convert-legacy-math-delimiters.d.ts.map +1 -1
  66. package/dist/utils/convert-legacy-math-delimiters.js +7 -13
  67. package/dist/utils/create-scribe-editor.js +2 -31
  68. package/dist/utils/html-to-markdown.d.ts.map +1 -1
  69. package/dist/utils/html-to-markdown.js +2 -600
  70. package/dist/utils/index.js +24 -12
  71. package/dist/utils/is-in-viewport.d.ts.map +1 -1
  72. package/dist/utils/is-in-viewport.js +6 -6
  73. package/dist/utils/markdown-to-html.d.ts.map +1 -1
  74. package/dist/utils/markdown-to-html.js +2 -5
  75. package/dist/vite-env.d.js +0 -1
  76. package/package.json +40 -38
  77. package/dist/BarMenu-DaKIz3zZ.js +0 -327
  78. package/dist/extension-link-Ch_T7WWG.js +0 -1030
  79. package/dist/index-BiBV5TQx.js +0 -13513
  80. package/dist/index-CqzMmrnw.js +0 -1410
  81. package/dist/index-DxF-1P4n.js +0 -834
  82. package/dist/index-V-gN11Y9.js +0 -249
  83. package/dist/markdown-to-html-pL7ckd-m.js +0 -1135
  84. package/dist/purify.es-exIQuqhb.js +0 -595
  85. package/dist/tippy.esm-DLHdsnfG.js +0 -1711
@@ -1,2091 +1,166 @@
1
- import { jsx as E } from "react/jsx-runtime";
2
- import { Flex as ve, IconButton as ye } from "@radix-ui/themes";
3
- import { a as Bt, u as be } from "../../index-DxF-1P4n.js";
4
- import { b as Vt, P as vt, p as xe, q as zt, N as Oe, a as Nt, r as Ce, s as Se } from "../../index-BiBV5TQx.js";
5
- import { C as Te } from "../../index-CqzMmrnw.js";
6
- import _t, { useRef as k, useState as Wt, useEffect as it, useLayoutEffect as Ee, useCallback as Re } from "react";
7
- import { createPortal as kt } from "react-dom";
8
- import { getPopupMountTarget as Ie } from "../Scribe/extension/getPopupMountTarget.js";
9
- const Ft = ["top", "right", "bottom", "left"], St = ["start", "end"], Tt = /* @__PURE__ */ Ft.reduce((t, e) => t.concat(e, e + "-" + St[0], e + "-" + St[1]), []), K = Math.min, D = Math.max, st = Math.round, $ = (t) => ({
10
- x: t,
11
- y: t
12
- }), Le = {
13
- left: "right",
14
- right: "left",
15
- bottom: "top",
16
- top: "bottom"
17
- };
18
- function gt(t, e, n) {
19
- return D(t, K(e, n));
20
- }
21
- function j(t, e) {
22
- return typeof t == "function" ? t(e) : t;
23
- }
24
- function V(t) {
25
- return t.split("-")[0];
26
- }
27
- function N(t) {
28
- return t.split("-")[1];
29
- }
30
- function $t(t) {
31
- return t === "x" ? "y" : "x";
32
- }
33
- function yt(t) {
34
- return t === "y" ? "height" : "width";
35
- }
36
- function F(t) {
37
- const e = t[0];
38
- return e === "t" || e === "b" ? "y" : "x";
39
- }
40
- function bt(t) {
41
- return $t(F(t));
42
- }
43
- function Kt(t, e, n) {
44
- n === void 0 && (n = !1);
45
- const o = N(t), i = bt(t), s = yt(i);
46
- let r = i === "x" ? o === (n ? "end" : "start") ? "right" : "left" : o === "start" ? "bottom" : "top";
47
- return e.reference[s] > e.floating[s] && (r = lt(r)), [r, lt(r)];
48
- }
49
- function De(t) {
50
- const e = lt(t);
51
- return [rt(t), e, rt(e)];
52
- }
53
- function rt(t) {
54
- return t.includes("start") ? t.replace("start", "end") : t.replace("end", "start");
55
- }
56
- const Et = ["left", "right"], Rt = ["right", "left"], He = ["top", "bottom"], Ae = ["bottom", "top"];
57
- function Me(t, e, n) {
58
- switch (t) {
59
- case "top":
60
- case "bottom":
61
- return n ? e ? Rt : Et : e ? Et : Rt;
62
- case "left":
63
- case "right":
64
- return e ? He : Ae;
65
- default:
66
- return [];
67
- }
68
- }
69
- function Pe(t, e, n, o) {
70
- const i = N(t);
71
- let s = Me(V(t), n === "start", o);
72
- return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(rt)))), s;
73
- }
74
- function lt(t) {
75
- const e = V(t);
76
- return Le[e] + t.slice(e.length);
77
- }
78
- function Ue(t) {
79
- return {
80
- top: 0,
81
- right: 0,
82
- bottom: 0,
83
- left: 0,
84
- ...t
85
- };
86
- }
87
- function xt(t) {
88
- return typeof t != "number" ? Ue(t) : {
89
- top: t,
90
- right: t,
91
- bottom: t,
92
- left: t
93
- };
94
- }
95
- function Q(t) {
96
- const {
97
- x: e,
98
- y: n,
99
- width: o,
100
- height: i
101
- } = t;
102
- return {
103
- width: o,
104
- height: i,
105
- top: n,
106
- left: e,
107
- right: e + o,
108
- bottom: n + i,
109
- x: e,
110
- y: n
111
- };
112
- }
113
- function It(t, e, n) {
114
- let {
115
- reference: o,
116
- floating: i
117
- } = t;
118
- const s = F(e), r = bt(e), l = yt(r), c = V(e), p = s === "y", f = o.x + o.width / 2 - i.width / 2, a = o.y + o.height / 2 - i.height / 2, d = o[l] / 2 - i[l] / 2;
119
- let u;
120
- switch (c) {
121
- case "top":
122
- u = {
123
- x: f,
124
- y: o.y - i.height
125
- };
126
- break;
127
- case "bottom":
128
- u = {
129
- x: f,
130
- y: o.y + o.height
131
- };
132
- break;
133
- case "right":
134
- u = {
135
- x: o.x + o.width,
136
- y: a
137
- };
138
- break;
139
- case "left":
140
- u = {
141
- x: o.x - i.width,
142
- y: a
143
- };
144
- break;
145
- default:
146
- u = {
147
- x: o.x,
148
- y: o.y
149
- };
150
- }
151
- switch (N(e)) {
152
- case "start":
153
- u[r] -= d * (n && p ? -1 : 1);
154
- break;
155
- case "end":
156
- u[r] += d * (n && p ? -1 : 1);
157
- break;
158
- }
159
- return u;
160
- }
161
- async function Be(t, e) {
162
- var n;
163
- e === void 0 && (e = {});
164
- const {
165
- x: o,
166
- y: i,
167
- platform: s,
168
- rects: r,
169
- elements: l,
170
- strategy: c
171
- } = t, {
172
- boundary: p = "clippingAncestors",
173
- rootBoundary: f = "viewport",
174
- elementContext: a = "floating",
175
- altBoundary: d = !1,
176
- padding: u = 0
177
- } = j(e, t), h = xt(u), m = l[d ? a === "floating" ? "reference" : "floating" : a], v = Q(await s.getClippingRect({
178
- element: (n = await (s.isElement == null ? void 0 : s.isElement(m))) == null || n ? m : m.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(l.floating)),
179
- boundary: p,
180
- rootBoundary: f,
181
- strategy: c
182
- })), y = a === "floating" ? {
183
- x: o,
184
- y: i,
185
- width: r.floating.width,
186
- height: r.floating.height
187
- } : r.reference, w = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(l.floating)), b = await (s.isElement == null ? void 0 : s.isElement(w)) ? await (s.getScale == null ? void 0 : s.getScale(w)) || {
188
- x: 1,
189
- y: 1
190
- } : {
191
- x: 1,
192
- y: 1
193
- }, C = Q(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
194
- elements: l,
195
- rect: y,
196
- offsetParent: w,
197
- strategy: c
198
- }) : y);
199
- return {
200
- top: (v.top - C.top + h.top) / b.y,
201
- bottom: (C.bottom - v.bottom + h.bottom) / b.y,
202
- left: (v.left - C.left + h.left) / b.x,
203
- right: (C.right - v.right + h.right) / b.x
204
- };
205
- }
206
- const Ve = 50, ze = async (t, e, n) => {
207
- const {
208
- placement: o = "bottom",
209
- strategy: i = "absolute",
210
- middleware: s = [],
211
- platform: r
212
- } = n, l = r.detectOverflow ? r : {
213
- ...r,
214
- detectOverflow: Be
215
- }, c = await (r.isRTL == null ? void 0 : r.isRTL(e));
216
- let p = await r.getElementRects({
217
- reference: t,
218
- floating: e,
219
- strategy: i
220
- }), {
221
- x: f,
222
- y: a
223
- } = It(p, o, c), d = o, u = 0;
224
- const h = {};
225
- for (let g = 0; g < s.length; g++) {
226
- const m = s[g];
227
- if (!m)
228
- continue;
229
- const {
230
- name: v,
231
- fn: y
232
- } = m, {
233
- x: w,
234
- y: b,
235
- data: C,
236
- reset: O
237
- } = await y({
238
- x: f,
239
- y: a,
240
- initialPlacement: o,
241
- placement: d,
242
- strategy: i,
243
- middlewareData: h,
244
- rects: p,
245
- platform: l,
246
- elements: {
247
- reference: t,
248
- floating: e
249
- }
250
- });
251
- f = w ?? f, a = b ?? a, h[v] = {
252
- ...h[v],
253
- ...C
254
- }, O && u < Ve && (u++, typeof O == "object" && (O.placement && (d = O.placement), O.rects && (p = O.rects === !0 ? await r.getElementRects({
255
- reference: t,
256
- floating: e,
257
- strategy: i
258
- }) : O.rects), {
259
- x: f,
260
- y: a
261
- } = It(p, d, c)), g = -1);
262
- }
263
- return {
264
- x: f,
265
- y: a,
266
- placement: d,
267
- strategy: i,
268
- middlewareData: h
269
- };
270
- }, Ne = (t) => ({
271
- name: "arrow",
272
- options: t,
273
- async fn(e) {
274
- const {
275
- x: n,
276
- y: o,
277
- placement: i,
278
- rects: s,
279
- platform: r,
280
- elements: l,
281
- middlewareData: c
282
- } = e, {
283
- element: p,
284
- padding: f = 0
285
- } = j(t, e) || {};
286
- if (p == null)
287
- return {};
288
- const a = xt(f), d = {
289
- x: n,
290
- y: o
291
- }, u = bt(i), h = yt(u), g = await r.getDimensions(p), m = u === "y", v = m ? "top" : "left", y = m ? "bottom" : "right", w = m ? "clientHeight" : "clientWidth", b = s.reference[h] + s.reference[u] - d[u] - s.floating[h], C = d[u] - s.reference[u], O = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(p));
292
- let R = O ? O[w] : 0;
293
- (!R || !await (r.isElement == null ? void 0 : r.isElement(O))) && (R = l.floating[w] || s.floating[h]);
294
- const U = b / 2 - C / 2, I = R / 2 - g[h] / 2 - 1, x = K(a[v], I), S = K(a[y], I), L = x, H = R - g[h] - S, T = R / 2 - g[h] / 2 + U, z = gt(L, T, H), B = !c.arrow && N(i) != null && T !== z && s.reference[h] / 2 - (T < L ? x : S) - g[h] / 2 < 0, A = B ? T < L ? T - L : T - H : 0;
295
- return {
296
- [u]: d[u] + A,
297
- data: {
298
- [u]: z,
299
- centerOffset: T - z - A,
300
- ...B && {
301
- alignmentOffset: A
302
- }
303
- },
304
- reset: B
305
- };
306
- }
307
- });
308
- function _e(t, e, n) {
309
- return (t ? [...n.filter((i) => N(i) === t), ...n.filter((i) => N(i) !== t)] : n.filter((i) => V(i) === i)).filter((i) => t ? N(i) === t || (e ? rt(i) !== i : !1) : !0);
310
- }
311
- const We = function(t) {
312
- return t === void 0 && (t = {}), {
313
- name: "autoPlacement",
314
- options: t,
315
- async fn(e) {
316
- var n, o, i;
317
- const {
318
- rects: s,
319
- middlewareData: r,
320
- placement: l,
321
- platform: c,
322
- elements: p
323
- } = e, {
324
- crossAxis: f = !1,
325
- alignment: a,
326
- allowedPlacements: d = Tt,
327
- autoAlignment: u = !0,
328
- ...h
329
- } = j(t, e), g = a !== void 0 || d === Tt ? _e(a || null, u, d) : d, m = await c.detectOverflow(e, h), v = ((n = r.autoPlacement) == null ? void 0 : n.index) || 0, y = g[v];
330
- if (y == null)
331
- return {};
332
- const w = Kt(y, s, await (c.isRTL == null ? void 0 : c.isRTL(p.floating)));
333
- if (l !== y)
334
- return {
335
- reset: {
336
- placement: g[0]
337
- }
338
- };
339
- const b = [m[V(y)], m[w[0]], m[w[1]]], C = [...((o = r.autoPlacement) == null ? void 0 : o.overflows) || [], {
340
- placement: y,
341
- overflows: b
342
- }], O = g[v + 1];
343
- if (O)
344
- return {
345
- data: {
346
- index: v + 1,
347
- overflows: C
348
- },
349
- reset: {
350
- placement: O
351
- }
352
- };
353
- const R = C.map((x) => {
354
- const S = N(x.placement);
355
- return [x.placement, S && f ? (
356
- // Check along the mainAxis and main crossAxis side.
357
- x.overflows.slice(0, 2).reduce((L, H) => L + H, 0)
358
- ) : (
359
- // Check only the mainAxis.
360
- x.overflows[0]
361
- ), x.overflows];
362
- }).sort((x, S) => x[1] - S[1]), I = ((i = R.filter((x) => x[2].slice(
363
- 0,
364
- // Aligned placements should not check their opposite crossAxis
365
- // side.
366
- N(x[0]) ? 2 : 3
367
- ).every((S) => S <= 0))[0]) == null ? void 0 : i[0]) || R[0][0];
368
- return I !== l ? {
369
- data: {
370
- index: v + 1,
371
- overflows: C
372
- },
373
- reset: {
374
- placement: I
375
- }
376
- } : {};
377
- }
378
- };
379
- }, ke = function(t) {
380
- return t === void 0 && (t = {}), {
381
- name: "flip",
382
- options: t,
383
- async fn(e) {
384
- var n, o;
385
- const {
386
- placement: i,
387
- middlewareData: s,
388
- rects: r,
389
- initialPlacement: l,
390
- platform: c,
391
- elements: p
392
- } = e, {
393
- mainAxis: f = !0,
394
- crossAxis: a = !0,
395
- fallbackPlacements: d,
396
- fallbackStrategy: u = "bestFit",
397
- fallbackAxisSideDirection: h = "none",
398
- flipAlignment: g = !0,
399
- ...m
400
- } = j(t, e);
401
- if ((n = s.arrow) != null && n.alignmentOffset)
402
- return {};
403
- const v = V(i), y = F(l), w = V(l) === l, b = await (c.isRTL == null ? void 0 : c.isRTL(p.floating)), C = d || (w || !g ? [lt(l)] : De(l)), O = h !== "none";
404
- !d && O && C.push(...Pe(l, g, h, b));
405
- const R = [l, ...C], U = await c.detectOverflow(e, m), I = [];
406
- let x = ((o = s.flip) == null ? void 0 : o.overflows) || [];
407
- if (f && I.push(U[v]), a) {
408
- const T = Kt(i, r, b);
409
- I.push(U[T[0]], U[T[1]]);
410
- }
411
- if (x = [...x, {
412
- placement: i,
413
- overflows: I
414
- }], !I.every((T) => T <= 0)) {
415
- var S, L;
416
- const T = (((S = s.flip) == null ? void 0 : S.index) || 0) + 1, z = R[T];
417
- if (z && (!(a === "alignment" ? y !== F(z) : !1) || // We leave the current main axis only if every placement on that axis
418
- // overflows the main axis.
419
- x.every((M) => F(M.placement) === y ? M.overflows[0] > 0 : !0)))
420
- return {
421
- data: {
422
- index: T,
423
- overflows: x
424
- },
425
- reset: {
426
- placement: z
427
- }
428
- };
429
- let B = (L = x.filter((A) => A.overflows[0] <= 0).sort((A, M) => A.overflows[1] - M.overflows[1])[0]) == null ? void 0 : L.placement;
430
- if (!B)
431
- switch (u) {
432
- case "bestFit": {
433
- var H;
434
- const A = (H = x.filter((M) => {
435
- if (O) {
436
- const q = F(M.placement);
437
- return q === y || // Create a bias to the `y` side axis due to horizontal
438
- // reading directions favoring greater width.
439
- q === "y";
440
- }
441
- return !0;
442
- }).map((M) => [M.placement, M.overflows.filter((q) => q > 0).reduce((q, we) => q + we, 0)]).sort((M, q) => M[1] - q[1])[0]) == null ? void 0 : H[0];
443
- A && (B = A);
444
- break;
445
- }
446
- case "initialPlacement":
447
- B = l;
448
- break;
449
- }
450
- if (i !== B)
451
- return {
452
- reset: {
453
- placement: B
454
- }
455
- };
456
- }
457
- return {};
458
- }
459
- };
460
- };
461
- function Lt(t, e) {
462
- return {
463
- top: t.top - e.height,
464
- right: t.right - e.width,
465
- bottom: t.bottom - e.height,
466
- left: t.left - e.width
467
- };
468
- }
469
- function Dt(t) {
470
- return Ft.some((e) => t[e] >= 0);
471
- }
472
- const Fe = function(t) {
473
- return t === void 0 && (t = {}), {
474
- name: "hide",
475
- options: t,
476
- async fn(e) {
477
- const {
478
- rects: n,
479
- platform: o
480
- } = e, {
481
- strategy: i = "referenceHidden",
482
- ...s
483
- } = j(t, e);
484
- switch (i) {
485
- case "referenceHidden": {
486
- const r = await o.detectOverflow(e, {
487
- ...s,
488
- elementContext: "reference"
489
- }), l = Lt(r, n.reference);
490
- return {
491
- data: {
492
- referenceHiddenOffsets: l,
493
- referenceHidden: Dt(l)
494
- }
495
- };
496
- }
497
- case "escaped": {
498
- const r = await o.detectOverflow(e, {
499
- ...s,
500
- altBoundary: !0
501
- }), l = Lt(r, n.floating);
502
- return {
503
- data: {
504
- escapedOffsets: l,
505
- escaped: Dt(l)
506
- }
507
- };
508
- }
509
- default:
510
- return {};
511
- }
512
- }
513
- };
514
- };
515
- function jt(t) {
516
- const e = K(...t.map((s) => s.left)), n = K(...t.map((s) => s.top)), o = D(...t.map((s) => s.right)), i = D(...t.map((s) => s.bottom));
517
- return {
518
- x: e,
519
- y: n,
520
- width: o - e,
521
- height: i - n
522
- };
523
- }
524
- function $e(t) {
525
- const e = t.slice().sort((i, s) => i.y - s.y), n = [];
526
- let o = null;
527
- for (let i = 0; i < e.length; i++) {
528
- const s = e[i];
529
- !o || s.y - o.y > o.height / 2 ? n.push([s]) : n[n.length - 1].push(s), o = s;
530
- }
531
- return n.map((i) => Q(jt(i)));
532
- }
533
- const Ke = function(t) {
534
- return t === void 0 && (t = {}), {
535
- name: "inline",
536
- options: t,
537
- async fn(e) {
538
- const {
539
- placement: n,
540
- elements: o,
541
- rects: i,
542
- platform: s,
543
- strategy: r
544
- } = e, {
545
- padding: l = 2,
546
- x: c,
547
- y: p
548
- } = j(t, e), f = Array.from(await (s.getClientRects == null ? void 0 : s.getClientRects(o.reference)) || []), a = $e(f), d = Q(jt(f)), u = xt(l);
549
- function h() {
550
- if (a.length === 2 && a[0].left > a[1].right && c != null && p != null)
551
- return a.find((m) => c > m.left - u.left && c < m.right + u.right && p > m.top - u.top && p < m.bottom + u.bottom) || d;
552
- if (a.length >= 2) {
553
- if (F(n) === "y") {
554
- const x = a[0], S = a[a.length - 1], L = V(n) === "top", H = x.top, T = S.bottom, z = L ? x.left : S.left, B = L ? x.right : S.right, A = B - z, M = T - H;
555
- return {
556
- top: H,
557
- bottom: T,
558
- left: z,
559
- right: B,
560
- width: A,
561
- height: M,
562
- x: z,
563
- y: H
564
- };
565
- }
566
- const m = V(n) === "left", v = D(...a.map((x) => x.right)), y = K(...a.map((x) => x.left)), w = a.filter((x) => m ? x.left === y : x.right === v), b = w[0].top, C = w[w.length - 1].bottom, O = y, R = v, U = R - O, I = C - b;
567
- return {
568
- top: b,
569
- bottom: C,
570
- left: O,
571
- right: R,
572
- width: U,
573
- height: I,
574
- x: O,
575
- y: b
576
- };
577
- }
578
- return d;
579
- }
580
- const g = await s.getElementRects({
581
- reference: {
582
- getBoundingClientRect: h
583
- },
584
- floating: o.floating,
585
- strategy: r
586
- });
587
- return i.reference.x !== g.reference.x || i.reference.y !== g.reference.y || i.reference.width !== g.reference.width || i.reference.height !== g.reference.height ? {
588
- reset: {
589
- rects: g
590
- }
591
- } : {};
592
- }
593
- };
594
- }, je = /* @__PURE__ */ new Set(["left", "top"]);
595
- async function Ye(t, e) {
596
- const {
597
- placement: n,
598
- platform: o,
599
- elements: i
600
- } = t, s = await (o.isRTL == null ? void 0 : o.isRTL(i.floating)), r = V(n), l = N(n), c = F(n) === "y", p = je.has(r) ? -1 : 1, f = s && c ? -1 : 1, a = j(e, t);
601
- let {
602
- mainAxis: d,
603
- crossAxis: u,
604
- alignmentAxis: h
605
- } = typeof a == "number" ? {
606
- mainAxis: a,
607
- crossAxis: 0,
608
- alignmentAxis: null
609
- } : {
610
- mainAxis: a.mainAxis || 0,
611
- crossAxis: a.crossAxis || 0,
612
- alignmentAxis: a.alignmentAxis
613
- };
614
- return l && typeof h == "number" && (u = l === "end" ? h * -1 : h), c ? {
615
- x: u * f,
616
- y: d * p
617
- } : {
618
- x: d * p,
619
- y: u * f
620
- };
621
- }
622
- const Xe = function(t) {
623
- return t === void 0 && (t = 0), {
624
- name: "offset",
625
- options: t,
626
- async fn(e) {
627
- var n, o;
628
- const {
629
- x: i,
630
- y: s,
631
- placement: r,
632
- middlewareData: l
633
- } = e, c = await Ye(e, t);
634
- return r === ((n = l.offset) == null ? void 0 : n.placement) && (o = l.arrow) != null && o.alignmentOffset ? {} : {
635
- x: i + c.x,
636
- y: s + c.y,
637
- data: {
638
- ...c,
639
- placement: r
640
- }
641
- };
642
- }
643
- };
644
- }, qe = function(t) {
645
- return t === void 0 && (t = {}), {
646
- name: "shift",
647
- options: t,
648
- async fn(e) {
649
- const {
650
- x: n,
651
- y: o,
652
- placement: i,
653
- platform: s
654
- } = e, {
655
- mainAxis: r = !0,
656
- crossAxis: l = !1,
657
- limiter: c = {
658
- fn: (v) => {
659
- let {
660
- x: y,
661
- y: w
662
- } = v;
663
- return {
664
- x: y,
665
- y: w
666
- };
667
- }
668
- },
669
- ...p
670
- } = j(t, e), f = {
671
- x: n,
672
- y: o
673
- }, a = await s.detectOverflow(e, p), d = F(V(i)), u = $t(d);
674
- let h = f[u], g = f[d];
675
- if (r) {
676
- const v = u === "y" ? "top" : "left", y = u === "y" ? "bottom" : "right", w = h + a[v], b = h - a[y];
677
- h = gt(w, h, b);
678
- }
679
- if (l) {
680
- const v = d === "y" ? "top" : "left", y = d === "y" ? "bottom" : "right", w = g + a[v], b = g - a[y];
681
- g = gt(w, g, b);
682
- }
683
- const m = c.fn({
684
- ...e,
685
- [u]: h,
686
- [d]: g
687
- });
688
- return {
689
- ...m,
690
- data: {
691
- x: m.x - n,
692
- y: m.y - o,
693
- enabled: {
694
- [u]: r,
695
- [d]: l
696
- }
697
- }
698
- };
699
- }
700
- };
701
- }, Ge = function(t) {
702
- return t === void 0 && (t = {}), {
703
- name: "size",
704
- options: t,
705
- async fn(e) {
706
- var n, o;
707
- const {
708
- placement: i,
709
- rects: s,
710
- platform: r,
711
- elements: l
712
- } = e, {
713
- apply: c = () => {
714
- },
715
- ...p
716
- } = j(t, e), f = await r.detectOverflow(e, p), a = V(i), d = N(i), u = F(i) === "y", {
717
- width: h,
718
- height: g
719
- } = s.floating;
720
- let m, v;
721
- a === "top" || a === "bottom" ? (m = a, v = d === (await (r.isRTL == null ? void 0 : r.isRTL(l.floating)) ? "start" : "end") ? "left" : "right") : (v = a, m = d === "end" ? "top" : "bottom");
722
- const y = g - f.top - f.bottom, w = h - f.left - f.right, b = K(g - f[m], y), C = K(h - f[v], w), O = !e.middlewareData.shift;
723
- let R = b, U = C;
724
- if ((n = e.middlewareData.shift) != null && n.enabled.x && (U = w), (o = e.middlewareData.shift) != null && o.enabled.y && (R = y), O && !d) {
725
- const x = D(f.left, 0), S = D(f.right, 0), L = D(f.top, 0), H = D(f.bottom, 0);
726
- u ? U = h - 2 * (x !== 0 || S !== 0 ? x + S : D(f.left, f.right)) : R = g - 2 * (L !== 0 || H !== 0 ? L + H : D(f.top, f.bottom));
727
- }
728
- await c({
729
- ...e,
730
- availableWidth: U,
731
- availableHeight: R
732
- });
733
- const I = await r.getDimensions(l.floating);
734
- return h !== I.width || g !== I.height ? {
735
- reset: {
736
- rects: !0
737
- }
738
- } : {};
739
- }
740
- };
741
- };
742
- function at() {
743
- return typeof window < "u";
744
- }
745
- function et(t) {
746
- return Yt(t) ? (t.nodeName || "").toLowerCase() : "#document";
747
- }
748
- function P(t) {
749
- var e;
750
- return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
751
- }
752
- function Y(t) {
753
- var e;
754
- return (e = (Yt(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
755
- }
756
- function Yt(t) {
757
- return at() ? t instanceof Node || t instanceof P(t).Node : !1;
758
- }
759
- function _(t) {
760
- return at() ? t instanceof Element || t instanceof P(t).Element : !1;
761
- }
762
- function X(t) {
763
- return at() ? t instanceof HTMLElement || t instanceof P(t).HTMLElement : !1;
764
- }
765
- function Ht(t) {
766
- return !at() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof P(t).ShadowRoot;
767
- }
768
- function ot(t) {
769
- const {
770
- overflow: e,
771
- overflowX: n,
772
- overflowY: o,
773
- display: i
774
- } = W(t);
775
- return /auto|scroll|overlay|hidden|clip/.test(e + o + n) && i !== "inline" && i !== "contents";
776
- }
777
- function Ze(t) {
778
- return /^(table|td|th)$/.test(et(t));
779
- }
780
- function ct(t) {
781
- try {
782
- if (t.matches(":popover-open"))
783
- return !0;
784
- } catch {
785
- }
786
- try {
787
- return t.matches(":modal");
788
- } catch {
789
- return !1;
790
- }
791
- }
792
- const Je = /transform|translate|scale|rotate|perspective|filter/, Qe = /paint|layout|strict|content/, Z = (t) => !!t && t !== "none";
793
- let dt;
794
- function Ot(t) {
795
- const e = _(t) ? W(t) : t;
796
- return Z(e.transform) || Z(e.translate) || Z(e.scale) || Z(e.rotate) || Z(e.perspective) || !Ct() && (Z(e.backdropFilter) || Z(e.filter)) || Je.test(e.willChange || "") || Qe.test(e.contain || "");
797
- }
798
- function ti(t) {
799
- let e = G(t);
800
- for (; X(e) && !tt(e); ) {
801
- if (Ot(e))
802
- return e;
803
- if (ct(e))
804
- return null;
805
- e = G(e);
806
- }
807
- return null;
808
- }
809
- function Ct() {
810
- return dt == null && (dt = typeof CSS < "u" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none")), dt;
811
- }
812
- function tt(t) {
813
- return /^(html|body|#document)$/.test(et(t));
814
- }
815
- function W(t) {
816
- return P(t).getComputedStyle(t);
817
- }
818
- function ut(t) {
819
- return _(t) ? {
820
- scrollLeft: t.scrollLeft,
821
- scrollTop: t.scrollTop
822
- } : {
823
- scrollLeft: t.scrollX,
824
- scrollTop: t.scrollY
825
- };
826
- }
827
- function G(t) {
828
- if (et(t) === "html")
829
- return t;
830
- const e = (
831
- // Step into the shadow DOM of the parent of a slotted node.
832
- t.assignedSlot || // DOM Element detected.
833
- t.parentNode || // ShadowRoot detected.
834
- Ht(t) && t.host || // Fallback.
835
- Y(t)
836
- );
837
- return Ht(e) ? e.host : e;
838
- }
839
- function Xt(t) {
840
- const e = G(t);
841
- return tt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : X(e) && ot(e) ? e : Xt(e);
842
- }
843
- function qt(t, e, n) {
844
- var o;
845
- e === void 0 && (e = []);
846
- const i = Xt(t), s = i === ((o = t.ownerDocument) == null ? void 0 : o.body), r = P(i);
847
- return s ? (mt(r), e.concat(r, r.visualViewport || [], ot(i) ? i : [], [])) : e.concat(i, qt(i, []));
848
- }
849
- function mt(t) {
850
- return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
851
- }
852
- function Gt(t) {
853
- const e = W(t);
854
- let n = parseFloat(e.width) || 0, o = parseFloat(e.height) || 0;
855
- const i = X(t), s = i ? t.offsetWidth : n, r = i ? t.offsetHeight : o, l = st(n) !== s || st(o) !== r;
856
- return l && (n = s, o = r), {
857
- width: n,
858
- height: o,
859
- $: l
860
- };
861
- }
862
- function Zt(t) {
863
- return _(t) ? t : t.contextElement;
864
- }
865
- function J(t) {
866
- const e = Zt(t);
867
- if (!X(e))
868
- return $(1);
869
- const n = e.getBoundingClientRect(), {
870
- width: o,
871
- height: i,
872
- $: s
873
- } = Gt(e);
874
- let r = (s ? st(n.width) : n.width) / o, l = (s ? st(n.height) : n.height) / i;
875
- return (!r || !Number.isFinite(r)) && (r = 1), (!l || !Number.isFinite(l)) && (l = 1), {
876
- x: r,
877
- y: l
878
- };
879
- }
880
- const ei = /* @__PURE__ */ $(0);
881
- function Jt(t) {
882
- const e = P(t);
883
- return !Ct() || !e.visualViewport ? ei : {
884
- x: e.visualViewport.offsetLeft,
885
- y: e.visualViewport.offsetTop
886
- };
887
- }
888
- function ii(t, e, n) {
889
- return e === void 0 && (e = !1), !n || e && n !== P(t) ? !1 : e;
890
- }
891
- function nt(t, e, n, o) {
892
- e === void 0 && (e = !1), n === void 0 && (n = !1);
893
- const i = t.getBoundingClientRect(), s = Zt(t);
894
- let r = $(1);
895
- e && (o ? _(o) && (r = J(o)) : r = J(t));
896
- const l = ii(s, n, o) ? Jt(s) : $(0);
897
- let c = (i.left + l.x) / r.x, p = (i.top + l.y) / r.y, f = i.width / r.x, a = i.height / r.y;
898
- if (s) {
899
- const d = P(s), u = o && _(o) ? P(o) : o;
900
- let h = d, g = mt(h);
901
- for (; g && o && u !== h; ) {
902
- const m = J(g), v = g.getBoundingClientRect(), y = W(g), w = v.left + (g.clientLeft + parseFloat(y.paddingLeft)) * m.x, b = v.top + (g.clientTop + parseFloat(y.paddingTop)) * m.y;
903
- c *= m.x, p *= m.y, f *= m.x, a *= m.y, c += w, p += b, h = P(g), g = mt(h);
904
- }
905
- }
906
- return Q({
907
- width: f,
908
- height: a,
909
- x: c,
910
- y: p
911
- });
912
- }
913
- function ft(t, e) {
914
- const n = ut(t).scrollLeft;
915
- return e ? e.left + n : nt(Y(t)).left + n;
916
- }
917
- function Qt(t, e) {
918
- const n = t.getBoundingClientRect(), o = n.left + e.scrollLeft - ft(t, n), i = n.top + e.scrollTop;
919
- return {
920
- x: o,
921
- y: i
922
- };
923
- }
924
- function ni(t) {
925
- let {
926
- elements: e,
927
- rect: n,
928
- offsetParent: o,
929
- strategy: i
930
- } = t;
931
- const s = i === "fixed", r = Y(o), l = e ? ct(e.floating) : !1;
932
- if (o === r || l && s)
933
- return n;
934
- let c = {
935
- scrollLeft: 0,
936
- scrollTop: 0
937
- }, p = $(1);
938
- const f = $(0), a = X(o);
939
- if ((a || !a && !s) && ((et(o) !== "body" || ot(r)) && (c = ut(o)), a)) {
940
- const u = nt(o);
941
- p = J(o), f.x = u.x + o.clientLeft, f.y = u.y + o.clientTop;
942
- }
943
- const d = r && !a && !s ? Qt(r, c) : $(0);
944
- return {
945
- width: n.width * p.x,
946
- height: n.height * p.y,
947
- x: n.x * p.x - c.scrollLeft * p.x + f.x + d.x,
948
- y: n.y * p.y - c.scrollTop * p.y + f.y + d.y
949
- };
950
- }
951
- function oi(t) {
952
- return Array.from(t.getClientRects());
953
- }
954
- function si(t) {
955
- const e = Y(t), n = ut(t), o = t.ownerDocument.body, i = D(e.scrollWidth, e.clientWidth, o.scrollWidth, o.clientWidth), s = D(e.scrollHeight, e.clientHeight, o.scrollHeight, o.clientHeight);
956
- let r = -n.scrollLeft + ft(t);
957
- const l = -n.scrollTop;
958
- return W(o).direction === "rtl" && (r += D(e.clientWidth, o.clientWidth) - i), {
959
- width: i,
960
- height: s,
961
- x: r,
962
- y: l
963
- };
964
- }
965
- const At = 25;
966
- function ri(t, e) {
967
- const n = P(t), o = Y(t), i = n.visualViewport;
968
- let s = o.clientWidth, r = o.clientHeight, l = 0, c = 0;
969
- if (i) {
970
- s = i.width, r = i.height;
971
- const f = Ct();
972
- (!f || f && e === "fixed") && (l = i.offsetLeft, c = i.offsetTop);
973
- }
974
- const p = ft(o);
975
- if (p <= 0) {
976
- const f = o.ownerDocument, a = f.body, d = getComputedStyle(a), u = f.compatMode === "CSS1Compat" && parseFloat(d.marginLeft) + parseFloat(d.marginRight) || 0, h = Math.abs(o.clientWidth - a.clientWidth - u);
977
- h <= At && (s -= h);
978
- } else p <= At && (s += p);
979
- return {
980
- width: s,
981
- height: r,
982
- x: l,
983
- y: c
984
- };
985
- }
986
- function li(t, e) {
987
- const n = nt(t, !0, e === "fixed"), o = n.top + t.clientTop, i = n.left + t.clientLeft, s = X(t) ? J(t) : $(1), r = t.clientWidth * s.x, l = t.clientHeight * s.y, c = i * s.x, p = o * s.y;
988
- return {
989
- width: r,
990
- height: l,
991
- x: c,
992
- y: p
993
- };
994
- }
995
- function Mt(t, e, n) {
996
- let o;
997
- if (e === "viewport")
998
- o = ri(t, n);
999
- else if (e === "document")
1000
- o = si(Y(t));
1001
- else if (_(e))
1002
- o = li(e, n);
1003
- else {
1004
- const i = Jt(t);
1005
- o = {
1006
- x: e.x - i.x,
1007
- y: e.y - i.y,
1008
- width: e.width,
1009
- height: e.height
1010
- };
1011
- }
1012
- return Q(o);
1013
- }
1014
- function te(t, e) {
1015
- const n = G(t);
1016
- return n === e || !_(n) || tt(n) ? !1 : W(n).position === "fixed" || te(n, e);
1017
- }
1018
- function ai(t, e) {
1019
- const n = e.get(t);
1020
- if (n)
1021
- return n;
1022
- let o = qt(t, []).filter((l) => _(l) && et(l) !== "body"), i = null;
1023
- const s = W(t).position === "fixed";
1024
- let r = s ? G(t) : t;
1025
- for (; _(r) && !tt(r); ) {
1026
- const l = W(r), c = Ot(r);
1027
- !c && l.position === "fixed" && (i = null), (s ? !c && !i : !c && l.position === "static" && !!i && (i.position === "absolute" || i.position === "fixed") || ot(r) && !c && te(t, r)) ? o = o.filter((f) => f !== r) : i = l, r = G(r);
1028
- }
1029
- return e.set(t, o), o;
1030
- }
1031
- function ci(t) {
1032
- let {
1033
- element: e,
1034
- boundary: n,
1035
- rootBoundary: o,
1036
- strategy: i
1037
- } = t;
1038
- const r = [...n === "clippingAncestors" ? ct(e) ? [] : ai(e, this._c) : [].concat(n), o], l = Mt(e, r[0], i);
1039
- let c = l.top, p = l.right, f = l.bottom, a = l.left;
1040
- for (let d = 1; d < r.length; d++) {
1041
- const u = Mt(e, r[d], i);
1042
- c = D(u.top, c), p = K(u.right, p), f = K(u.bottom, f), a = D(u.left, a);
1043
- }
1044
- return {
1045
- width: p - a,
1046
- height: f - c,
1047
- x: a,
1048
- y: c
1049
- };
1050
- }
1051
- function ui(t) {
1052
- const {
1053
- width: e,
1054
- height: n
1055
- } = Gt(t);
1056
- return {
1057
- width: e,
1058
- height: n
1059
- };
1060
- }
1061
- function fi(t, e, n) {
1062
- const o = X(e), i = Y(e), s = n === "fixed", r = nt(t, !0, s, e);
1063
- let l = {
1064
- scrollLeft: 0,
1065
- scrollTop: 0
1066
- };
1067
- const c = $(0);
1068
- function p() {
1069
- c.x = ft(i);
1070
- }
1071
- if (o || !o && !s)
1072
- if ((et(e) !== "body" || ot(i)) && (l = ut(e)), o) {
1073
- const u = nt(e, !0, s, e);
1074
- c.x = u.x + e.clientLeft, c.y = u.y + e.clientTop;
1075
- } else i && p();
1076
- s && !o && i && p();
1077
- const f = i && !o && !s ? Qt(i, l) : $(0), a = r.left + l.scrollLeft - c.x - f.x, d = r.top + l.scrollTop - c.y - f.y;
1078
- return {
1079
- x: a,
1080
- y: d,
1081
- width: r.width,
1082
- height: r.height
1083
- };
1084
- }
1085
- function ht(t) {
1086
- return W(t).position === "static";
1087
- }
1088
- function Pt(t, e) {
1089
- if (!X(t) || W(t).position === "fixed")
1090
- return null;
1091
- if (e)
1092
- return e(t);
1093
- let n = t.offsetParent;
1094
- return Y(t) === n && (n = n.ownerDocument.body), n;
1095
- }
1096
- function ee(t, e) {
1097
- const n = P(t);
1098
- if (ct(t))
1099
- return n;
1100
- if (!X(t)) {
1101
- let i = G(t);
1102
- for (; i && !tt(i); ) {
1103
- if (_(i) && !ht(i))
1104
- return i;
1105
- i = G(i);
1106
- }
1107
- return n;
1108
- }
1109
- let o = Pt(t, e);
1110
- for (; o && Ze(o) && ht(o); )
1111
- o = Pt(o, e);
1112
- return o && tt(o) && ht(o) && !Ot(o) ? n : o || ti(t) || n;
1113
- }
1114
- const di = async function(t) {
1115
- const e = this.getOffsetParent || ee, n = this.getDimensions, o = await n(t.floating);
1116
- return {
1117
- reference: fi(t.reference, await e(t.floating), t.strategy),
1118
- floating: {
1119
- x: 0,
1120
- y: 0,
1121
- width: o.width,
1122
- height: o.height
1123
- }
1124
- };
1125
- };
1126
- function hi(t) {
1127
- return W(t).direction === "rtl";
1128
- }
1129
- const pi = {
1130
- convertOffsetParentRelativeRectToViewportRelativeRect: ni,
1131
- getDocumentElement: Y,
1132
- getClippingRect: ci,
1133
- getOffsetParent: ee,
1134
- getElementRects: di,
1135
- getClientRects: oi,
1136
- getDimensions: ui,
1137
- getScale: J,
1138
- isElement: _,
1139
- isRTL: hi
1140
- }, ie = Xe, ne = We, oe = qe, se = ke, re = Ge, le = Fe, ae = Ne, ce = Ke, ue = (t, e, n) => {
1141
- const o = /* @__PURE__ */ new Map(), i = {
1142
- platform: pi,
1143
- ...n
1144
- }, s = {
1145
- ...i.platform,
1146
- _c: o
1147
- };
1148
- return ze(t, e, {
1149
- ...i,
1150
- platform: s
1151
- });
1152
- };
1153
- function gi(t, e) {
1154
- const n = Math.min(t.top, e.top), o = Math.max(t.bottom, e.bottom), i = Math.min(t.left, e.left), r = Math.max(t.right, e.right) - i, l = o - n, c = i, p = n;
1155
- return new DOMRect(c, p, r, l);
1156
- }
1157
- var mi = class {
1158
- constructor({
1159
- editor: t,
1160
- element: e,
1161
- view: n,
1162
- pluginKey: o = "bubbleMenu",
1163
- updateDelay: i = 250,
1164
- resizeDelay: s = 60,
1165
- shouldShow: r,
1166
- appendTo: l,
1167
- getReferencedVirtualElement: c,
1168
- options: p
1169
- }) {
1170
- this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
1171
- strategy: "absolute",
1172
- placement: "top",
1173
- offset: 8,
1174
- flip: {},
1175
- shift: {},
1176
- arrow: !1,
1177
- size: !1,
1178
- autoPlacement: !1,
1179
- hide: !1,
1180
- inline: !1,
1181
- onShow: void 0,
1182
- onHide: void 0,
1183
- onUpdate: void 0,
1184
- onDestroy: void 0
1185
- }, this.shouldShow = ({ view: a, state: d, from: u, to: h }) => {
1186
- const { doc: g, selection: m } = d, { empty: v } = m, y = !g.textBetween(u, h).length && xe(d.selection), w = this.element.contains(document.activeElement);
1187
- return !(!(a.hasFocus() || w) || v || y || !this.editor.isEditable);
1188
- }, this.mousedownHandler = () => {
1189
- this.preventHide = !0;
1190
- }, this.dragstartHandler = () => {
1191
- this.hide();
1192
- }, this.resizeHandler = () => {
1193
- this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
1194
- this.updatePosition();
1195
- }, this.resizeDelay);
1196
- }, this.focusHandler = () => {
1197
- setTimeout(() => this.update(this.editor.view));
1198
- }, this.blurHandler = ({ event: a }) => {
1199
- var d;
1200
- if (this.editor.isDestroyed) {
1201
- this.destroy();
1202
- return;
1203
- }
1204
- if (this.preventHide) {
1205
- this.preventHide = !1;
1206
- return;
1207
- }
1208
- a?.relatedTarget && ((d = this.element.parentNode) != null && d.contains(a.relatedTarget)) || a?.relatedTarget !== this.editor.view.dom && this.hide();
1209
- }, this.handleDebouncedUpdate = (a, d) => {
1210
- const u = !d?.selection.eq(a.state.selection), h = !d?.doc.eq(a.state.doc);
1211
- !u && !h || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
1212
- this.updateHandler(a, u, h, d);
1213
- }, this.updateDelay));
1214
- }, this.updateHandler = (a, d, u, h) => {
1215
- const { composing: g } = a;
1216
- if (g || !d && !u)
1217
- return;
1218
- if (!this.getShouldShow(h)) {
1219
- this.hide();
1220
- return;
1221
- }
1222
- this.show(), this.updatePosition();
1223
- }, this.transactionHandler = ({ transaction: a }) => {
1224
- const d = a.getMeta(this.pluginKey);
1225
- d === "updatePosition" ? this.updatePosition() : d && typeof d == "object" && d.type === "updateOptions" ? this.updateOptions(d.options) : d === "hide" ? this.hide() : d === "show" && (this.updatePosition(), this.show());
1226
- };
1227
- var f;
1228
- this.editor = t, this.element = e, this.view = n, this.pluginKey = o, this.updateDelay = i, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (f = p?.scrollTarget) != null ? f : window, this.getReferencedVirtualElement = c, this.floatingUIOptions = {
1229
- ...this.floatingUIOptions,
1230
- ...p
1231
- }, this.element.tabIndex = 0, r && (this.shouldShow = r), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
1232
- }
1233
- get middlewares() {
1234
- const t = [];
1235
- return this.floatingUIOptions.flip && t.push(se(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
1236
- oe(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
1237
- ), this.floatingUIOptions.offset && t.push(
1238
- ie(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
1239
- ), this.floatingUIOptions.arrow && t.push(ae(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(re(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
1240
- ne(
1241
- typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
1242
- )
1243
- ), this.floatingUIOptions.hide && t.push(le(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
1244
- ce(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
1245
- ), t;
1246
- }
1247
- get virtualElement() {
1248
- var t, e, n;
1249
- const { selection: o } = this.editor.state, i = (t = this.getReferencedVirtualElement) == null ? void 0 : t.call(this);
1250
- if (i)
1251
- return i;
1252
- if (!((n = (e = this.view) == null ? void 0 : e.dom) != null && n.parentNode))
1253
- return;
1254
- const s = zt(this.view, o.from, o.to);
1255
- let r = {
1256
- getBoundingClientRect: () => s,
1257
- getClientRects: () => [s]
1258
- };
1259
- if (o instanceof Oe) {
1260
- let l = this.view.nodeDOM(o.from);
1261
- const c = l.dataset.nodeViewWrapper ? l : l.querySelector("[data-node-view-wrapper]");
1262
- c && (l = c), l && (r = {
1263
- getBoundingClientRect: () => l.getBoundingClientRect(),
1264
- getClientRects: () => [l.getBoundingClientRect()]
1265
- });
1266
- }
1267
- if (o instanceof Te) {
1268
- const { $anchorCell: l, $headCell: c } = o, p = l ? l.pos : c.pos, f = c ? c.pos : l.pos, a = this.view.nodeDOM(p), d = this.view.nodeDOM(f);
1269
- if (!a || !d)
1270
- return;
1271
- const u = a === d ? a.getBoundingClientRect() : gi(
1272
- a.getBoundingClientRect(),
1273
- d.getBoundingClientRect()
1274
- );
1275
- r = {
1276
- getBoundingClientRect: () => u,
1277
- getClientRects: () => [u]
1278
- };
1279
- }
1280
- return r;
1281
- }
1282
- updatePosition() {
1283
- if (!this.isVisible)
1284
- return;
1285
- const t = this.virtualElement;
1286
- t && ue(t, this.element, {
1287
- placement: this.floatingUIOptions.placement,
1288
- strategy: this.floatingUIOptions.strategy,
1289
- middleware: this.middlewares
1290
- }).then(({ x: e, y: n, strategy: o, middlewareData: i }) => {
1291
- var s, r;
1292
- if (!(!this.isVisible || this.editor.isDestroyed || !this.element.isConnected)) {
1293
- if ((s = i.hide) != null && s.referenceHidden || (r = i.hide) != null && r.escaped) {
1294
- this.element.style.visibility = "hidden";
1295
- return;
1296
- }
1297
- this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = o, this.element.style.left = `${e}px`, this.element.style.top = `${n}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1298
- }
1299
- });
1300
- }
1301
- update(t, e) {
1302
- const { state: n } = t, o = n.selection.from !== n.selection.to;
1303
- if (this.updateDelay > 0 && o) {
1304
- this.handleDebouncedUpdate(t, e);
1305
- return;
1306
- }
1307
- const i = !e?.selection.eq(t.state.selection), s = !e?.doc.eq(t.state.doc);
1308
- this.updateHandler(t, i, s, e);
1309
- }
1310
- getShouldShow(t) {
1311
- var e;
1312
- const { state: n } = this.view, { selection: o } = n, { ranges: i } = o, s = Math.min(...i.map((c) => c.$from.pos)), r = Math.max(...i.map((c) => c.$to.pos));
1313
- return ((e = this.shouldShow) == null ? void 0 : e.call(this, {
1314
- editor: this.editor,
1315
- element: this.element,
1316
- view: this.view,
1317
- state: n,
1318
- oldState: t,
1319
- from: s,
1320
- to: r
1321
- })) || !1;
1322
- }
1323
- show() {
1324
- var t;
1325
- if (this.isVisible)
1326
- return;
1327
- this.element.style.visibility = "visible", this.element.style.opacity = "1";
1328
- const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
1329
- (t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
1330
- }
1331
- hide() {
1332
- this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
1333
- }
1334
- updateOptions(t) {
1335
- var e;
1336
- if (t.updateDelay !== void 0 && (this.updateDelay = t.updateDelay), t.resizeDelay !== void 0 && (this.resizeDelay = t.resizeDelay), t.appendTo !== void 0 && (this.appendTo = t.appendTo), t.getReferencedVirtualElement !== void 0 && (this.getReferencedVirtualElement = t.getReferencedVirtualElement), t.shouldShow !== void 0 && t.shouldShow && (this.shouldShow = t.shouldShow), t.options !== void 0) {
1337
- const n = (e = t.options.scrollTarget) != null ? e : window;
1338
- n !== this.scrollTarget && (this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.scrollTarget = n, this.scrollTarget.addEventListener("scroll", this.resizeHandler)), this.floatingUIOptions = {
1339
- ...this.floatingUIOptions,
1340
- ...t.options
1341
- };
1342
- }
1343
- }
1344
- destroy() {
1345
- this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
1346
- }
1347
- }, fe = (t) => new Vt({
1348
- key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
1349
- view: (e) => new mi({ view: e, ...t })
1350
- });
1351
- Nt.create({
1352
- name: "bubbleMenu",
1353
- addOptions() {
1354
- return {
1355
- element: null,
1356
- pluginKey: "bubbleMenu",
1357
- updateDelay: void 0,
1358
- appendTo: void 0,
1359
- shouldShow: null
1360
- };
1361
- },
1362
- addProseMirrorPlugins() {
1363
- return this.options.element ? [
1364
- fe({
1365
- pluginKey: this.options.pluginKey,
1366
- editor: this.editor,
1367
- element: this.options.element,
1368
- updateDelay: this.options.updateDelay,
1369
- options: this.options.options,
1370
- appendTo: this.options.appendTo,
1371
- getReferencedVirtualElement: this.options.getReferencedVirtualElement,
1372
- shouldShow: this.options.shouldShow
1373
- })
1374
- ] : [];
1375
- }
1376
- });
1377
- var wi = class {
1378
- constructor({
1379
- editor: t,
1380
- element: e,
1381
- view: n,
1382
- pluginKey: o = "floatingMenu",
1383
- updateDelay: i = 250,
1384
- resizeDelay: s = 60,
1385
- options: r,
1386
- appendTo: l,
1387
- shouldShow: c
1388
- }) {
1389
- this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: f, state: a }) => {
1390
- const { selection: d } = a, { $anchor: u, empty: h } = d, g = u.depth === 1, m = u.parent.isTextblock && !u.parent.type.spec.code && !u.parent.textContent && u.parent.childCount === 0 && !this.getTextContent(u.parent);
1391
- return !(!f.hasFocus() || !h || !g || !m || !this.editor.isEditable);
1392
- }, this.floatingUIOptions = {
1393
- strategy: "absolute",
1394
- placement: "right",
1395
- offset: 8,
1396
- flip: {},
1397
- shift: {},
1398
- arrow: !1,
1399
- size: !1,
1400
- autoPlacement: !1,
1401
- hide: !1,
1402
- inline: !1
1403
- }, this.updateHandler = (f, a, d, u) => {
1404
- const { composing: h } = f;
1405
- if (h || !a && !d)
1406
- return;
1407
- if (!this.getShouldShow(u)) {
1408
- this.hide();
1409
- return;
1410
- }
1411
- this.updatePosition(), this.show();
1412
- }, this.mousedownHandler = () => {
1413
- this.preventHide = !0;
1414
- }, this.focusHandler = () => {
1415
- setTimeout(() => this.update(this.editor.view));
1416
- }, this.blurHandler = ({ event: f }) => {
1417
- var a;
1418
- if (this.preventHide) {
1419
- this.preventHide = !1;
1420
- return;
1421
- }
1422
- f?.relatedTarget && ((a = this.element.parentNode) != null && a.contains(f.relatedTarget)) || f?.relatedTarget !== this.editor.view.dom && this.hide();
1423
- }, this.transactionHandler = ({ transaction: f }) => {
1424
- const a = f.getMeta(this.pluginKey);
1425
- a === "updatePosition" ? this.updatePosition() : a && typeof a == "object" && a.type === "updateOptions" ? this.updateOptions(a.options) : a === "hide" ? this.hide() : a === "show" && (this.updatePosition(), this.show());
1426
- }, this.resizeHandler = () => {
1427
- this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
1428
- this.updatePosition();
1429
- }, this.resizeDelay);
1430
- };
1431
- var p;
1432
- this.editor = t, this.element = e, this.view = n, this.pluginKey = o, this.updateDelay = i, this.resizeDelay = s, this.appendTo = l, this.scrollTarget = (p = r?.scrollTarget) != null ? p : window, this.floatingUIOptions = {
1433
- ...this.floatingUIOptions,
1434
- ...r
1435
- }, this.element.tabIndex = 0, c && (this.shouldShow = c), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.editor.on("transaction", this.transactionHandler), window.addEventListener("resize", this.resizeHandler), this.scrollTarget.addEventListener("scroll", this.resizeHandler), this.update(n, n.state), this.getShouldShow() && (this.show(), this.updatePosition());
1436
- }
1437
- getTextContent(t) {
1438
- return Ce(t, { textSerializers: Se(this.editor.schema) });
1439
- }
1440
- get middlewares() {
1441
- const t = [];
1442
- return this.floatingUIOptions.flip && t.push(se(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
1443
- oe(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
1444
- ), this.floatingUIOptions.offset && t.push(
1445
- ie(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
1446
- ), this.floatingUIOptions.arrow && t.push(ae(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(re(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
1447
- ne(
1448
- typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
1449
- )
1450
- ), this.floatingUIOptions.hide && t.push(le(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
1451
- ce(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
1452
- ), t;
1453
- }
1454
- getShouldShow(t) {
1455
- var e;
1456
- const { state: n } = this.view, { selection: o } = n, { ranges: i } = o, s = Math.min(...i.map((c) => c.$from.pos)), r = Math.max(...i.map((c) => c.$to.pos));
1457
- return (e = this.shouldShow) == null ? void 0 : e.call(this, {
1458
- editor: this.editor,
1459
- view: this.view,
1460
- state: n,
1461
- oldState: t,
1462
- from: s,
1463
- to: r
1464
- });
1465
- }
1466
- updateOptions(t) {
1467
- var e;
1468
- if (t.updateDelay !== void 0 && (this.updateDelay = t.updateDelay), t.resizeDelay !== void 0 && (this.resizeDelay = t.resizeDelay), t.appendTo !== void 0 && (this.appendTo = t.appendTo), t.shouldShow !== void 0 && t.shouldShow && (this.shouldShow = t.shouldShow), t.options !== void 0) {
1469
- const n = (e = t.options.scrollTarget) != null ? e : window;
1470
- n !== this.scrollTarget && (this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.scrollTarget = n, this.scrollTarget.addEventListener("scroll", this.resizeHandler)), this.floatingUIOptions = {
1471
- ...this.floatingUIOptions,
1472
- ...t.options
1473
- };
1474
- }
1475
- }
1476
- updatePosition() {
1477
- const { selection: t } = this.editor.state, e = zt(this.view, t.from, t.to);
1478
- ue({
1479
- getBoundingClientRect: () => e,
1480
- getClientRects: () => [e]
1481
- }, this.element, {
1482
- placement: this.floatingUIOptions.placement,
1483
- strategy: this.floatingUIOptions.strategy,
1484
- middleware: this.middlewares
1485
- }).then(({ x: o, y: i, strategy: s, middlewareData: r }) => {
1486
- var l, c;
1487
- if ((l = r.hide) != null && l.referenceHidden || (c = r.hide) != null && c.escaped) {
1488
- this.element.style.visibility = "hidden";
1489
- return;
1490
- }
1491
- this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = s, this.element.style.left = `${o}px`, this.element.style.top = `${i}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1492
- });
1493
- }
1494
- update(t, e) {
1495
- const n = !e?.selection.eq(t.state.selection), o = !e?.doc.eq(t.state.doc);
1496
- this.updateHandler(t, n, o, e);
1497
- }
1498
- show() {
1499
- var t;
1500
- if (this.isVisible)
1501
- return;
1502
- this.element.style.visibility = "visible", this.element.style.opacity = "1";
1503
- const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
1504
- (t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
1505
- }
1506
- hide() {
1507
- this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
1508
- }
1509
- destroy() {
1510
- this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
1511
- }
1512
- }, de = (t) => new Vt({
1513
- key: typeof t.pluginKey == "string" ? new vt(t.pluginKey) : t.pluginKey,
1514
- view: (e) => new wi({ view: e, ...t })
1515
- });
1516
- Nt.create({
1517
- name: "floatingMenu",
1518
- addOptions() {
1519
- return {
1520
- element: null,
1521
- options: {},
1522
- pluginKey: "floatingMenu",
1523
- updateDelay: void 0,
1524
- resizeDelay: void 0,
1525
- appendTo: void 0,
1526
- shouldShow: null
1527
- };
1528
- },
1529
- addCommands() {
1530
- return {
1531
- updateFloatingMenuPosition: () => ({ tr: t, dispatch: e }) => (e && t.setMeta(this.options.pluginKey, "updatePosition"), !0)
1532
- };
1533
- },
1534
- addProseMirrorPlugins() {
1535
- return this.options.element ? [
1536
- de({
1537
- pluginKey: this.options.pluginKey,
1538
- editor: this.editor,
1539
- element: this.options.element,
1540
- updateDelay: this.options.updateDelay,
1541
- resizeDelay: this.options.resizeDelay,
1542
- options: this.options.options,
1543
- appendTo: this.options.appendTo,
1544
- shouldShow: this.options.shouldShow
1545
- })
1546
- ] : [];
1547
- }
1548
- });
1549
- function he(t, e) {
1550
- return t ?? new vt(e);
1551
- }
1552
- var vi = typeof window < "u" ? Ee : it, pe = /* @__PURE__ */ new Set(["left", "opacity", "position", "top", "visibility", "width"]), yi = /* @__PURE__ */ new Set([
1553
- "animationIterationCount",
1554
- "aspectRatio",
1555
- "borderImageOutset",
1556
- "borderImageSlice",
1557
- "borderImageWidth",
1558
- "columnCount",
1559
- "columns",
1560
- "fillOpacity",
1561
- "flex",
1562
- "flexGrow",
1563
- "flexShrink",
1564
- "fontWeight",
1565
- "gridArea",
1566
- "gridColumn",
1567
- "gridColumnEnd",
1568
- "gridColumnStart",
1569
- "gridRow",
1570
- "gridRowEnd",
1571
- "gridRowStart",
1572
- "lineClamp",
1573
- "lineHeight",
1574
- "opacity",
1575
- "order",
1576
- "orphans",
1577
- "scale",
1578
- "stopOpacity",
1579
- "strokeDasharray",
1580
- "strokeDashoffset",
1581
- "strokeMiterlimit",
1582
- "strokeOpacity",
1583
- "strokeWidth",
1584
- "tabSize",
1585
- "widows",
1586
- "zIndex",
1587
- "zoom"
1588
- ]), bi = /* @__PURE__ */ new Set(["children", "className", "style"]), xi = /* @__PURE__ */ new Set(["tabIndex"]), Oi = /* @__PURE__ */ new Set([
1589
- "accessKey",
1590
- "autoCapitalize",
1591
- "contentEditable",
1592
- "contextMenu",
1593
- "dir",
1594
- "draggable",
1595
- "enterKeyHint",
1596
- "hidden",
1597
- "id",
1598
- "lang",
1599
- "nonce",
1600
- "role",
1601
- "slot",
1602
- "spellCheck",
1603
- "tabIndex",
1604
- "title",
1605
- "translate"
1606
- ]), Ci = {
1607
- Blur: "focusout",
1608
- DoubleClick: "dblclick",
1609
- Focus: "focusin",
1610
- MouseEnter: "mouseenter",
1611
- MouseLeave: "mouseleave"
1612
- };
1613
- function wt(t, e) {
1614
- return /^on[A-Z]/.test(t) && typeof e == "function";
1615
- }
1616
- function Si(t) {
1617
- return t.startsWith("aria-") || t.startsWith("data-"), t;
1618
- }
1619
- function Ti(t) {
1620
- return t.startsWith("aria-") || t.startsWith("data-") || Oi.has(t);
1621
- }
1622
- function ge(t) {
1623
- return t.startsWith("--") ? t : t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
1624
- }
1625
- function Ei(t) {
1626
- var e;
1627
- const n = t.endsWith("Capture"), i = (n ? t.slice(0, -7) : t).slice(2);
1628
- return {
1629
- eventName: (e = Ci[i]) != null ? e : i.toLowerCase(),
1630
- options: n ? { capture: !0 } : void 0
1631
- };
1632
- }
1633
- function Ri(t, e) {
1634
- let n = e.defaultPrevented, o = !1;
1635
- const i = Object.create(e);
1636
- return Object.defineProperties(i, {
1637
- nativeEvent: { value: e },
1638
- currentTarget: { value: t },
1639
- target: { value: e.target },
1640
- persist: { value: () => {
1641
- } },
1642
- isDefaultPrevented: { value: () => n },
1643
- isPropagationStopped: { value: () => o },
1644
- preventDefault: {
1645
- value: () => {
1646
- n = !0, e.preventDefault();
1647
- }
1648
- },
1649
- stopPropagation: {
1650
- value: () => {
1651
- o = !0, e.stopPropagation();
1652
- }
1653
- }
1654
- }), i;
1655
- }
1656
- function pt(t) {
1657
- return xi.has(t);
1658
- }
1659
- function Ut(t, e, n) {
1660
- if (e === "tabIndex") {
1661
- t.tabIndex = Number(n);
1662
- return;
1663
- }
1664
- t[e] = n;
1665
- }
1666
- function Ii(t, e) {
1667
- if (e === "tabIndex") {
1668
- t.removeAttribute("tabindex");
1669
- return;
1670
- }
1671
- const n = t[e];
1672
- if (typeof n == "boolean") {
1673
- t[e] = !1;
1674
- return;
1675
- }
1676
- if (typeof n == "number") {
1677
- t[e] = 0;
1678
- return;
1679
- }
1680
- t[e] = "";
1681
- }
1682
- function Li(t, e) {
1683
- return typeof e != "number" || e === 0 || t.startsWith("--") || yi.has(t) ? String(e) : `${e}px`;
1684
- }
1685
- function Di(t, e) {
1686
- pe.has(e) || t.style.removeProperty(ge(e));
1687
- }
1688
- function Hi(t, e, n) {
1689
- pe.has(e) || t.style.setProperty(ge(e), Li(e, n));
1690
- }
1691
- function Ai(t, e, n) {
1692
- (/* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(n)])).forEach((i) => {
1693
- if (bi.has(i) || !Ti(i) || wt(i, e[i]) || wt(i, n[i]))
1694
- return;
1695
- const s = e[i], r = n[i];
1696
- if (s === r)
1697
- return;
1698
- const l = Si(i);
1699
- if (r == null || r === !1) {
1700
- pt(i) && Ii(t, i), t.removeAttribute(l);
1701
- return;
1702
- }
1703
- if (r === !0) {
1704
- pt(i) && Ut(t, i, !0), t.setAttribute(l, "");
1705
- return;
1706
- }
1707
- if (pt(i)) {
1708
- Ut(t, i, r);
1709
- return;
1710
- }
1711
- t.setAttribute(l, String(r));
1712
- });
1713
- }
1714
- function Mi(t, e, n) {
1715
- if (e !== n) {
1716
- if (n) {
1717
- t.className = n;
1718
- return;
1719
- }
1720
- t.removeAttribute("class");
1721
- }
1722
- }
1723
- function Pi(t, e, n) {
1724
- const o = e ?? {}, i = n ?? {};
1725
- (/* @__PURE__ */ new Set([...Object.keys(o), ...Object.keys(i)])).forEach((r) => {
1726
- const l = o[r], c = i[r];
1727
- if (l !== c) {
1728
- if (c == null) {
1729
- Di(t, r);
1730
- return;
1731
- }
1732
- Hi(t, r, c);
1733
- }
1734
- });
1735
- }
1736
- function Ui(t, e, n) {
1737
- e.forEach(({ eventName: i, listener: s, options: r }) => {
1738
- t.removeEventListener(i, s, r);
1739
- });
1740
- const o = [];
1741
- return Object.entries(n).forEach(([i, s]) => {
1742
- if (!wt(i, s))
1743
- return;
1744
- const { eventName: r, options: l } = Ei(i), c = (p) => {
1745
- s(Ri(t, p));
1746
- };
1747
- t.addEventListener(r, c, l), o.push({ eventName: r, listener: c, options: l });
1748
- }), o;
1749
- }
1750
- function me(t, e) {
1751
- const n = k({}), o = k([]);
1752
- vi(() => {
1753
- const i = n.current;
1754
- return Mi(t, i.className, e.className), Pi(t, i.style, e.style), Ai(t, i, e), o.current = Ui(t, o.current, e), n.current = e, () => {
1755
- o.current.forEach(({ eventName: s, listener: r, options: l }) => {
1756
- t.removeEventListener(s, r, l);
1757
- }), o.current = [];
1758
- };
1759
- }, [t, e]);
1760
- }
1761
- var Bi = _t.forwardRef(
1762
- ({
1763
- pluginKey: t,
1764
- editor: e,
1765
- updateDelay: n,
1766
- resizeDelay: o,
1767
- appendTo: i,
1768
- shouldShow: s = null,
1769
- getReferencedVirtualElement: r,
1770
- options: l,
1771
- children: c,
1772
- ...p
1773
- }, f) => {
1774
- const a = k(document.createElement("div")), d = k(he(t, "bubbleMenu")).current;
1775
- me(a.current, p), typeof f == "function" ? f(a.current) : f && (f.current = a.current);
1776
- const { editor: u } = Bt(), h = e || u, g = {
1777
- updateDelay: n,
1778
- resizeDelay: o,
1779
- appendTo: i,
1780
- pluginKey: d,
1781
- shouldShow: s,
1782
- getReferencedVirtualElement: r,
1783
- options: l
1784
- }, m = k(g);
1785
- m.current = g;
1786
- const [v, y] = Wt(!1), w = k(!0);
1787
- return it(() => {
1788
- if (h?.isDestroyed)
1789
- return;
1790
- if (!h) {
1791
- console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");
1792
- return;
1793
- }
1794
- const b = a.current;
1795
- b.style.visibility = "hidden", b.style.position = "absolute";
1796
- const C = fe({
1797
- ...m.current,
1798
- editor: h,
1799
- element: b
1800
- });
1801
- h.registerPlugin(C);
1802
- const O = m.current.pluginKey;
1803
- return w.current = !0, y(!0), () => {
1804
- y(!1), h.unregisterPlugin(O), window.requestAnimationFrame(() => {
1805
- b.parentNode && b.parentNode.removeChild(b);
1806
- });
1807
- };
1808
- }, [h]), it(() => {
1809
- if (!(!v || !h || h.isDestroyed)) {
1810
- if (w.current) {
1811
- w.current = !1;
1812
- return;
1813
- }
1814
- h.view.dispatch(
1815
- h.state.tr.setMeta(d, {
1816
- type: "updateOptions",
1817
- options: m.current
1818
- })
1819
- );
1820
- }
1821
- }, [
1822
- v,
1823
- h,
1824
- n,
1825
- o,
1826
- s,
1827
- l,
1828
- i,
1829
- r,
1830
- d
1831
- ]), kt(c, a.current);
1832
- }
1833
- );
1834
- _t.forwardRef(
1835
- ({ pluginKey: t, editor: e, updateDelay: n, resizeDelay: o, appendTo: i, shouldShow: s = null, options: r, children: l, ...c }, p) => {
1836
- const f = k(document.createElement("div")), a = k(he(t, "floatingMenu")).current;
1837
- me(f.current, c), typeof p == "function" ? p(f.current) : p && (p.current = f.current);
1838
- const { editor: d } = Bt(), u = e || d, h = {
1839
- updateDelay: n,
1840
- resizeDelay: o,
1841
- appendTo: i,
1842
- pluginKey: a,
1843
- shouldShow: s,
1844
- options: r
1845
- }, g = k(h);
1846
- g.current = h;
1847
- const [m, v] = Wt(!1), y = k(!0);
1848
- return it(() => {
1849
- if (u?.isDestroyed)
1850
- return;
1851
- if (!u) {
1852
- console.warn(
1853
- "FloatingMenu component is not rendered inside of an editor component or does not have editor prop."
1854
- );
1855
- return;
1856
- }
1857
- const w = f.current;
1858
- w.style.visibility = "hidden", w.style.position = "absolute";
1859
- const b = de({
1860
- ...g.current,
1861
- editor: u,
1862
- element: w
1863
- });
1864
- u.registerPlugin(b);
1865
- const C = g.current.pluginKey;
1866
- return y.current = !0, v(!0), () => {
1867
- v(!1), u.unregisterPlugin(C), window.requestAnimationFrame(() => {
1868
- w.parentNode && w.parentNode.removeChild(w);
1869
- });
1870
- };
1871
- }, [u]), it(() => {
1872
- if (!(!m || !u || u.isDestroyed)) {
1873
- if (y.current) {
1874
- y.current = !1;
1875
- return;
1876
- }
1877
- u.view.dispatch(
1878
- u.state.tr.setMeta(a, {
1879
- type: "updateOptions",
1880
- options: g.current
1881
- })
1882
- );
1883
- }
1884
- }, [m, u, n, o, s, r, i, a]), kt(l, f.current);
1885
- }
1886
- );
1887
- const Ki = ({ editor: t }) => {
1888
- const e = be({
1889
- editor: t,
1890
- selector: ({ editor: i }) => i ? {
1891
- isHeading1: i.isActive("heading", { level: 1 }),
1892
- isHeading2: i.isActive("heading", { level: 2 }),
1893
- isHeading3: i.isActive("heading", { level: 3 }),
1894
- isBold: i.isActive("bold"),
1895
- isItalic: i.isActive("italic"),
1896
- isStrike: i.isActive("strike"),
1897
- isCode: i.isActive("code")
1898
- } : null
1899
- }), n = Re(
1900
- (i, s) => {
1901
- i.preventDefault(), s();
1902
- },
1903
- []
1904
- ), o = [
1905
- {
1906
- ariaLabel: "Heading 1",
1907
- command: () => t.chain().focus().toggleHeading({ level: 1 }).run(),
1908
- isActive: () => !!e?.isHeading1,
1909
- icon: /* @__PURE__ */ E(
1910
- "svg",
1911
- {
1912
- className: "scribe-inline-menu-icon",
1913
- viewBox: "0 0 24 24",
1914
- fill: "none",
1915
- xmlns: "http://www.w3.org/2000/svg",
1916
- children: /* @__PURE__ */ E(
1917
- "path",
1918
- {
1919
- d: "M4.00023 5L4 17M13 5L12.9998 17M4 11H12.9998M19.875 19V10L17.625 12.25",
1920
- strokeWidth: "1.5",
1921
- strokeLinecap: "round",
1922
- strokeLinejoin: "round"
1923
- }
1924
- )
1925
- }
1926
- )
1927
- },
1928
- {
1929
- ariaLabel: "Heading 2",
1930
- command: () => t.chain().focus().toggleHeading({ level: 2 }).run(),
1931
- isActive: () => !!e?.isHeading2,
1932
- icon: /* @__PURE__ */ E(
1933
- "svg",
1934
- {
1935
- fill: "none",
1936
- xmlns: "http://www.w3.org/2000/svg",
1937
- className: "scribe-inline-menu-icon",
1938
- viewBox: "0 0 24 24",
1939
- children: /* @__PURE__ */ E(
1940
- "path",
1941
- {
1942
- d: "M3.37402 5V17M12.374 5V17M3.37402 11H12.374M16.302 11.373C16.5035 10.8941 16.8644 10.4997 17.3236 10.2566C17.7829 10.0136 18.312 9.93705 18.8213 10.0399C19.3306 10.1427 19.7886 10.4186 20.1175 10.8207C20.4465 11.2229 20.6262 11.7265 20.626 12.246C20.628 12.694 20.494 13.132 20.242 13.503L16.123 19H20.626",
1943
- strokeWidth: "1.5",
1944
- strokeLinecap: "round",
1945
- strokeLinejoin: "round"
1946
- }
1947
- )
1948
- }
1949
- )
1950
- },
1951
- {
1952
- ariaLabel: "Heading 3",
1953
- command: () => t.chain().focus().toggleHeading({ level: 3 }).run(),
1954
- isActive: () => !!e?.isHeading3,
1955
- icon: /* @__PURE__ */ E(
1956
- "svg",
1957
- {
1958
- className: "scribe-inline-menu-icon",
1959
- viewBox: "0 0 24 24",
1960
- fill: "none",
1961
- xmlns: "http://www.w3.org/2000/svg",
1962
- children: /* @__PURE__ */ E(
1963
- "path",
1964
- {
1965
- d: "M3.375 5V17M12.375 5V17M3.375 11H12.375M16.125 10H20.625L18 13.75C18.4317 13.7499 18.8568 13.8564 19.2375 14.0598C19.6183 14.2633 19.943 14.5575 20.1828 14.9165C20.4227 15.2754 20.5703 15.688 20.6127 16.1176C20.655 16.5472 20.5907 16.9807 20.4255 17.3795C20.2603 17.7783 19.9993 18.1303 19.6656 18.4042C19.3319 18.678 18.9358 18.8654 18.5123 18.9496C18.0889 19.0338 17.6513 19.0123 17.2382 18.8869C16.8251 18.7616 16.4492 18.5363 16.144 18.231",
1966
- strokeWidth: "1.5",
1967
- strokeLinecap: "round",
1968
- strokeLinejoin: "round"
1969
- }
1970
- )
1971
- }
1972
- )
1973
- },
1974
- {
1975
- ariaLabel: "Bold",
1976
- command: () => t.chain().focus().toggleBold().run(),
1977
- isActive: () => !!e?.isBold,
1978
- icon: /* @__PURE__ */ E(
1979
- "svg",
1980
- {
1981
- className: "scribe-inline-menu-icon",
1982
- viewBox: "0 0 24 24",
1983
- fill: "none",
1984
- xmlns: "http://www.w3.org/2000/svg",
1985
- children: /* @__PURE__ */ E(
1986
- "path",
1987
- {
1988
- d: "M12.8571 12C13.918 12 14.9354 11.5786 15.6856 10.8284C16.4357 10.0783 16.8571 9.06087 16.8571 8C16.8571 6.93913 16.4357 5.92172 15.6856 5.17157C14.9354 4.42143 13.918 4 12.8571 4H6V12M12.8571 12H6M12.8571 12H14C15.0609 12 16.0783 12.4214 16.8284 13.1716C17.5786 13.9217 18 14.9391 18 16C18 17.0609 17.5786 18.0783 16.8284 18.8284C16.0783 19.5786 15.0609 20 14 20H6V12",
1989
- strokeWidth: "1.5",
1990
- strokeLinecap: "round",
1991
- strokeLinejoin: "round"
1992
- }
1993
- )
1994
- }
1995
- )
1996
- },
1997
- {
1998
- ariaLabel: "Italic",
1999
- command: () => t.chain().focus().toggleItalic().run(),
2000
- isActive: () => !!e?.isItalic,
2001
- icon: /* @__PURE__ */ E(
2002
- "svg",
2003
- {
2004
- className: "scribe-inline-menu-icon",
2005
- viewBox: "0 0 24 24",
2006
- fill: "none",
2007
- xmlns: "http://www.w3.org/2000/svg",
2008
- children: /* @__PURE__ */ E(
2009
- "path",
2010
- {
2011
- d: "M10.8571 4H17.7142M6.28564 20H13.1428M14.2856 4L9.71422 20",
2012
- strokeWidth: "1.5",
2013
- strokeLinecap: "round",
2014
- strokeLinejoin: "round"
2015
- }
2016
- )
2017
- }
2018
- )
2019
- },
2020
- {
2021
- ariaLabel: "Strike",
2022
- command: () => t.chain().focus().toggleStrike().run(),
2023
- isActive: () => !!e?.isStrike,
2024
- icon: /* @__PURE__ */ E(
2025
- "svg",
2026
- {
2027
- className: "scribe-inline-menu-icon",
2028
- viewBox: "0 0 24 24",
2029
- fill: "none",
2030
- xmlns: "http://www.w3.org/2000/svg",
2031
- children: /* @__PURE__ */ E(
2032
- "path",
2033
- {
2034
- d: "M11.0121 12H12.9874C15.1693 12 16.938 13.7909 16.938 16C16.938 18.2091 15.1693 20 12.9874 20H11.0121C8.83024 20 7.06149 18.2091 7.06149 16M16.938 8C16.938 5.79086 15.1693 4 12.9874 4H11.0121C8.83024 4 7.06149 5.79086 7.06149 8C7.06149 8.3453 7.1047 8.68038 7.18595 9M4 12H20",
2035
- strokeWidth: "1.5",
2036
- strokeLinecap: "round",
2037
- strokeLinejoin: "round"
2038
- }
2039
- )
2040
- }
2041
- )
2042
- },
2043
- {
2044
- ariaLabel: "Inline code",
2045
- command: () => t.chain().focus().toggleCode().run(),
2046
- isActive: () => !!e?.isCode,
2047
- icon: /* @__PURE__ */ E(
2048
- "svg",
2049
- {
2050
- className: "scribe-inline-menu-icon",
2051
- viewBox: "0 0 24 24",
2052
- fill: "none",
2053
- xmlns: "http://www.w3.org/2000/svg",
2054
- children: /* @__PURE__ */ E(
2055
- "path",
2056
- {
2057
- d: "M16.5 16.5L21 12L16.5 7.50002M7.5 7.50002L3 12L7.5 16.5M13.8 3.90002L10.2 20.1",
2058
- strokeWidth: "1.5",
2059
- strokeLinecap: "round",
2060
- strokeLinejoin: "round"
2061
- }
2062
- )
2063
- }
2064
- )
2065
- }
2066
- ];
2067
- return /* @__PURE__ */ E(
2068
- Bi,
2069
- {
2070
- editor: t,
2071
- appendTo: Ie(t),
2072
- options: { strategy: "fixed" },
2073
- children: /* @__PURE__ */ E("div", { className: "scribe-bubble-menu", children: /* @__PURE__ */ E(ve, { align: "center", gap: "2", children: o.map((i) => /* @__PURE__ */ E(
2074
- ye,
2075
- {
2076
- type: "button",
2077
- size: "1",
2078
- radius: "medium",
2079
- color: "gray",
2080
- variant: i.isActive() ? "soft" : "ghost",
2081
- onMouseDown: (s) => n(s, i.command),
2082
- children: i.icon
2083
- },
2084
- i.ariaLabel
2085
- )) }) })
2086
- }
2087
- );
2088
- };
2089
- export {
2090
- Ki as default
1
+ import { i as e } from "../../dist-RuuEA1GJ.js";
2
+ import { getPopupMountTarget as t } from "../Scribe/extension/getPopupMountTarget.js";
3
+ import { t as n } from "../../menus-CzX7kyXn.js";
4
+ import { Flex as r, IconButton as i } from "@radix-ui/themes";
5
+ import { useCallback as a } from "react";
6
+ import { jsx as o } from "react/jsx-runtime";
7
+ //#region lib/components/Menu/BubbleMenu.tsx
8
+ var s = ({ editor: s }) => {
9
+ let c = e({
10
+ editor: s,
11
+ selector: ({ editor: e }) => e ? {
12
+ isHeading1: e.isActive("heading", { level: 1 }),
13
+ isHeading2: e.isActive("heading", { level: 2 }),
14
+ isHeading3: e.isActive("heading", { level: 3 }),
15
+ isBold: e.isActive("bold"),
16
+ isItalic: e.isActive("italic"),
17
+ isStrike: e.isActive("strike"),
18
+ isCode: e.isActive("code")
19
+ } : null
20
+ }), l = a((e, t) => {
21
+ e.preventDefault(), t();
22
+ }, []), u = [
23
+ {
24
+ ariaLabel: "Heading 1",
25
+ command: () => s.chain().focus().toggleHeading({ level: 1 }).run(),
26
+ isActive: () => !!c?.isHeading1,
27
+ icon: /* @__PURE__ */ o("svg", {
28
+ className: "scribe-inline-menu-icon",
29
+ viewBox: "0 0 24 24",
30
+ fill: "none",
31
+ xmlns: "http://www.w3.org/2000/svg",
32
+ children: /* @__PURE__ */ o("path", {
33
+ d: "M4.00023 5L4 17M13 5L12.9998 17M4 11H12.9998M19.875 19V10L17.625 12.25",
34
+ strokeWidth: "1.5",
35
+ strokeLinecap: "round",
36
+ strokeLinejoin: "round"
37
+ })
38
+ })
39
+ },
40
+ {
41
+ ariaLabel: "Heading 2",
42
+ command: () => s.chain().focus().toggleHeading({ level: 2 }).run(),
43
+ isActive: () => !!c?.isHeading2,
44
+ icon: /* @__PURE__ */ o("svg", {
45
+ fill: "none",
46
+ xmlns: "http://www.w3.org/2000/svg",
47
+ className: "scribe-inline-menu-icon",
48
+ viewBox: "0 0 24 24",
49
+ children: /* @__PURE__ */ o("path", {
50
+ d: "M3.37402 5V17M12.374 5V17M3.37402 11H12.374M16.302 11.373C16.5035 10.8941 16.8644 10.4997 17.3236 10.2566C17.7829 10.0136 18.312 9.93705 18.8213 10.0399C19.3306 10.1427 19.7886 10.4186 20.1175 10.8207C20.4465 11.2229 20.6262 11.7265 20.626 12.246C20.628 12.694 20.494 13.132 20.242 13.503L16.123 19H20.626",
51
+ strokeWidth: "1.5",
52
+ strokeLinecap: "round",
53
+ strokeLinejoin: "round"
54
+ })
55
+ })
56
+ },
57
+ {
58
+ ariaLabel: "Heading 3",
59
+ command: () => s.chain().focus().toggleHeading({ level: 3 }).run(),
60
+ isActive: () => !!c?.isHeading3,
61
+ icon: /* @__PURE__ */ o("svg", {
62
+ className: "scribe-inline-menu-icon",
63
+ viewBox: "0 0 24 24",
64
+ fill: "none",
65
+ xmlns: "http://www.w3.org/2000/svg",
66
+ children: /* @__PURE__ */ o("path", {
67
+ d: "M3.375 5V17M12.375 5V17M3.375 11H12.375M16.125 10H20.625L18 13.75C18.4317 13.7499 18.8568 13.8564 19.2375 14.0598C19.6183 14.2633 19.943 14.5575 20.1828 14.9165C20.4227 15.2754 20.5703 15.688 20.6127 16.1176C20.655 16.5472 20.5907 16.9807 20.4255 17.3795C20.2603 17.7783 19.9993 18.1303 19.6656 18.4042C19.3319 18.678 18.9358 18.8654 18.5123 18.9496C18.0889 19.0338 17.6513 19.0123 17.2382 18.8869C16.8251 18.7616 16.4492 18.5363 16.144 18.231",
68
+ strokeWidth: "1.5",
69
+ strokeLinecap: "round",
70
+ strokeLinejoin: "round"
71
+ })
72
+ })
73
+ },
74
+ {
75
+ ariaLabel: "Bold",
76
+ command: () => s.chain().focus().toggleBold().run(),
77
+ isActive: () => !!c?.isBold,
78
+ icon: /* @__PURE__ */ o("svg", {
79
+ className: "scribe-inline-menu-icon",
80
+ viewBox: "0 0 24 24",
81
+ fill: "none",
82
+ xmlns: "http://www.w3.org/2000/svg",
83
+ children: /* @__PURE__ */ o("path", {
84
+ d: "M12.8571 12C13.918 12 14.9354 11.5786 15.6856 10.8284C16.4357 10.0783 16.8571 9.06087 16.8571 8C16.8571 6.93913 16.4357 5.92172 15.6856 5.17157C14.9354 4.42143 13.918 4 12.8571 4H6V12M12.8571 12H6M12.8571 12H14C15.0609 12 16.0783 12.4214 16.8284 13.1716C17.5786 13.9217 18 14.9391 18 16C18 17.0609 17.5786 18.0783 16.8284 18.8284C16.0783 19.5786 15.0609 20 14 20H6V12",
85
+ strokeWidth: "1.5",
86
+ strokeLinecap: "round",
87
+ strokeLinejoin: "round"
88
+ })
89
+ })
90
+ },
91
+ {
92
+ ariaLabel: "Italic",
93
+ command: () => s.chain().focus().toggleItalic().run(),
94
+ isActive: () => !!c?.isItalic,
95
+ icon: /* @__PURE__ */ o("svg", {
96
+ className: "scribe-inline-menu-icon",
97
+ viewBox: "0 0 24 24",
98
+ fill: "none",
99
+ xmlns: "http://www.w3.org/2000/svg",
100
+ children: /* @__PURE__ */ o("path", {
101
+ d: "M10.8571 4H17.7142M6.28564 20H13.1428M14.2856 4L9.71422 20",
102
+ strokeWidth: "1.5",
103
+ strokeLinecap: "round",
104
+ strokeLinejoin: "round"
105
+ })
106
+ })
107
+ },
108
+ {
109
+ ariaLabel: "Strike",
110
+ command: () => s.chain().focus().toggleStrike().run(),
111
+ isActive: () => !!c?.isStrike,
112
+ icon: /* @__PURE__ */ o("svg", {
113
+ className: "scribe-inline-menu-icon",
114
+ viewBox: "0 0 24 24",
115
+ fill: "none",
116
+ xmlns: "http://www.w3.org/2000/svg",
117
+ children: /* @__PURE__ */ o("path", {
118
+ d: "M11.0121 12H12.9874C15.1693 12 16.938 13.7909 16.938 16C16.938 18.2091 15.1693 20 12.9874 20H11.0121C8.83024 20 7.06149 18.2091 7.06149 16M16.938 8C16.938 5.79086 15.1693 4 12.9874 4H11.0121C8.83024 4 7.06149 5.79086 7.06149 8C7.06149 8.3453 7.1047 8.68038 7.18595 9M4 12H20",
119
+ strokeWidth: "1.5",
120
+ strokeLinecap: "round",
121
+ strokeLinejoin: "round"
122
+ })
123
+ })
124
+ },
125
+ {
126
+ ariaLabel: "Inline code",
127
+ command: () => s.chain().focus().toggleCode().run(),
128
+ isActive: () => !!c?.isCode,
129
+ icon: /* @__PURE__ */ o("svg", {
130
+ className: "scribe-inline-menu-icon",
131
+ viewBox: "0 0 24 24",
132
+ fill: "none",
133
+ xmlns: "http://www.w3.org/2000/svg",
134
+ children: /* @__PURE__ */ o("path", {
135
+ d: "M16.5 16.5L21 12L16.5 7.50002M7.5 7.50002L3 12L7.5 16.5M13.8 3.90002L10.2 20.1",
136
+ strokeWidth: "1.5",
137
+ strokeLinecap: "round",
138
+ strokeLinejoin: "round"
139
+ })
140
+ })
141
+ }
142
+ ];
143
+ return /* @__PURE__ */ o(n, {
144
+ editor: s,
145
+ appendTo: t(s),
146
+ options: { strategy: "fixed" },
147
+ children: /* @__PURE__ */ o("div", {
148
+ className: "scribe-bubble-menu",
149
+ children: /* @__PURE__ */ o(r, {
150
+ align: "center",
151
+ gap: "2",
152
+ children: u.map((e) => /* @__PURE__ */ o(i, {
153
+ type: "button",
154
+ size: "1",
155
+ radius: "medium",
156
+ color: "gray",
157
+ variant: e.isActive() ? "soft" : "ghost",
158
+ onMouseDown: (t) => l(t, e.command),
159
+ children: e.icon
160
+ }, e.ariaLabel))
161
+ })
162
+ })
163
+ });
2091
164
  };
165
+ //#endregion
166
+ export { s as default };