@dialpad/dialtone 9.161.0 → 9.162.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/tokens/doc.json +102311 -102311
  2. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs +10 -10
  3. package/dist/vue3/lib/rich-text-editor/rich-text-editor.cjs.map +1 -1
  4. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js +2351 -830
  5. package/dist/vue3/lib/rich-text-editor/rich-text-editor.js.map +1 -1
  6. package/dist/vue3/node_modules/@tiptap/vue-3.cjs +1 -1
  7. package/dist/vue3/node_modules/@tiptap/vue-3.cjs.map +1 -1
  8. package/dist/vue3/node_modules/@tiptap/vue-3.js +233 -209
  9. package/dist/vue3/node_modules/@tiptap/vue-3.js.map +1 -1
  10. package/dist/vue3/types/components/rich_text_editor/extensions/channels/suggestion.d.ts +1 -6
  11. package/dist/vue3/types/components/rich_text_editor/extensions/channels/suggestion.d.ts.map +1 -1
  12. package/dist/vue3/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts +1 -6
  13. package/dist/vue3/types/components/rich_text_editor/extensions/emoji/suggestion.d.ts.map +1 -1
  14. package/dist/vue3/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts +1 -6
  15. package/dist/vue3/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts.map +1 -1
  16. package/dist/vue3/types/components/rich_text_editor/extensions/slash_command/suggestion.d.ts +1 -6
  17. package/dist/vue3/types/components/rich_text_editor/extensions/slash_command/suggestion.d.ts.map +1 -1
  18. package/dist/vue3/types/components/rich_text_editor/extensions/utils/suggestion_utils.d.ts +29 -0
  19. package/dist/vue3/types/components/rich_text_editor/extensions/utils/suggestion_utils.d.ts.map +1 -0
  20. package/package.json +31 -37
  21. package/dist/vue3/types/components/rich_text_editor/extensions/tippy_plugins/hide_on_esc.d.ts +0 -12
  22. package/dist/vue3/types/components/rich_text_editor/extensions/tippy_plugins/hide_on_esc.d.ts.map +0 -1
  23. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts +0 -768
  24. package/dist/vue3/types/components/rich_text_editor/rich_text_editor.vue.d.ts.map +0 -1
  25. package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts +0 -4072
  26. package/dist/vue3/types/recipes/conversation_view/editor/editor.vue.d.ts.map +0 -1
  27. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +0 -8005
  28. package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +0 -1
@@ -1,82 +1,1681 @@
1
- import { nodeViewProps as L, NodeViewWrapper as v, VueRenderer as R, VueNodeViewRenderer as S, BubbleMenu as ne, EditorContent as oe, Editor as re } from "../../node_modules/@tiptap/vue-3.js";
2
- import { Node as W, nodePasteRule as O, InputRule as se, mergeAttributes as T, getMarksBetween as ie, combineTransactionSteps as ae, getChangedRanges as ce, findChildrenInRange as le, Mark as de, nodeInputRule as ue, Extension as me } from "@tiptap/core";
3
- import he from "@tiptap/extension-blockquote";
4
- import pe from "@tiptap/extension-code-block";
5
- import fe from "@tiptap/extension-code";
6
- import ge from "@tiptap/extension-document";
7
- import _e from "@tiptap/extension-gapcursor";
8
- import ke from "@tiptap/extension-hard-break";
9
- import z from "@tiptap/extension-paragraph";
10
- import ye from "@tiptap/extension-placeholder";
11
- import be from "@tiptap/extension-bold";
12
- import we from "@tiptap/extension-bullet-list";
13
- import Te from "@tiptap/extension-italic";
14
- import xe from "@tiptap/extension-link";
15
- import Ce from "@tiptap/extension-list-item";
16
- import Ee from "@tiptap/extension-ordered-list";
17
- import Le from "@tiptap/extension-strike";
18
- import ve from "@tiptap/extension-underline";
19
- import Se from "@tiptap/extension-text";
20
- import $e from "@tiptap/extension-text-align";
21
- import Ie from "@tiptap/extension-history";
22
- import Ae from "@tiptap/extension-table";
23
- import Re from "@tiptap/extension-table-cell";
24
- import Me from "@tiptap/extension-table-header";
25
- import Be from "@tiptap/extension-table-row";
26
- import Ne from "@tiptap/extension-text-style";
27
- import De from "@tiptap/extension-color";
28
- import Oe from "@tiptap/extension-font-family";
29
- import { PluginKey as $, Plugin as He } from "@tiptap/pm/state";
30
- import Pe from "@tiptap/suggestion";
31
- import { emojiPattern as X } from "regex-combined-emojis";
32
- import { resolveComponent as l, openBlock as d, createBlock as p, withCtx as u, createVNode as m, createElementBlock as y, withDirectives as je, createElementVNode as b, Fragment as Ve, renderList as Ke, withModifiers as P, normalizeClass as G, resolveDynamicComponent as Fe, vShow as Ue, createTextVNode as C, toDisplayString as f, markRaw as M, createCommentVNode as w, withKeys as qe, mergeProps as J } from "vue";
33
- import { _ as g } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
34
- import Y from "../emoji/emoji.js";
35
- import { getEmojiData as We, emojiRegex as ze, stringToUnicode as Xe, codeToEmojiData as j, emojiShortCodeRegex as Ge } from "../../common/emoji/index.js";
36
- import Je from "../list-item/list-item.js";
37
- import I from "../stack/stack.js";
38
- import B from "tippy.js";
39
- import { linkRegex as Ye, getPhoneNumberRegex as Qe, warnIfUnmounted as Ze, returnFirstEl as K } from "../../common/utils/index.js";
40
- import et from "@tiptap/extension-image";
41
- import V from "@tiptap/extension-mention";
42
- import Q from "../link/link.js";
43
- import { DtIconLock as tt } from "@dialpad/dialtone-icons/vue3";
44
- import { DialtoneLocalization as Z } from "../../localization/index.js";
45
- import nt from "../input/input.js";
46
- import ot from "../popover/popover.js";
47
- import ee from "../button/button.js";
48
- import rt from "../badge/badge.js";
49
- import { RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as F, RICH_TEXT_EDITOR_OUTPUT_FORMATS as st, RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as it } from "./rich-text-editor-constants.js";
50
- import at from "../avatar/avatar.js";
51
- import ct from "@dialpad/dialtone-icons/vue3/hash";
52
- import lt from "@dialpad/dialtone-icons/vue3/lock";
53
- import dt from "deep-equal";
54
- const ut = {
1
+ import { nodeViewProps as ft, NodeViewWrapper as pt, VueRenderer as je, VueNodeViewRenderer as mt, EditorContent as ze, Editor as Fe } from "../../node_modules/@tiptap/vue-3.js";
2
+ import { isTextSelection as Ke, posToDOMRect as re, getText as We, getTextSerializersFromSchema as qe, Node as ae, nodePasteRule as Et, InputRule as Xe, mergeAttributes as st, getMarksBetween as Ye, combineTransactionSteps as Ge, getChangedRanges as Je, findChildrenInRange as Ze, Mark as Qe, nodeInputRule as tn, Extension as en } from "@tiptap/core";
3
+ import { Plugin as It, PluginKey as rt, NodeSelection as nn } from "@tiptap/pm/state";
4
+ import { CellSelection as on } from "@tiptap/pm/tables";
5
+ import { defineComponent as le, ref as ce, onMounted as de, nextTick as sn, onBeforeUnmount as ue, h as he, resolveComponent as T, openBlock as k, createBlock as M, withCtx as C, createVNode as I, createElementBlock as et, withDirectives as rn, createElementVNode as nt, Fragment as an, renderList as ln, withModifiers as Dt, normalizeClass as fe, resolveDynamicComponent as cn, vShow as dn, markRaw as un, createTextVNode as at, toDisplayString as $, createCommentVNode as it, withKeys as hn, mergeProps as pe } from "vue";
6
+ import fn from "@tiptap/extension-blockquote";
7
+ import pn from "@tiptap/extension-code-block";
8
+ import mn from "@tiptap/extension-code";
9
+ import gn from "@tiptap/extension-document";
10
+ import { UndoRedo as yn, Placeholder as wn, Gapcursor as bn } from "@tiptap/extensions";
11
+ import vn from "@tiptap/extension-hard-break";
12
+ import me from "@tiptap/extension-paragraph";
13
+ import xn from "@tiptap/extension-bold";
14
+ import { BulletList as Tn, ListItem as _n, OrderedList as kn } from "@tiptap/extension-list";
15
+ import Cn from "@tiptap/extension-italic";
16
+ import On from "@tiptap/extension-link";
17
+ import En from "@tiptap/extension-strike";
18
+ import Sn from "@tiptap/extension-underline";
19
+ import Ln from "@tiptap/extension-text";
20
+ import In from "@tiptap/extension-text-align";
21
+ import { Table as Dn, TableRow as An, TableHeader as Rn, TableCell as Mn } from "@tiptap/extension-table";
22
+ import { TextStyleKit as Hn } from "@tiptap/extension-text-style";
23
+ import $n from "@tiptap/suggestion";
24
+ import { emojiPattern as ge } from "regex-combined-emojis";
25
+ import { _ as q } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
26
+ import ye from "../emoji/emoji.js";
27
+ import { getEmojiData as Bn, emojiRegex as Nn, stringToUnicode as Pn, codeToEmojiData as At, emojiShortCodeRegex as Un } from "../../common/emoji/index.js";
28
+ import Vn from "../list-item/list-item.js";
29
+ import gt from "../stack/stack.js";
30
+ import { linkRegex as jn, getPhoneNumberRegex as zn, warnIfUnmounted as Fn, returnFirstEl as zt } from "../../common/utils/index.js";
31
+ import Kn from "@tiptap/extension-image";
32
+ import Rt from "@tiptap/extension-mention";
33
+ import we from "../link/link.js";
34
+ import { DtIconLock as Wn } from "@dialpad/dialtone-icons/vue3";
35
+ import { DialtoneLocalization as be } from "../../localization/index.js";
36
+ import qn from "../input/input.js";
37
+ import Xn from "../popover/popover.js";
38
+ import ve from "../button/button.js";
39
+ import Yn from "../badge/badge.js";
40
+ import { RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS as Ft, RICH_TEXT_EDITOR_OUTPUT_FORMATS as Gn, RICH_TEXT_EDITOR_AUTOFOCUS_TYPES as Jn } from "./rich-text-editor-constants.js";
41
+ import Zn from "../avatar/avatar.js";
42
+ import Qn from "@dialpad/dialtone-icons/vue3/hash";
43
+ import to from "@dialpad/dialtone-icons/vue3/lock";
44
+ import eo from "deep-equal";
45
+ const xe = ["top", "right", "bottom", "left"], Kt = ["start", "end"], Wt = /* @__PURE__ */ xe.reduce((t, e) => t.concat(e, e + "-" + Kt[0], e + "-" + Kt[1]), []), G = Math.min, R = Math.max, wt = Math.round, Y = (t) => ({
46
+ x: t,
47
+ y: t
48
+ }), no = {
49
+ left: "right",
50
+ right: "left",
51
+ bottom: "top",
52
+ top: "bottom"
53
+ }, oo = {
54
+ start: "end",
55
+ end: "start"
56
+ };
57
+ function St(t, e, o) {
58
+ return R(t, G(e, o));
59
+ }
60
+ function Z(t, e) {
61
+ return typeof t == "function" ? t(e) : t;
62
+ }
63
+ function j(t) {
64
+ return t.split("-")[0];
65
+ }
66
+ function F(t) {
67
+ return t.split("-")[1];
68
+ }
69
+ function Te(t) {
70
+ return t === "x" ? "y" : "x";
71
+ }
72
+ function Mt(t) {
73
+ return t === "y" ? "height" : "width";
74
+ }
75
+ const io = /* @__PURE__ */ new Set(["top", "bottom"]);
76
+ function X(t) {
77
+ return io.has(j(t)) ? "y" : "x";
78
+ }
79
+ function Ht(t) {
80
+ return Te(X(t));
81
+ }
82
+ function _e(t, e, o) {
83
+ o === void 0 && (o = !1);
84
+ const n = F(t), i = Ht(t), s = Mt(i);
85
+ let r = i === "x" ? n === (o ? "end" : "start") ? "right" : "left" : n === "start" ? "bottom" : "top";
86
+ return e.reference[s] > e.floating[s] && (r = vt(r)), [r, vt(r)];
87
+ }
88
+ function so(t) {
89
+ const e = vt(t);
90
+ return [bt(t), e, bt(e)];
91
+ }
92
+ function bt(t) {
93
+ return t.replace(/start|end/g, (e) => oo[e]);
94
+ }
95
+ const qt = ["left", "right"], Xt = ["right", "left"], ro = ["top", "bottom"], ao = ["bottom", "top"];
96
+ function lo(t, e, o) {
97
+ switch (t) {
98
+ case "top":
99
+ case "bottom":
100
+ return o ? e ? Xt : qt : e ? qt : Xt;
101
+ case "left":
102
+ case "right":
103
+ return e ? ro : ao;
104
+ default:
105
+ return [];
106
+ }
107
+ }
108
+ function co(t, e, o, n) {
109
+ const i = F(t);
110
+ let s = lo(j(t), o === "start", n);
111
+ return i && (s = s.map((r) => r + "-" + i), e && (s = s.concat(s.map(bt)))), s;
112
+ }
113
+ function vt(t) {
114
+ return t.replace(/left|right|bottom|top/g, (e) => no[e]);
115
+ }
116
+ function uo(t) {
117
+ return {
118
+ top: 0,
119
+ right: 0,
120
+ bottom: 0,
121
+ left: 0,
122
+ ...t
123
+ };
124
+ }
125
+ function $t(t) {
126
+ return typeof t != "number" ? uo(t) : {
127
+ top: t,
128
+ right: t,
129
+ bottom: t,
130
+ left: t
131
+ };
132
+ }
133
+ function ct(t) {
134
+ const {
135
+ x: e,
136
+ y: o,
137
+ width: n,
138
+ height: i
139
+ } = t;
140
+ return {
141
+ width: n,
142
+ height: i,
143
+ top: o,
144
+ left: e,
145
+ right: e + n,
146
+ bottom: o + i,
147
+ x: e,
148
+ y: o
149
+ };
150
+ }
151
+ function Yt(t, e, o) {
152
+ let {
153
+ reference: n,
154
+ floating: i
155
+ } = t;
156
+ const s = X(e), r = Ht(e), a = Mt(r), l = j(e), u = s === "y", d = n.x + n.width / 2 - i.width / 2, c = n.y + n.height / 2 - i.height / 2, h = n[a] / 2 - i[a] / 2;
157
+ let f;
158
+ switch (l) {
159
+ case "top":
160
+ f = {
161
+ x: d,
162
+ y: n.y - i.height
163
+ };
164
+ break;
165
+ case "bottom":
166
+ f = {
167
+ x: d,
168
+ y: n.y + n.height
169
+ };
170
+ break;
171
+ case "right":
172
+ f = {
173
+ x: n.x + n.width,
174
+ y: c
175
+ };
176
+ break;
177
+ case "left":
178
+ f = {
179
+ x: n.x - i.width,
180
+ y: c
181
+ };
182
+ break;
183
+ default:
184
+ f = {
185
+ x: n.x,
186
+ y: n.y
187
+ };
188
+ }
189
+ switch (F(e)) {
190
+ case "start":
191
+ f[r] -= h * (o && u ? -1 : 1);
192
+ break;
193
+ case "end":
194
+ f[r] += h * (o && u ? -1 : 1);
195
+ break;
196
+ }
197
+ return f;
198
+ }
199
+ async function ho(t, e) {
200
+ var o;
201
+ e === void 0 && (e = {});
202
+ const {
203
+ x: n,
204
+ y: i,
205
+ platform: s,
206
+ rects: r,
207
+ elements: a,
208
+ strategy: l
209
+ } = t, {
210
+ boundary: u = "clippingAncestors",
211
+ rootBoundary: d = "viewport",
212
+ elementContext: c = "floating",
213
+ altBoundary: h = !1,
214
+ padding: f = 0
215
+ } = Z(e, t), p = $t(f), g = a[h ? c === "floating" ? "reference" : "floating" : c], y = ct(await s.getClippingRect({
216
+ element: (o = await (s.isElement == null ? void 0 : s.isElement(g))) == null || o ? g : g.contextElement || await (s.getDocumentElement == null ? void 0 : s.getDocumentElement(a.floating)),
217
+ boundary: u,
218
+ rootBoundary: d,
219
+ strategy: l
220
+ })), b = c === "floating" ? {
221
+ x: n,
222
+ y: i,
223
+ width: r.floating.width,
224
+ height: r.floating.height
225
+ } : r.reference, v = await (s.getOffsetParent == null ? void 0 : s.getOffsetParent(a.floating)), x = await (s.isElement == null ? void 0 : s.isElement(v)) ? await (s.getScale == null ? void 0 : s.getScale(v)) || {
226
+ x: 1,
227
+ y: 1
228
+ } : {
229
+ x: 1,
230
+ y: 1
231
+ }, O = ct(s.convertOffsetParentRelativeRectToViewportRelativeRect ? await s.convertOffsetParentRelativeRectToViewportRelativeRect({
232
+ elements: a,
233
+ rect: b,
234
+ offsetParent: v,
235
+ strategy: l
236
+ }) : b);
237
+ return {
238
+ top: (y.top - O.top + p.top) / x.y,
239
+ bottom: (O.bottom - y.bottom + p.bottom) / x.y,
240
+ left: (y.left - O.left + p.left) / x.x,
241
+ right: (O.right - y.right + p.right) / x.x
242
+ };
243
+ }
244
+ const fo = async (t, e, o) => {
245
+ const {
246
+ placement: n = "bottom",
247
+ strategy: i = "absolute",
248
+ middleware: s = [],
249
+ platform: r
250
+ } = o, a = s.filter(Boolean), l = await (r.isRTL == null ? void 0 : r.isRTL(e));
251
+ let u = await r.getElementRects({
252
+ reference: t,
253
+ floating: e,
254
+ strategy: i
255
+ }), {
256
+ x: d,
257
+ y: c
258
+ } = Yt(u, n, l), h = n, f = {}, p = 0;
259
+ for (let g = 0; g < a.length; g++) {
260
+ var m;
261
+ const {
262
+ name: y,
263
+ fn: b
264
+ } = a[g], {
265
+ x: v,
266
+ y: x,
267
+ data: O,
268
+ reset: _
269
+ } = await b({
270
+ x: d,
271
+ y: c,
272
+ initialPlacement: n,
273
+ placement: h,
274
+ strategy: i,
275
+ middlewareData: f,
276
+ rects: u,
277
+ platform: {
278
+ ...r,
279
+ detectOverflow: (m = r.detectOverflow) != null ? m : ho
280
+ },
281
+ elements: {
282
+ reference: t,
283
+ floating: e
284
+ }
285
+ });
286
+ d = v ?? d, c = x ?? c, f = {
287
+ ...f,
288
+ [y]: {
289
+ ...f[y],
290
+ ...O
291
+ }
292
+ }, _ && p <= 50 && (p++, typeof _ == "object" && (_.placement && (h = _.placement), _.rects && (u = _.rects === !0 ? await r.getElementRects({
293
+ reference: t,
294
+ floating: e,
295
+ strategy: i
296
+ }) : _.rects), {
297
+ x: d,
298
+ y: c
299
+ } = Yt(u, h, l)), g = -1);
300
+ }
301
+ return {
302
+ x: d,
303
+ y: c,
304
+ placement: h,
305
+ strategy: i,
306
+ middlewareData: f
307
+ };
308
+ }, po = (t) => ({
309
+ name: "arrow",
310
+ options: t,
311
+ async fn(e) {
312
+ const {
313
+ x: o,
314
+ y: n,
315
+ placement: i,
316
+ rects: s,
317
+ platform: r,
318
+ elements: a,
319
+ middlewareData: l
320
+ } = e, {
321
+ element: u,
322
+ padding: d = 0
323
+ } = Z(t, e) || {};
324
+ if (u == null)
325
+ return {};
326
+ const c = $t(d), h = {
327
+ x: o,
328
+ y: n
329
+ }, f = Ht(i), p = Mt(f), m = await r.getDimensions(u), g = f === "y", y = g ? "top" : "left", b = g ? "bottom" : "right", v = g ? "clientHeight" : "clientWidth", x = s.reference[p] + s.reference[f] - h[f] - s.floating[p], O = h[f] - s.reference[f], _ = await (r.getOffsetParent == null ? void 0 : r.getOffsetParent(u));
330
+ let L = _ ? _[v] : 0;
331
+ (!L || !await (r.isElement == null ? void 0 : r.isElement(_))) && (L = a.floating[v] || s.floating[p]);
332
+ const U = x / 2 - O / 2, D = L / 2 - m[p] / 2 - 1, w = G(c[y], D), E = G(c[b], D), A = w, H = L - m[p] - E, S = L / 2 - m[p] / 2 + U, z = St(A, S, H), V = !l.arrow && F(i) != null && S !== z && s.reference[p] / 2 - (S < A ? w : E) - m[p] / 2 < 0, B = V ? S < A ? S - A : S - H : 0;
333
+ return {
334
+ [f]: h[f] + B,
335
+ data: {
336
+ [f]: z,
337
+ centerOffset: S - z - B,
338
+ ...V && {
339
+ alignmentOffset: B
340
+ }
341
+ },
342
+ reset: V
343
+ };
344
+ }
345
+ });
346
+ function mo(t, e, o) {
347
+ return (t ? [...o.filter((i) => F(i) === t), ...o.filter((i) => F(i) !== t)] : o.filter((i) => j(i) === i)).filter((i) => t ? F(i) === t || (e ? bt(i) !== i : !1) : !0);
348
+ }
349
+ const go = function(t) {
350
+ return t === void 0 && (t = {}), {
351
+ name: "autoPlacement",
352
+ options: t,
353
+ async fn(e) {
354
+ var o, n, i;
355
+ const {
356
+ rects: s,
357
+ middlewareData: r,
358
+ placement: a,
359
+ platform: l,
360
+ elements: u
361
+ } = e, {
362
+ crossAxis: d = !1,
363
+ alignment: c,
364
+ allowedPlacements: h = Wt,
365
+ autoAlignment: f = !0,
366
+ ...p
367
+ } = Z(t, e), m = c !== void 0 || h === Wt ? mo(c || null, f, h) : h, g = await l.detectOverflow(e, p), y = ((o = r.autoPlacement) == null ? void 0 : o.index) || 0, b = m[y];
368
+ if (b == null)
369
+ return {};
370
+ const v = _e(b, s, await (l.isRTL == null ? void 0 : l.isRTL(u.floating)));
371
+ if (a !== b)
372
+ return {
373
+ reset: {
374
+ placement: m[0]
375
+ }
376
+ };
377
+ const x = [g[j(b)], g[v[0]], g[v[1]]], O = [...((n = r.autoPlacement) == null ? void 0 : n.overflows) || [], {
378
+ placement: b,
379
+ overflows: x
380
+ }], _ = m[y + 1];
381
+ if (_)
382
+ return {
383
+ data: {
384
+ index: y + 1,
385
+ overflows: O
386
+ },
387
+ reset: {
388
+ placement: _
389
+ }
390
+ };
391
+ const L = O.map((w) => {
392
+ const E = F(w.placement);
393
+ return [w.placement, E && d ? (
394
+ // Check along the mainAxis and main crossAxis side.
395
+ w.overflows.slice(0, 2).reduce((A, H) => A + H, 0)
396
+ ) : (
397
+ // Check only the mainAxis.
398
+ w.overflows[0]
399
+ ), w.overflows];
400
+ }).sort((w, E) => w[1] - E[1]), D = ((i = L.filter((w) => w[2].slice(
401
+ 0,
402
+ // Aligned placements should not check their opposite crossAxis
403
+ // side.
404
+ F(w[0]) ? 2 : 3
405
+ ).every((E) => E <= 0))[0]) == null ? void 0 : i[0]) || L[0][0];
406
+ return D !== a ? {
407
+ data: {
408
+ index: y + 1,
409
+ overflows: O
410
+ },
411
+ reset: {
412
+ placement: D
413
+ }
414
+ } : {};
415
+ }
416
+ };
417
+ }, yo = function(t) {
418
+ return t === void 0 && (t = {}), {
419
+ name: "flip",
420
+ options: t,
421
+ async fn(e) {
422
+ var o, n;
423
+ const {
424
+ placement: i,
425
+ middlewareData: s,
426
+ rects: r,
427
+ initialPlacement: a,
428
+ platform: l,
429
+ elements: u
430
+ } = e, {
431
+ mainAxis: d = !0,
432
+ crossAxis: c = !0,
433
+ fallbackPlacements: h,
434
+ fallbackStrategy: f = "bestFit",
435
+ fallbackAxisSideDirection: p = "none",
436
+ flipAlignment: m = !0,
437
+ ...g
438
+ } = Z(t, e);
439
+ if ((o = s.arrow) != null && o.alignmentOffset)
440
+ return {};
441
+ const y = j(i), b = X(a), v = j(a) === a, x = await (l.isRTL == null ? void 0 : l.isRTL(u.floating)), O = h || (v || !m ? [vt(a)] : so(a)), _ = p !== "none";
442
+ !h && _ && O.push(...co(a, m, p, x));
443
+ const L = [a, ...O], U = await l.detectOverflow(e, g), D = [];
444
+ let w = ((n = s.flip) == null ? void 0 : n.overflows) || [];
445
+ if (d && D.push(U[y]), c) {
446
+ const S = _e(i, r, x);
447
+ D.push(U[S[0]], U[S[1]]);
448
+ }
449
+ if (w = [...w, {
450
+ placement: i,
451
+ overflows: D
452
+ }], !D.every((S) => S <= 0)) {
453
+ var E, A;
454
+ const S = (((E = s.flip) == null ? void 0 : E.index) || 0) + 1, z = L[S];
455
+ if (z && (!(c === "alignment" ? b !== X(z) : !1) || // We leave the current main axis only if every placement on that axis
456
+ // overflows the main axis.
457
+ w.every((N) => X(N.placement) === b ? N.overflows[0] > 0 : !0)))
458
+ return {
459
+ data: {
460
+ index: S,
461
+ overflows: w
462
+ },
463
+ reset: {
464
+ placement: z
465
+ }
466
+ };
467
+ let V = (A = w.filter((B) => B.overflows[0] <= 0).sort((B, N) => B.overflows[1] - N.overflows[1])[0]) == null ? void 0 : A.placement;
468
+ if (!V)
469
+ switch (f) {
470
+ case "bestFit": {
471
+ var H;
472
+ const B = (H = w.filter((N) => {
473
+ if (_) {
474
+ const tt = X(N.placement);
475
+ return tt === b || // Create a bias to the `y` side axis due to horizontal
476
+ // reading directions favoring greater width.
477
+ tt === "y";
478
+ }
479
+ return !0;
480
+ }).map((N) => [N.placement, N.overflows.filter((tt) => tt > 0).reduce((tt, Ve) => tt + Ve, 0)]).sort((N, tt) => N[1] - tt[1])[0]) == null ? void 0 : H[0];
481
+ B && (V = B);
482
+ break;
483
+ }
484
+ case "initialPlacement":
485
+ V = a;
486
+ break;
487
+ }
488
+ if (i !== V)
489
+ return {
490
+ reset: {
491
+ placement: V
492
+ }
493
+ };
494
+ }
495
+ return {};
496
+ }
497
+ };
498
+ };
499
+ function Gt(t, e) {
500
+ return {
501
+ top: t.top - e.height,
502
+ right: t.right - e.width,
503
+ bottom: t.bottom - e.height,
504
+ left: t.left - e.width
505
+ };
506
+ }
507
+ function Jt(t) {
508
+ return xe.some((e) => t[e] >= 0);
509
+ }
510
+ const wo = function(t) {
511
+ return t === void 0 && (t = {}), {
512
+ name: "hide",
513
+ options: t,
514
+ async fn(e) {
515
+ const {
516
+ rects: o,
517
+ platform: n
518
+ } = e, {
519
+ strategy: i = "referenceHidden",
520
+ ...s
521
+ } = Z(t, e);
522
+ switch (i) {
523
+ case "referenceHidden": {
524
+ const r = await n.detectOverflow(e, {
525
+ ...s,
526
+ elementContext: "reference"
527
+ }), a = Gt(r, o.reference);
528
+ return {
529
+ data: {
530
+ referenceHiddenOffsets: a,
531
+ referenceHidden: Jt(a)
532
+ }
533
+ };
534
+ }
535
+ case "escaped": {
536
+ const r = await n.detectOverflow(e, {
537
+ ...s,
538
+ altBoundary: !0
539
+ }), a = Gt(r, o.floating);
540
+ return {
541
+ data: {
542
+ escapedOffsets: a,
543
+ escaped: Jt(a)
544
+ }
545
+ };
546
+ }
547
+ default:
548
+ return {};
549
+ }
550
+ }
551
+ };
552
+ };
553
+ function ke(t) {
554
+ const e = G(...t.map((s) => s.left)), o = G(...t.map((s) => s.top)), n = R(...t.map((s) => s.right)), i = R(...t.map((s) => s.bottom));
555
+ return {
556
+ x: e,
557
+ y: o,
558
+ width: n - e,
559
+ height: i - o
560
+ };
561
+ }
562
+ function bo(t) {
563
+ const e = t.slice().sort((i, s) => i.y - s.y), o = [];
564
+ let n = null;
565
+ for (let i = 0; i < e.length; i++) {
566
+ const s = e[i];
567
+ !n || s.y - n.y > n.height / 2 ? o.push([s]) : o[o.length - 1].push(s), n = s;
568
+ }
569
+ return o.map((i) => ct(ke(i)));
570
+ }
571
+ const vo = function(t) {
572
+ return t === void 0 && (t = {}), {
573
+ name: "inline",
574
+ options: t,
575
+ async fn(e) {
576
+ const {
577
+ placement: o,
578
+ elements: n,
579
+ rects: i,
580
+ platform: s,
581
+ strategy: r
582
+ } = e, {
583
+ padding: a = 2,
584
+ x: l,
585
+ y: u
586
+ } = Z(t, e), d = Array.from(await (s.getClientRects == null ? void 0 : s.getClientRects(n.reference)) || []), c = bo(d), h = ct(ke(d)), f = $t(a);
587
+ function p() {
588
+ if (c.length === 2 && c[0].left > c[1].right && l != null && u != null)
589
+ return c.find((g) => l > g.left - f.left && l < g.right + f.right && u > g.top - f.top && u < g.bottom + f.bottom) || h;
590
+ if (c.length >= 2) {
591
+ if (X(o) === "y") {
592
+ const w = c[0], E = c[c.length - 1], A = j(o) === "top", H = w.top, S = E.bottom, z = A ? w.left : E.left, V = A ? w.right : E.right, B = V - z, N = S - H;
593
+ return {
594
+ top: H,
595
+ bottom: S,
596
+ left: z,
597
+ right: V,
598
+ width: B,
599
+ height: N,
600
+ x: z,
601
+ y: H
602
+ };
603
+ }
604
+ const g = j(o) === "left", y = R(...c.map((w) => w.right)), b = G(...c.map((w) => w.left)), v = c.filter((w) => g ? w.left === b : w.right === y), x = v[0].top, O = v[v.length - 1].bottom, _ = b, L = y, U = L - _, D = O - x;
605
+ return {
606
+ top: x,
607
+ bottom: O,
608
+ left: _,
609
+ right: L,
610
+ width: U,
611
+ height: D,
612
+ x: _,
613
+ y: x
614
+ };
615
+ }
616
+ return h;
617
+ }
618
+ const m = await s.getElementRects({
619
+ reference: {
620
+ getBoundingClientRect: p
621
+ },
622
+ floating: n.floating,
623
+ strategy: r
624
+ });
625
+ return i.reference.x !== m.reference.x || i.reference.y !== m.reference.y || i.reference.width !== m.reference.width || i.reference.height !== m.reference.height ? {
626
+ reset: {
627
+ rects: m
628
+ }
629
+ } : {};
630
+ }
631
+ };
632
+ }, xo = /* @__PURE__ */ new Set(["left", "top"]);
633
+ async function To(t, e) {
634
+ const {
635
+ placement: o,
636
+ platform: n,
637
+ elements: i
638
+ } = t, s = await (n.isRTL == null ? void 0 : n.isRTL(i.floating)), r = j(o), a = F(o), l = X(o) === "y", u = xo.has(r) ? -1 : 1, d = s && l ? -1 : 1, c = Z(e, t);
639
+ let {
640
+ mainAxis: h,
641
+ crossAxis: f,
642
+ alignmentAxis: p
643
+ } = typeof c == "number" ? {
644
+ mainAxis: c,
645
+ crossAxis: 0,
646
+ alignmentAxis: null
647
+ } : {
648
+ mainAxis: c.mainAxis || 0,
649
+ crossAxis: c.crossAxis || 0,
650
+ alignmentAxis: c.alignmentAxis
651
+ };
652
+ return a && typeof p == "number" && (f = a === "end" ? p * -1 : p), l ? {
653
+ x: f * d,
654
+ y: h * u
655
+ } : {
656
+ x: h * u,
657
+ y: f * d
658
+ };
659
+ }
660
+ const _o = function(t) {
661
+ return t === void 0 && (t = 0), {
662
+ name: "offset",
663
+ options: t,
664
+ async fn(e) {
665
+ var o, n;
666
+ const {
667
+ x: i,
668
+ y: s,
669
+ placement: r,
670
+ middlewareData: a
671
+ } = e, l = await To(e, t);
672
+ return r === ((o = a.offset) == null ? void 0 : o.placement) && (n = a.arrow) != null && n.alignmentOffset ? {} : {
673
+ x: i + l.x,
674
+ y: s + l.y,
675
+ data: {
676
+ ...l,
677
+ placement: r
678
+ }
679
+ };
680
+ }
681
+ };
682
+ }, ko = function(t) {
683
+ return t === void 0 && (t = {}), {
684
+ name: "shift",
685
+ options: t,
686
+ async fn(e) {
687
+ const {
688
+ x: o,
689
+ y: n,
690
+ placement: i,
691
+ platform: s
692
+ } = e, {
693
+ mainAxis: r = !0,
694
+ crossAxis: a = !1,
695
+ limiter: l = {
696
+ fn: (y) => {
697
+ let {
698
+ x: b,
699
+ y: v
700
+ } = y;
701
+ return {
702
+ x: b,
703
+ y: v
704
+ };
705
+ }
706
+ },
707
+ ...u
708
+ } = Z(t, e), d = {
709
+ x: o,
710
+ y: n
711
+ }, c = await s.detectOverflow(e, u), h = X(j(i)), f = Te(h);
712
+ let p = d[f], m = d[h];
713
+ if (r) {
714
+ const y = f === "y" ? "top" : "left", b = f === "y" ? "bottom" : "right", v = p + c[y], x = p - c[b];
715
+ p = St(v, p, x);
716
+ }
717
+ if (a) {
718
+ const y = h === "y" ? "top" : "left", b = h === "y" ? "bottom" : "right", v = m + c[y], x = m - c[b];
719
+ m = St(v, m, x);
720
+ }
721
+ const g = l.fn({
722
+ ...e,
723
+ [f]: p,
724
+ [h]: m
725
+ });
726
+ return {
727
+ ...g,
728
+ data: {
729
+ x: g.x - o,
730
+ y: g.y - n,
731
+ enabled: {
732
+ [f]: r,
733
+ [h]: a
734
+ }
735
+ }
736
+ };
737
+ }
738
+ };
739
+ }, Co = function(t) {
740
+ return t === void 0 && (t = {}), {
741
+ name: "size",
742
+ options: t,
743
+ async fn(e) {
744
+ var o, n;
745
+ const {
746
+ placement: i,
747
+ rects: s,
748
+ platform: r,
749
+ elements: a
750
+ } = e, {
751
+ apply: l = () => {
752
+ },
753
+ ...u
754
+ } = Z(t, e), d = await r.detectOverflow(e, u), c = j(i), h = F(i), f = X(i) === "y", {
755
+ width: p,
756
+ height: m
757
+ } = s.floating;
758
+ let g, y;
759
+ c === "top" || c === "bottom" ? (g = c, y = h === (await (r.isRTL == null ? void 0 : r.isRTL(a.floating)) ? "start" : "end") ? "left" : "right") : (y = c, g = h === "end" ? "top" : "bottom");
760
+ const b = m - d.top - d.bottom, v = p - d.left - d.right, x = G(m - d[g], b), O = G(p - d[y], v), _ = !e.middlewareData.shift;
761
+ let L = x, U = O;
762
+ if ((o = e.middlewareData.shift) != null && o.enabled.x && (U = v), (n = e.middlewareData.shift) != null && n.enabled.y && (L = b), _ && !h) {
763
+ const w = R(d.left, 0), E = R(d.right, 0), A = R(d.top, 0), H = R(d.bottom, 0);
764
+ f ? U = p - 2 * (w !== 0 || E !== 0 ? w + E : R(d.left, d.right)) : L = m - 2 * (A !== 0 || H !== 0 ? A + H : R(d.top, d.bottom));
765
+ }
766
+ await l({
767
+ ...e,
768
+ availableWidth: U,
769
+ availableHeight: L
770
+ });
771
+ const D = await r.getDimensions(a.floating);
772
+ return p !== D.width || m !== D.height ? {
773
+ reset: {
774
+ rects: !0
775
+ }
776
+ } : {};
777
+ }
778
+ };
779
+ };
780
+ function xt() {
781
+ return typeof window < "u";
782
+ }
783
+ function ut(t) {
784
+ return Ce(t) ? (t.nodeName || "").toLowerCase() : "#document";
785
+ }
786
+ function P(t) {
787
+ var e;
788
+ return (t == null || (e = t.ownerDocument) == null ? void 0 : e.defaultView) || window;
789
+ }
790
+ function Q(t) {
791
+ var e;
792
+ return (e = (Ce(t) ? t.ownerDocument : t.document) || window.document) == null ? void 0 : e.documentElement;
793
+ }
794
+ function Ce(t) {
795
+ return xt() ? t instanceof Node || t instanceof P(t).Node : !1;
796
+ }
797
+ function K(t) {
798
+ return xt() ? t instanceof Element || t instanceof P(t).Element : !1;
799
+ }
800
+ function J(t) {
801
+ return xt() ? t instanceof HTMLElement || t instanceof P(t).HTMLElement : !1;
802
+ }
803
+ function Zt(t) {
804
+ return !xt() || typeof ShadowRoot > "u" ? !1 : t instanceof ShadowRoot || t instanceof P(t).ShadowRoot;
805
+ }
806
+ const Oo = /* @__PURE__ */ new Set(["inline", "contents"]);
807
+ function yt(t) {
808
+ const {
809
+ overflow: e,
810
+ overflowX: o,
811
+ overflowY: n,
812
+ display: i
813
+ } = W(t);
814
+ return /auto|scroll|overlay|hidden|clip/.test(e + n + o) && !Oo.has(i);
815
+ }
816
+ const Eo = /* @__PURE__ */ new Set(["table", "td", "th"]);
817
+ function So(t) {
818
+ return Eo.has(ut(t));
819
+ }
820
+ const Lo = [":popover-open", ":modal"];
821
+ function Tt(t) {
822
+ return Lo.some((e) => {
823
+ try {
824
+ return t.matches(e);
825
+ } catch {
826
+ return !1;
827
+ }
828
+ });
829
+ }
830
+ const Io = ["transform", "translate", "scale", "rotate", "perspective"], Do = ["transform", "translate", "scale", "rotate", "perspective", "filter"], Ao = ["paint", "layout", "strict", "content"];
831
+ function Bt(t) {
832
+ const e = Nt(), o = K(t) ? W(t) : t;
833
+ return Io.some((n) => o[n] ? o[n] !== "none" : !1) || (o.containerType ? o.containerType !== "normal" : !1) || !e && (o.backdropFilter ? o.backdropFilter !== "none" : !1) || !e && (o.filter ? o.filter !== "none" : !1) || Do.some((n) => (o.willChange || "").includes(n)) || Ao.some((n) => (o.contain || "").includes(n));
834
+ }
835
+ function Ro(t) {
836
+ let e = ot(t);
837
+ for (; J(e) && !dt(e); ) {
838
+ if (Bt(e))
839
+ return e;
840
+ if (Tt(e))
841
+ return null;
842
+ e = ot(e);
843
+ }
844
+ return null;
845
+ }
846
+ function Nt() {
847
+ return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
848
+ }
849
+ const Mo = /* @__PURE__ */ new Set(["html", "body", "#document"]);
850
+ function dt(t) {
851
+ return Mo.has(ut(t));
852
+ }
853
+ function W(t) {
854
+ return P(t).getComputedStyle(t);
855
+ }
856
+ function _t(t) {
857
+ return K(t) ? {
858
+ scrollLeft: t.scrollLeft,
859
+ scrollTop: t.scrollTop
860
+ } : {
861
+ scrollLeft: t.scrollX,
862
+ scrollTop: t.scrollY
863
+ };
864
+ }
865
+ function ot(t) {
866
+ if (ut(t) === "html")
867
+ return t;
868
+ const e = (
869
+ // Step into the shadow DOM of the parent of a slotted node.
870
+ t.assignedSlot || // DOM Element detected.
871
+ t.parentNode || // ShadowRoot detected.
872
+ Zt(t) && t.host || // Fallback.
873
+ Q(t)
874
+ );
875
+ return Zt(e) ? e.host : e;
876
+ }
877
+ function Oe(t) {
878
+ const e = ot(t);
879
+ return dt(e) ? t.ownerDocument ? t.ownerDocument.body : t.body : J(e) && yt(e) ? e : Oe(e);
880
+ }
881
+ function Ee(t, e, o) {
882
+ var n;
883
+ e === void 0 && (e = []);
884
+ const i = Oe(t), s = i === ((n = t.ownerDocument) == null ? void 0 : n.body), r = P(i);
885
+ return s ? e.concat(r, r.visualViewport || [], yt(i) ? i : [], []) : e.concat(i, Ee(i, []));
886
+ }
887
+ function Qt(t) {
888
+ return t.parent && Object.getPrototypeOf(t.parent) ? t.frameElement : null;
889
+ }
890
+ function Se(t) {
891
+ const e = W(t);
892
+ let o = parseFloat(e.width) || 0, n = parseFloat(e.height) || 0;
893
+ const i = J(t), s = i ? t.offsetWidth : o, r = i ? t.offsetHeight : n, a = wt(o) !== s || wt(n) !== r;
894
+ return a && (o = s, n = r), {
895
+ width: o,
896
+ height: n,
897
+ $: a
898
+ };
899
+ }
900
+ function Le(t) {
901
+ return K(t) ? t : t.contextElement;
902
+ }
903
+ function lt(t) {
904
+ const e = Le(t);
905
+ if (!J(e))
906
+ return Y(1);
907
+ const o = e.getBoundingClientRect(), {
908
+ width: n,
909
+ height: i,
910
+ $: s
911
+ } = Se(e);
912
+ let r = (s ? wt(o.width) : o.width) / n, a = (s ? wt(o.height) : o.height) / i;
913
+ return (!r || !Number.isFinite(r)) && (r = 1), (!a || !Number.isFinite(a)) && (a = 1), {
914
+ x: r,
915
+ y: a
916
+ };
917
+ }
918
+ const Ho = /* @__PURE__ */ Y(0);
919
+ function Ie(t) {
920
+ const e = P(t);
921
+ return !Nt() || !e.visualViewport ? Ho : {
922
+ x: e.visualViewport.offsetLeft,
923
+ y: e.visualViewport.offsetTop
924
+ };
925
+ }
926
+ function $o(t, e, o) {
927
+ return e === void 0 && (e = !1), !o || e && o !== P(t) ? !1 : e;
928
+ }
929
+ function ht(t, e, o, n) {
930
+ e === void 0 && (e = !1), o === void 0 && (o = !1);
931
+ const i = t.getBoundingClientRect(), s = Le(t);
932
+ let r = Y(1);
933
+ e && (n ? K(n) && (r = lt(n)) : r = lt(t));
934
+ const a = $o(s, o, n) ? Ie(s) : Y(0);
935
+ let l = (i.left + a.x) / r.x, u = (i.top + a.y) / r.y, d = i.width / r.x, c = i.height / r.y;
936
+ if (s) {
937
+ const h = P(s), f = n && K(n) ? P(n) : n;
938
+ let p = h, m = Qt(p);
939
+ for (; m && n && f !== p; ) {
940
+ const g = lt(m), y = m.getBoundingClientRect(), b = W(m), v = y.left + (m.clientLeft + parseFloat(b.paddingLeft)) * g.x, x = y.top + (m.clientTop + parseFloat(b.paddingTop)) * g.y;
941
+ l *= g.x, u *= g.y, d *= g.x, c *= g.y, l += v, u += x, p = P(m), m = Qt(p);
942
+ }
943
+ }
944
+ return ct({
945
+ width: d,
946
+ height: c,
947
+ x: l,
948
+ y: u
949
+ });
950
+ }
951
+ function kt(t, e) {
952
+ const o = _t(t).scrollLeft;
953
+ return e ? e.left + o : ht(Q(t)).left + o;
954
+ }
955
+ function De(t, e) {
956
+ const o = t.getBoundingClientRect(), n = o.left + e.scrollLeft - kt(t, o), i = o.top + e.scrollTop;
957
+ return {
958
+ x: n,
959
+ y: i
960
+ };
961
+ }
962
+ function Bo(t) {
963
+ let {
964
+ elements: e,
965
+ rect: o,
966
+ offsetParent: n,
967
+ strategy: i
968
+ } = t;
969
+ const s = i === "fixed", r = Q(n), a = e ? Tt(e.floating) : !1;
970
+ if (n === r || a && s)
971
+ return o;
972
+ let l = {
973
+ scrollLeft: 0,
974
+ scrollTop: 0
975
+ }, u = Y(1);
976
+ const d = Y(0), c = J(n);
977
+ if ((c || !c && !s) && ((ut(n) !== "body" || yt(r)) && (l = _t(n)), J(n))) {
978
+ const f = ht(n);
979
+ u = lt(n), d.x = f.x + n.clientLeft, d.y = f.y + n.clientTop;
980
+ }
981
+ const h = r && !c && !s ? De(r, l) : Y(0);
982
+ return {
983
+ width: o.width * u.x,
984
+ height: o.height * u.y,
985
+ x: o.x * u.x - l.scrollLeft * u.x + d.x + h.x,
986
+ y: o.y * u.y - l.scrollTop * u.y + d.y + h.y
987
+ };
988
+ }
989
+ function No(t) {
990
+ return Array.from(t.getClientRects());
991
+ }
992
+ function Po(t) {
993
+ const e = Q(t), o = _t(t), n = t.ownerDocument.body, i = R(e.scrollWidth, e.clientWidth, n.scrollWidth, n.clientWidth), s = R(e.scrollHeight, e.clientHeight, n.scrollHeight, n.clientHeight);
994
+ let r = -o.scrollLeft + kt(t);
995
+ const a = -o.scrollTop;
996
+ return W(n).direction === "rtl" && (r += R(e.clientWidth, n.clientWidth) - i), {
997
+ width: i,
998
+ height: s,
999
+ x: r,
1000
+ y: a
1001
+ };
1002
+ }
1003
+ const te = 25;
1004
+ function Uo(t, e) {
1005
+ const o = P(t), n = Q(t), i = o.visualViewport;
1006
+ let s = n.clientWidth, r = n.clientHeight, a = 0, l = 0;
1007
+ if (i) {
1008
+ s = i.width, r = i.height;
1009
+ const d = Nt();
1010
+ (!d || d && e === "fixed") && (a = i.offsetLeft, l = i.offsetTop);
1011
+ }
1012
+ const u = kt(n);
1013
+ if (u <= 0) {
1014
+ const d = n.ownerDocument, c = d.body, h = getComputedStyle(c), f = d.compatMode === "CSS1Compat" && parseFloat(h.marginLeft) + parseFloat(h.marginRight) || 0, p = Math.abs(n.clientWidth - c.clientWidth - f);
1015
+ p <= te && (s -= p);
1016
+ } else u <= te && (s += u);
1017
+ return {
1018
+ width: s,
1019
+ height: r,
1020
+ x: a,
1021
+ y: l
1022
+ };
1023
+ }
1024
+ const Vo = /* @__PURE__ */ new Set(["absolute", "fixed"]);
1025
+ function jo(t, e) {
1026
+ const o = ht(t, !0, e === "fixed"), n = o.top + t.clientTop, i = o.left + t.clientLeft, s = J(t) ? lt(t) : Y(1), r = t.clientWidth * s.x, a = t.clientHeight * s.y, l = i * s.x, u = n * s.y;
1027
+ return {
1028
+ width: r,
1029
+ height: a,
1030
+ x: l,
1031
+ y: u
1032
+ };
1033
+ }
1034
+ function ee(t, e, o) {
1035
+ let n;
1036
+ if (e === "viewport")
1037
+ n = Uo(t, o);
1038
+ else if (e === "document")
1039
+ n = Po(Q(t));
1040
+ else if (K(e))
1041
+ n = jo(e, o);
1042
+ else {
1043
+ const i = Ie(t);
1044
+ n = {
1045
+ x: e.x - i.x,
1046
+ y: e.y - i.y,
1047
+ width: e.width,
1048
+ height: e.height
1049
+ };
1050
+ }
1051
+ return ct(n);
1052
+ }
1053
+ function Ae(t, e) {
1054
+ const o = ot(t);
1055
+ return o === e || !K(o) || dt(o) ? !1 : W(o).position === "fixed" || Ae(o, e);
1056
+ }
1057
+ function zo(t, e) {
1058
+ const o = e.get(t);
1059
+ if (o)
1060
+ return o;
1061
+ let n = Ee(t, []).filter((a) => K(a) && ut(a) !== "body"), i = null;
1062
+ const s = W(t).position === "fixed";
1063
+ let r = s ? ot(t) : t;
1064
+ for (; K(r) && !dt(r); ) {
1065
+ const a = W(r), l = Bt(r);
1066
+ !l && a.position === "fixed" && (i = null), (s ? !l && !i : !l && a.position === "static" && !!i && Vo.has(i.position) || yt(r) && !l && Ae(t, r)) ? n = n.filter((d) => d !== r) : i = a, r = ot(r);
1067
+ }
1068
+ return e.set(t, n), n;
1069
+ }
1070
+ function Fo(t) {
1071
+ let {
1072
+ element: e,
1073
+ boundary: o,
1074
+ rootBoundary: n,
1075
+ strategy: i
1076
+ } = t;
1077
+ const r = [...o === "clippingAncestors" ? Tt(e) ? [] : zo(e, this._c) : [].concat(o), n], a = r[0], l = r.reduce((u, d) => {
1078
+ const c = ee(e, d, i);
1079
+ return u.top = R(c.top, u.top), u.right = G(c.right, u.right), u.bottom = G(c.bottom, u.bottom), u.left = R(c.left, u.left), u;
1080
+ }, ee(e, a, i));
1081
+ return {
1082
+ width: l.right - l.left,
1083
+ height: l.bottom - l.top,
1084
+ x: l.left,
1085
+ y: l.top
1086
+ };
1087
+ }
1088
+ function Ko(t) {
1089
+ const {
1090
+ width: e,
1091
+ height: o
1092
+ } = Se(t);
1093
+ return {
1094
+ width: e,
1095
+ height: o
1096
+ };
1097
+ }
1098
+ function Wo(t, e, o) {
1099
+ const n = J(e), i = Q(e), s = o === "fixed", r = ht(t, !0, s, e);
1100
+ let a = {
1101
+ scrollLeft: 0,
1102
+ scrollTop: 0
1103
+ };
1104
+ const l = Y(0);
1105
+ function u() {
1106
+ l.x = kt(i);
1107
+ }
1108
+ if (n || !n && !s)
1109
+ if ((ut(e) !== "body" || yt(i)) && (a = _t(e)), n) {
1110
+ const f = ht(e, !0, s, e);
1111
+ l.x = f.x + e.clientLeft, l.y = f.y + e.clientTop;
1112
+ } else i && u();
1113
+ s && !n && i && u();
1114
+ const d = i && !n && !s ? De(i, a) : Y(0), c = r.left + a.scrollLeft - l.x - d.x, h = r.top + a.scrollTop - l.y - d.y;
1115
+ return {
1116
+ x: c,
1117
+ y: h,
1118
+ width: r.width,
1119
+ height: r.height
1120
+ };
1121
+ }
1122
+ function Ot(t) {
1123
+ return W(t).position === "static";
1124
+ }
1125
+ function ne(t, e) {
1126
+ if (!J(t) || W(t).position === "fixed")
1127
+ return null;
1128
+ if (e)
1129
+ return e(t);
1130
+ let o = t.offsetParent;
1131
+ return Q(t) === o && (o = o.ownerDocument.body), o;
1132
+ }
1133
+ function Re(t, e) {
1134
+ const o = P(t);
1135
+ if (Tt(t))
1136
+ return o;
1137
+ if (!J(t)) {
1138
+ let i = ot(t);
1139
+ for (; i && !dt(i); ) {
1140
+ if (K(i) && !Ot(i))
1141
+ return i;
1142
+ i = ot(i);
1143
+ }
1144
+ return o;
1145
+ }
1146
+ let n = ne(t, e);
1147
+ for (; n && So(n) && Ot(n); )
1148
+ n = ne(n, e);
1149
+ return n && dt(n) && Ot(n) && !Bt(n) ? o : n || Ro(t) || o;
1150
+ }
1151
+ const qo = async function(t) {
1152
+ const e = this.getOffsetParent || Re, o = this.getDimensions, n = await o(t.floating);
1153
+ return {
1154
+ reference: Wo(t.reference, await e(t.floating), t.strategy),
1155
+ floating: {
1156
+ x: 0,
1157
+ y: 0,
1158
+ width: n.width,
1159
+ height: n.height
1160
+ }
1161
+ };
1162
+ };
1163
+ function Xo(t) {
1164
+ return W(t).direction === "rtl";
1165
+ }
1166
+ const Yo = {
1167
+ convertOffsetParentRelativeRectToViewportRelativeRect: Bo,
1168
+ getDocumentElement: Q,
1169
+ getClippingRect: Fo,
1170
+ getOffsetParent: Re,
1171
+ getElementRects: qo,
1172
+ getClientRects: No,
1173
+ getDimensions: Ko,
1174
+ getScale: lt,
1175
+ isElement: K,
1176
+ isRTL: Xo
1177
+ }, Pt = _o, Me = go, Ut = ko, Vt = yo, He = Co, $e = wo, Be = po, Ne = vo, jt = (t, e, o) => {
1178
+ const n = /* @__PURE__ */ new Map(), i = {
1179
+ platform: Yo,
1180
+ ...o
1181
+ }, s = {
1182
+ ...i.platform,
1183
+ _c: n
1184
+ };
1185
+ return fo(t, e, {
1186
+ ...i,
1187
+ platform: s
1188
+ });
1189
+ };
1190
+ function Go(t, e) {
1191
+ const o = Math.min(t.top, e.top), n = Math.max(t.bottom, e.bottom), i = Math.min(t.left, e.left), r = Math.max(t.right, e.right) - i, a = n - o, l = i, u = o;
1192
+ return new DOMRect(l, u, r, a);
1193
+ }
1194
+ var Jo = class {
1195
+ constructor({
1196
+ editor: t,
1197
+ element: e,
1198
+ view: o,
1199
+ updateDelay: n = 250,
1200
+ resizeDelay: i = 60,
1201
+ shouldShow: s,
1202
+ appendTo: r,
1203
+ getReferencedVirtualElement: a,
1204
+ options: l
1205
+ }) {
1206
+ this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
1207
+ strategy: "absolute",
1208
+ placement: "top",
1209
+ offset: 8,
1210
+ flip: {},
1211
+ shift: {},
1212
+ arrow: !1,
1213
+ size: !1,
1214
+ autoPlacement: !1,
1215
+ hide: !1,
1216
+ inline: !1,
1217
+ onShow: void 0,
1218
+ onHide: void 0,
1219
+ onUpdate: void 0,
1220
+ onDestroy: void 0
1221
+ }, this.shouldShow = ({ view: d, state: c, from: h, to: f }) => {
1222
+ const { doc: p, selection: m } = c, { empty: g } = m, y = !p.textBetween(h, f).length && Ke(c.selection), b = this.element.contains(document.activeElement);
1223
+ return !(!(d.hasFocus() || b) || g || y || !this.editor.isEditable);
1224
+ }, this.mousedownHandler = () => {
1225
+ this.preventHide = !0;
1226
+ }, this.dragstartHandler = () => {
1227
+ this.hide();
1228
+ }, this.resizeHandler = () => {
1229
+ this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
1230
+ this.updatePosition();
1231
+ }, this.resizeDelay);
1232
+ }, this.focusHandler = () => {
1233
+ setTimeout(() => this.update(this.editor.view));
1234
+ }, this.blurHandler = ({ event: d }) => {
1235
+ var c;
1236
+ if (this.editor.isDestroyed) {
1237
+ this.destroy();
1238
+ return;
1239
+ }
1240
+ if (this.preventHide) {
1241
+ this.preventHide = !1;
1242
+ return;
1243
+ }
1244
+ d != null && d.relatedTarget && ((c = this.element.parentNode) != null && c.contains(d.relatedTarget)) || (d == null ? void 0 : d.relatedTarget) !== this.editor.view.dom && this.hide();
1245
+ }, this.handleDebouncedUpdate = (d, c) => {
1246
+ const h = !(c != null && c.selection.eq(d.state.selection)), f = !(c != null && c.doc.eq(d.state.doc));
1247
+ !h && !f || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
1248
+ this.updateHandler(d, h, f, c);
1249
+ }, this.updateDelay));
1250
+ }, this.updateHandler = (d, c, h, f) => {
1251
+ const { composing: p } = d;
1252
+ if (p || !c && !h)
1253
+ return;
1254
+ if (!this.getShouldShow(f)) {
1255
+ this.hide();
1256
+ return;
1257
+ }
1258
+ this.updatePosition(), this.show();
1259
+ }, this.transactionHandler = ({ transaction: d }) => {
1260
+ const c = d.getMeta("bubbleMenu");
1261
+ c === "updatePosition" ? this.updatePosition() : c && typeof c == "object" && c.type === "updateOptions" && this.updateOptions(c.options);
1262
+ };
1263
+ var u;
1264
+ this.editor = t, this.element = e, this.view = o, this.updateDelay = n, this.resizeDelay = i, this.appendTo = r, this.scrollTarget = (u = l == null ? void 0 : l.scrollTarget) != null ? u : window, this.getReferencedVirtualElement = a, this.floatingUIOptions = {
1265
+ ...this.floatingUIOptions,
1266
+ ...l
1267
+ }, this.element.tabIndex = 0, s && (this.shouldShow = s), 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(o, o.state), this.getShouldShow() && (this.show(), this.updatePosition());
1268
+ }
1269
+ get middlewares() {
1270
+ const t = [];
1271
+ return this.floatingUIOptions.flip && t.push(Vt(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
1272
+ Ut(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
1273
+ ), this.floatingUIOptions.offset && t.push(
1274
+ Pt(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
1275
+ ), this.floatingUIOptions.arrow && t.push(Be(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(He(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
1276
+ Me(
1277
+ typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
1278
+ )
1279
+ ), this.floatingUIOptions.hide && t.push($e(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
1280
+ Ne(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
1281
+ ), t;
1282
+ }
1283
+ get virtualElement() {
1284
+ var t, e, o;
1285
+ const { selection: n } = this.editor.state, i = (t = this.getReferencedVirtualElement) == null ? void 0 : t.call(this);
1286
+ if (i)
1287
+ return i;
1288
+ if (!((o = (e = this.view) == null ? void 0 : e.dom) != null && o.parentNode))
1289
+ return;
1290
+ const s = re(this.view, n.from, n.to);
1291
+ let r = {
1292
+ getBoundingClientRect: () => s,
1293
+ getClientRects: () => [s]
1294
+ };
1295
+ if (n instanceof nn) {
1296
+ let a = this.view.nodeDOM(n.from);
1297
+ const l = a.dataset.nodeViewWrapper ? a : a.querySelector("[data-node-view-wrapper]");
1298
+ l && (a = l), a && (r = {
1299
+ getBoundingClientRect: () => a.getBoundingClientRect(),
1300
+ getClientRects: () => [a.getBoundingClientRect()]
1301
+ });
1302
+ }
1303
+ if (n instanceof on) {
1304
+ const { $anchorCell: a, $headCell: l } = n, u = a ? a.pos : l.pos, d = l ? l.pos : a.pos, c = this.view.nodeDOM(u), h = this.view.nodeDOM(d);
1305
+ if (!c || !h)
1306
+ return;
1307
+ const f = c === h ? c.getBoundingClientRect() : Go(
1308
+ c.getBoundingClientRect(),
1309
+ h.getBoundingClientRect()
1310
+ );
1311
+ r = {
1312
+ getBoundingClientRect: () => f,
1313
+ getClientRects: () => [f]
1314
+ };
1315
+ }
1316
+ return r;
1317
+ }
1318
+ updatePosition() {
1319
+ const t = this.virtualElement;
1320
+ t && jt(t, this.element, {
1321
+ placement: this.floatingUIOptions.placement,
1322
+ strategy: this.floatingUIOptions.strategy,
1323
+ middleware: this.middlewares
1324
+ }).then(({ x: e, y: o, strategy: n, middlewareData: i }) => {
1325
+ var s, r;
1326
+ if ((s = i.hide) != null && s.referenceHidden || (r = i.hide) != null && r.escaped) {
1327
+ this.element.style.visibility = "hidden";
1328
+ return;
1329
+ }
1330
+ this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = n, this.element.style.left = `${e}px`, this.element.style.top = `${o}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1331
+ });
1332
+ }
1333
+ update(t, e) {
1334
+ const { state: o } = t, n = o.selection.from !== o.selection.to;
1335
+ if (this.updateDelay > 0 && n) {
1336
+ this.handleDebouncedUpdate(t, e);
1337
+ return;
1338
+ }
1339
+ const i = !(e != null && e.selection.eq(t.state.selection)), s = !(e != null && e.doc.eq(t.state.doc));
1340
+ this.updateHandler(t, i, s, e);
1341
+ }
1342
+ getShouldShow(t) {
1343
+ var e;
1344
+ const { state: o } = this.view, { selection: n } = o, { ranges: i } = n, s = Math.min(...i.map((l) => l.$from.pos)), r = Math.max(...i.map((l) => l.$to.pos));
1345
+ return ((e = this.shouldShow) == null ? void 0 : e.call(this, {
1346
+ editor: this.editor,
1347
+ element: this.element,
1348
+ view: this.view,
1349
+ state: o,
1350
+ oldState: t,
1351
+ from: s,
1352
+ to: r
1353
+ })) || !1;
1354
+ }
1355
+ show() {
1356
+ var t;
1357
+ if (this.isVisible)
1358
+ return;
1359
+ this.element.style.visibility = "visible", this.element.style.opacity = "1";
1360
+ const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
1361
+ (t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
1362
+ }
1363
+ hide() {
1364
+ this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
1365
+ }
1366
+ updateOptions(t) {
1367
+ var e;
1368
+ 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) {
1369
+ const o = (e = t.options.scrollTarget) != null ? e : window;
1370
+ o !== this.scrollTarget && (this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.scrollTarget = o, this.scrollTarget.addEventListener("scroll", this.resizeHandler)), this.floatingUIOptions = {
1371
+ ...this.floatingUIOptions,
1372
+ ...t.options
1373
+ };
1374
+ }
1375
+ }
1376
+ destroy() {
1377
+ 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();
1378
+ }
1379
+ }, Zo = (t) => new It({
1380
+ key: typeof t.pluginKey == "string" ? new rt(t.pluginKey) : t.pluginKey,
1381
+ view: (e) => new Jo({ view: e, ...t })
1382
+ }), Qo = le({
1383
+ name: "BubbleMenu",
1384
+ inheritAttrs: !1,
1385
+ props: {
1386
+ pluginKey: {
1387
+ type: [String, Object],
1388
+ default: "bubbleMenu"
1389
+ },
1390
+ editor: {
1391
+ type: Object,
1392
+ required: !0
1393
+ },
1394
+ updateDelay: {
1395
+ type: Number,
1396
+ default: void 0
1397
+ },
1398
+ resizeDelay: {
1399
+ type: Number,
1400
+ default: void 0
1401
+ },
1402
+ options: {
1403
+ type: Object,
1404
+ default: () => ({})
1405
+ },
1406
+ appendTo: {
1407
+ type: [Object, Function],
1408
+ default: void 0
1409
+ },
1410
+ shouldShow: {
1411
+ type: Function,
1412
+ default: null
1413
+ },
1414
+ getReferencedVirtualElement: {
1415
+ type: Function,
1416
+ default: void 0
1417
+ }
1418
+ },
1419
+ setup(t, { slots: e, attrs: o }) {
1420
+ const n = ce(null);
1421
+ return de(() => {
1422
+ const {
1423
+ editor: i,
1424
+ options: s,
1425
+ pluginKey: r,
1426
+ resizeDelay: a,
1427
+ appendTo: l,
1428
+ shouldShow: u,
1429
+ getReferencedVirtualElement: d,
1430
+ updateDelay: c
1431
+ } = t, h = n.value;
1432
+ h && (h.style.visibility = "hidden", h.style.position = "absolute", h.remove(), sn(() => {
1433
+ i.registerPlugin(
1434
+ Zo({
1435
+ editor: i,
1436
+ element: h,
1437
+ options: s,
1438
+ pluginKey: r,
1439
+ resizeDelay: a,
1440
+ appendTo: l,
1441
+ shouldShow: u,
1442
+ getReferencedVirtualElement: d,
1443
+ updateDelay: c
1444
+ })
1445
+ );
1446
+ }));
1447
+ }), ue(() => {
1448
+ const { pluginKey: i, editor: s } = t;
1449
+ s.unregisterPlugin(i);
1450
+ }), () => {
1451
+ var i;
1452
+ return he("div", { ref: n, ...o }, (i = e.default) == null ? void 0 : i.call(e));
1453
+ };
1454
+ }
1455
+ }), ti = class {
1456
+ constructor({
1457
+ editor: t,
1458
+ element: e,
1459
+ view: o,
1460
+ updateDelay: n = 250,
1461
+ resizeDelay: i = 60,
1462
+ options: s,
1463
+ appendTo: r,
1464
+ shouldShow: a
1465
+ }) {
1466
+ this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.shouldShow = ({ view: u, state: d }) => {
1467
+ const { selection: c } = d, { $anchor: h, empty: f } = c, p = h.depth === 1, m = h.parent.isTextblock && !h.parent.type.spec.code && !h.parent.textContent && h.parent.childCount === 0 && !this.getTextContent(h.parent);
1468
+ return !(!u.hasFocus() || !f || !p || !m || !this.editor.isEditable);
1469
+ }, this.floatingUIOptions = {
1470
+ strategy: "absolute",
1471
+ placement: "right",
1472
+ offset: 8,
1473
+ flip: {},
1474
+ shift: {},
1475
+ arrow: !1,
1476
+ size: !1,
1477
+ autoPlacement: !1,
1478
+ hide: !1,
1479
+ inline: !1
1480
+ }, this.updateHandler = (u, d, c, h) => {
1481
+ const { composing: f } = u;
1482
+ if (f || !d && !c)
1483
+ return;
1484
+ if (!this.getShouldShow(h)) {
1485
+ this.hide();
1486
+ return;
1487
+ }
1488
+ this.updatePosition(), this.show();
1489
+ }, this.mousedownHandler = () => {
1490
+ this.preventHide = !0;
1491
+ }, this.focusHandler = () => {
1492
+ setTimeout(() => this.update(this.editor.view));
1493
+ }, this.blurHandler = ({ event: u }) => {
1494
+ var d;
1495
+ if (this.preventHide) {
1496
+ this.preventHide = !1;
1497
+ return;
1498
+ }
1499
+ u != null && u.relatedTarget && ((d = this.element.parentNode) != null && d.contains(u.relatedTarget)) || (u == null ? void 0 : u.relatedTarget) !== this.editor.view.dom && this.hide();
1500
+ }, this.transactionHandler = ({ transaction: u }) => {
1501
+ const d = u.getMeta("floatingMenu");
1502
+ d === "updatePosition" ? this.updatePosition() : d && typeof d == "object" && d.type === "updateOptions" && this.updateOptions(d.options);
1503
+ }, this.resizeHandler = () => {
1504
+ this.resizeDebounceTimer && clearTimeout(this.resizeDebounceTimer), this.resizeDebounceTimer = window.setTimeout(() => {
1505
+ this.updatePosition();
1506
+ }, this.resizeDelay);
1507
+ };
1508
+ var l;
1509
+ this.editor = t, this.element = e, this.view = o, this.updateDelay = n, this.resizeDelay = i, this.appendTo = r, this.scrollTarget = (l = s == null ? void 0 : s.scrollTarget) != null ? l : window, this.floatingUIOptions = {
1510
+ ...this.floatingUIOptions,
1511
+ ...s
1512
+ }, this.element.tabIndex = 0, a && (this.shouldShow = a), 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(o, o.state), this.getShouldShow() && (this.show(), this.updatePosition());
1513
+ }
1514
+ getTextContent(t) {
1515
+ return We(t, { textSerializers: qe(this.editor.schema) });
1516
+ }
1517
+ get middlewares() {
1518
+ const t = [];
1519
+ return this.floatingUIOptions.flip && t.push(Vt(typeof this.floatingUIOptions.flip != "boolean" ? this.floatingUIOptions.flip : void 0)), this.floatingUIOptions.shift && t.push(
1520
+ Ut(typeof this.floatingUIOptions.shift != "boolean" ? this.floatingUIOptions.shift : void 0)
1521
+ ), this.floatingUIOptions.offset && t.push(
1522
+ Pt(typeof this.floatingUIOptions.offset != "boolean" ? this.floatingUIOptions.offset : void 0)
1523
+ ), this.floatingUIOptions.arrow && t.push(Be(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && t.push(He(typeof this.floatingUIOptions.size != "boolean" ? this.floatingUIOptions.size : void 0)), this.floatingUIOptions.autoPlacement && t.push(
1524
+ Me(
1525
+ typeof this.floatingUIOptions.autoPlacement != "boolean" ? this.floatingUIOptions.autoPlacement : void 0
1526
+ )
1527
+ ), this.floatingUIOptions.hide && t.push($e(typeof this.floatingUIOptions.hide != "boolean" ? this.floatingUIOptions.hide : void 0)), this.floatingUIOptions.inline && t.push(
1528
+ Ne(typeof this.floatingUIOptions.inline != "boolean" ? this.floatingUIOptions.inline : void 0)
1529
+ ), t;
1530
+ }
1531
+ getShouldShow(t) {
1532
+ var e;
1533
+ const { state: o } = this.view, { selection: n } = o, { ranges: i } = n, s = Math.min(...i.map((l) => l.$from.pos)), r = Math.max(...i.map((l) => l.$to.pos));
1534
+ return (e = this.shouldShow) == null ? void 0 : e.call(this, {
1535
+ editor: this.editor,
1536
+ view: this.view,
1537
+ state: o,
1538
+ oldState: t,
1539
+ from: s,
1540
+ to: r
1541
+ });
1542
+ }
1543
+ updateOptions(t) {
1544
+ var e;
1545
+ 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) {
1546
+ const o = (e = t.options.scrollTarget) != null ? e : window;
1547
+ o !== this.scrollTarget && (this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.scrollTarget = o, this.scrollTarget.addEventListener("scroll", this.resizeHandler)), this.floatingUIOptions = {
1548
+ ...this.floatingUIOptions,
1549
+ ...t.options
1550
+ };
1551
+ }
1552
+ }
1553
+ updatePosition() {
1554
+ const { selection: t } = this.editor.state, e = re(this.view, t.from, t.to);
1555
+ jt({
1556
+ getBoundingClientRect: () => e,
1557
+ getClientRects: () => [e]
1558
+ }, this.element, {
1559
+ placement: this.floatingUIOptions.placement,
1560
+ strategy: this.floatingUIOptions.strategy,
1561
+ middleware: this.middlewares
1562
+ }).then(({ x: n, y: i, strategy: s, middlewareData: r }) => {
1563
+ var a, l;
1564
+ if ((a = r.hide) != null && a.referenceHidden || (l = r.hide) != null && l.escaped) {
1565
+ this.element.style.visibility = "hidden";
1566
+ return;
1567
+ }
1568
+ this.element.style.visibility = "visible", this.element.style.width = "max-content", this.element.style.position = s, this.element.style.left = `${n}px`, this.element.style.top = `${i}px`, this.isVisible && this.floatingUIOptions.onUpdate && this.floatingUIOptions.onUpdate();
1569
+ });
1570
+ }
1571
+ update(t, e) {
1572
+ const o = !(e != null && e.selection.eq(t.state.selection)), n = !(e != null && e.doc.eq(t.state.doc));
1573
+ this.updateHandler(t, o, n, e);
1574
+ }
1575
+ show() {
1576
+ var t;
1577
+ if (this.isVisible)
1578
+ return;
1579
+ this.element.style.visibility = "visible", this.element.style.opacity = "1";
1580
+ const e = typeof this.appendTo == "function" ? this.appendTo() : this.appendTo;
1581
+ (t = e ?? this.view.dom.parentElement) == null || t.appendChild(this.element), this.floatingUIOptions.onShow && this.floatingUIOptions.onShow(), this.isVisible = !0;
1582
+ }
1583
+ hide() {
1584
+ this.isVisible && (this.element.style.visibility = "hidden", this.element.style.opacity = "0", this.element.remove(), this.floatingUIOptions.onHide && this.floatingUIOptions.onHide(), this.isVisible = !1);
1585
+ }
1586
+ destroy() {
1587
+ 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();
1588
+ }
1589
+ }, ei = (t) => new It({
1590
+ key: typeof t.pluginKey == "string" ? new rt(t.pluginKey) : t.pluginKey,
1591
+ view: (e) => new ti({ view: e, ...t })
1592
+ });
1593
+ le({
1594
+ name: "FloatingMenu",
1595
+ inheritAttrs: !1,
1596
+ props: {
1597
+ pluginKey: {
1598
+ // TODO: TypeScript breaks :(
1599
+ // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],
1600
+ type: null,
1601
+ default: "floatingMenu"
1602
+ },
1603
+ editor: {
1604
+ type: Object,
1605
+ required: !0
1606
+ },
1607
+ updateDelay: {
1608
+ type: Number,
1609
+ default: void 0
1610
+ },
1611
+ resizeDelay: {
1612
+ type: Number,
1613
+ default: void 0
1614
+ },
1615
+ options: {
1616
+ type: Object,
1617
+ default: () => ({})
1618
+ },
1619
+ appendTo: {
1620
+ type: [Object, Function],
1621
+ default: void 0
1622
+ },
1623
+ shouldShow: {
1624
+ type: Function,
1625
+ default: null
1626
+ }
1627
+ },
1628
+ setup(t, { slots: e, attrs: o }) {
1629
+ const n = ce(null);
1630
+ return de(() => {
1631
+ const { pluginKey: i, editor: s, updateDelay: r, resizeDelay: a, options: l, appendTo: u, shouldShow: d } = t, c = n.value;
1632
+ c && (c.style.visibility = "hidden", c.style.position = "absolute", c.remove(), s.registerPlugin(
1633
+ ei({
1634
+ pluginKey: i,
1635
+ editor: s,
1636
+ element: c,
1637
+ updateDelay: r,
1638
+ resizeDelay: a,
1639
+ options: l,
1640
+ appendTo: u,
1641
+ shouldShow: d
1642
+ })
1643
+ ));
1644
+ }), ue(() => {
1645
+ const { pluginKey: i, editor: s } = t;
1646
+ s.unregisterPlugin(i);
1647
+ }), () => {
1648
+ var i;
1649
+ return he("div", { ref: n, ...o }, (i = e.default) == null ? void 0 : i.call(e));
1650
+ };
1651
+ }
1652
+ });
1653
+ const ni = {
55
1654
  compatConfig: { MODE: 3 },
56
1655
  name: "EmojiComponent",
57
1656
  components: {
58
- NodeViewWrapper: v,
59
- DtEmoji: Y
1657
+ NodeViewWrapper: pt,
1658
+ DtEmoji: ye
60
1659
  },
61
- props: L
1660
+ props: ft
62
1661
  };
63
- function mt(e, t, o, n, r, s) {
64
- const i = l("dt-emoji"), a = l("node-view-wrapper");
65
- return d(), p(a, { class: "d-d-inline-block d-va-bottom d-lh0" }, {
66
- default: u(() => [
67
- m(i, {
1662
+ function oi(t, e, o, n, i, s) {
1663
+ const r = T("dt-emoji"), a = T("node-view-wrapper");
1664
+ return k(), M(a, { class: "d-d-inline-block d-va-bottom d-lh0" }, {
1665
+ default: C(() => [
1666
+ I(r, {
68
1667
  size: "500",
69
- code: e.node.attrs.code
1668
+ code: t.node.attrs.code
70
1669
  }, null, 8, ["code"])
71
1670
  ]),
72
1671
  _: 1
73
1672
  });
74
1673
  }
75
- const ht = /* @__PURE__ */ g(ut, [["render", mt]]), pt = {
1674
+ const ii = /* @__PURE__ */ q(ni, [["render", oi]]), si = {
76
1675
  compatConfig: { MODE: 3 },
77
1676
  name: "SuggestionList",
78
1677
  components: {
79
- DtListItem: Je
1678
+ DtListItem: Vn
80
1679
  },
81
1680
  props: {
82
1681
  items: {
@@ -107,8 +1706,8 @@ const ht = /* @__PURE__ */ g(ut, [["render", mt]]), pt = {
107
1706
  }
108
1707
  },
109
1708
  methods: {
110
- onKeyDown({ event: e }) {
111
- return e.key === "ArrowUp" ? (this.upHandler(), !0) : e.key === "ArrowDown" ? (this.downHandler(), !0) : e.key === "Enter" || e.key === "Tab" ? (this.selectHandler(), !0) : !1;
1709
+ onKeyDown({ event: t }) {
1710
+ return t.key === "ArrowUp" ? (this.upHandler(), !0) : t.key === "ArrowDown" ? (this.downHandler(), !0) : t.key === "Enter" || t.key === "Tab" ? (this.selectHandler(), !0) : !1;
112
1711
  },
113
1712
  upHandler() {
114
1713
  this.selectedIndex = (this.selectedIndex + this.items.length - 1) % this.items.length, this.scrollActiveElementIntoView();
@@ -118,8 +1717,8 @@ const ht = /* @__PURE__ */ g(ut, [["render", mt]]), pt = {
118
1717
  },
119
1718
  async scrollActiveElementIntoView() {
120
1719
  await this.$nextTick();
121
- const e = this.$refs.suggestionList.querySelector(".d-list-item--highlighted");
122
- e && e.scrollIntoView({
1720
+ const t = this.$refs.suggestionList.querySelector(".d-list-item--highlighted");
1721
+ t && t.scrollIntoView({
123
1722
  behaviour: "smooth",
124
1723
  block: "center"
125
1724
  });
@@ -127,58 +1726,160 @@ const ht = /* @__PURE__ */ g(ut, [["render", mt]]), pt = {
127
1726
  selectHandler() {
128
1727
  this.selectItem(this.selectedIndex);
129
1728
  },
130
- selectItem(e) {
131
- const t = this.items[e];
1729
+ selectItem(t) {
1730
+ const e = this.items[t];
132
1731
  switch (this.itemType) {
133
1732
  case "emoji":
134
- this.command(t);
1733
+ this.command(e);
135
1734
  return;
136
1735
  case "mention":
137
- this.command({ name: t.name, id: t.id, avatarSrc: t.avatarSrc, contactKey: t.contactKey });
1736
+ this.command({ name: e.name, id: e.id, avatarSrc: e.avatarSrc, contactKey: e.contactKey });
138
1737
  break;
139
1738
  case "channel":
140
- this.command({ name: t.name, id: t.id, locked: t.locked, channelKey: t.channelKey });
1739
+ this.command({ name: e.name, id: e.id, locked: e.locked, channelKey: e.channelKey });
141
1740
  break;
142
1741
  case "slash-command":
143
- this.command({ command: t.command });
1742
+ this.command({ command: e.command });
144
1743
  break;
145
1744
  }
146
1745
  }
147
1746
  }
148
- }, ft = { class: "d-popover__dialog d-suggestion-list__container" }, gt = {
1747
+ }, ri = { class: "d-popover__dialog d-suggestion-list__container" }, ai = {
149
1748
  ref: "suggestionList",
150
1749
  class: "d-suggestion-list"
151
1750
  };
152
- function _t(e, t, o, n, r, s) {
153
- const i = l("dt-list-item");
154
- return d(), y("div", ft, [
155
- je(b("ul", gt, [
156
- (d(!0), y(Ve, null, Ke(o.items, (a, c) => (d(), p(i, {
1751
+ function li(t, e, o, n, i, s) {
1752
+ const r = T("dt-list-item");
1753
+ return k(), et("div", ri, [
1754
+ rn(nt("ul", ai, [
1755
+ (k(!0), et(an, null, ln(o.items, (a, l) => (k(), M(r, {
157
1756
  key: a.id,
158
- class: G([
1757
+ class: fe([
159
1758
  "d-suggestion-list__item",
160
- { "d-list-item--highlighted": c === r.selectedIndex }
1759
+ { "d-list-item--highlighted": l === i.selectedIndex }
161
1760
  ]),
162
1761
  "navigation-type": "arrow-keys",
163
- onClick: (h) => s.selectItem(c),
164
- onKeydown: P(s.onKeyDown, ["prevent"])
1762
+ onClick: (u) => s.selectItem(l),
1763
+ onKeydown: Dt(s.onKeyDown, ["prevent"])
165
1764
  }, {
166
- default: u(() => [
167
- (d(), p(Fe(o.itemComponent), { item: a }, null, 8, ["item"]))
1765
+ default: C(() => [
1766
+ (k(), M(cn(o.itemComponent), { item: a }, null, 8, ["item"]))
168
1767
  ]),
169
1768
  _: 2
170
1769
  }, 1032, ["class", "onClick", "onKeydown"]))), 128))
171
1770
  ], 512), [
172
- [Ue, o.items.length]
1771
+ [dn, o.items.length]
173
1772
  ])
174
1773
  ]);
175
1774
  }
176
- const N = /* @__PURE__ */ g(pt, [["render", _t]]), kt = {
1775
+ const ci = /* @__PURE__ */ q(si, [["render", li]]), Pe = "top-start", Ue = "650";
1776
+ function di() {
1777
+ return {
1778
+ getBoundingClientRect: () => ({
1779
+ width: 0,
1780
+ height: 0,
1781
+ x: 0,
1782
+ y: 0,
1783
+ top: 0,
1784
+ left: 0,
1785
+ right: 0,
1786
+ bottom: 0
1787
+ })
1788
+ };
1789
+ }
1790
+ function oe(t) {
1791
+ return { getBoundingClientRect: t };
1792
+ }
1793
+ async function ui(t, e, o = {}) {
1794
+ if (!t || !(e != null && e.getBoundingClientRect)) return;
1795
+ const {
1796
+ placement: n = Pe,
1797
+ middleware: i = [Pt(0), Vt(), Ut({ padding: 8 })]
1798
+ } = o, { x: s, y: r } = await jt(e, t, {
1799
+ placement: n,
1800
+ middleware: i
1801
+ });
1802
+ Object.assign(t.style, {
1803
+ left: `${s}px`,
1804
+ top: `${r}px`
1805
+ });
1806
+ }
1807
+ function hi(t, e = {}) {
1808
+ const { zIndex: o = Ue } = e;
1809
+ t.style.position = "absolute", t.style.zIndex = o, t.style.display = "none";
1810
+ }
1811
+ function fi(t) {
1812
+ t && (t.style.display = "block");
1813
+ }
1814
+ function pi(t) {
1815
+ t && (t.style.display = "none");
1816
+ }
1817
+ function mi(t, e) {
1818
+ return (o) => {
1819
+ o.key === "Escape" && e() && t();
1820
+ };
1821
+ }
1822
+ function gi(t) {
1823
+ document.addEventListener("keydown", t);
1824
+ }
1825
+ function yi(t) {
1826
+ document.removeEventListener("keydown", t);
1827
+ }
1828
+ function wi(t, e, o, n) {
1829
+ return new je(t, {
1830
+ props: {
1831
+ itemComponent: un(e),
1832
+ itemType: o,
1833
+ ...n
1834
+ },
1835
+ editor: n.editor
1836
+ });
1837
+ }
1838
+ function bi(t) {
1839
+ var e, o;
1840
+ t.escHandler && yi(t.escHandler), (e = t.floatingEl) == null || e.remove(), (o = t.component) == null || o.destroy();
1841
+ }
1842
+ function Ct(t, e, o = {}) {
1843
+ const {
1844
+ listComponent: n = ci,
1845
+ placement: i = Pe,
1846
+ zIndex: s = Ue
1847
+ } = o;
1848
+ return () => {
1849
+ let r = null, a = null, l = !1, u = di(), d = null;
1850
+ function c() {
1851
+ ui(a, u, { placement: i });
1852
+ }
1853
+ function h() {
1854
+ a && (fi(a), l = !0, c());
1855
+ }
1856
+ function f() {
1857
+ a && (pi(a), l = !1);
1858
+ }
1859
+ return {
1860
+ onStart: (p) => {
1861
+ r = wi(n, t, e, p), p.clientRect && (a = r.element, hi(a, { zIndex: s }), document.body.appendChild(a), u = oe(p.clientRect), d = mi(f, () => l), gi(d), p.items.length > 0 && h());
1862
+ },
1863
+ onUpdate(p) {
1864
+ r == null || r.updateProps(p), p.items.length > 0 ? h() : f(), p.clientRect && (u = oe(p.clientRect), c());
1865
+ },
1866
+ onKeyDown(p) {
1867
+ var m;
1868
+ if (l)
1869
+ return (m = r == null ? void 0 : r.ref) == null ? void 0 : m.onKeyDown(p);
1870
+ },
1871
+ onExit() {
1872
+ bi({ escHandler: d, floatingEl: a, component: r }), d = null, a = null, r = null;
1873
+ }
1874
+ };
1875
+ };
1876
+ }
1877
+ const vi = {
177
1878
  compatConfig: { MODE: 3 },
178
1879
  name: "EmojiSuggestion",
179
1880
  components: {
180
- DtEmoji: Y,
181
- DtStack: I
1881
+ DtEmoji: ye,
1882
+ DtStack: gt
182
1883
  },
183
1884
  props: {
184
1885
  item: {
@@ -187,120 +1888,61 @@ const N = /* @__PURE__ */ g(pt, [["render", _t]]), kt = {
187
1888
  }
188
1889
  }
189
1890
  };
190
- function yt(e, t, o, n, r, s) {
191
- const i = l("dt-emoji"), a = l("dt-stack");
192
- return d(), p(a, {
1891
+ function xi(t, e, o, n, i, s) {
1892
+ const r = T("dt-emoji"), a = T("dt-stack");
1893
+ return k(), M(a, {
193
1894
  direction: "row",
194
1895
  gap: "400"
195
1896
  }, {
196
- default: u(() => [
197
- m(i, {
1897
+ default: C(() => [
1898
+ I(r, {
198
1899
  size: "200",
199
1900
  code: o.item.code
200
1901
  }, null, 8, ["code"]),
201
- C(" " + f(o.item.code), 1)
1902
+ at(" " + $(o.item.code), 1)
202
1903
  ]),
203
1904
  _: 1
204
1905
  });
205
1906
  }
206
- const bt = /* @__PURE__ */ g(kt, [["render", yt]]), D = {
207
- name: "hideOnEsc",
208
- defaultValue: !0,
209
- fn({ hide: e }) {
210
- function t(o) {
211
- o.keyCode === 27 && e();
212
- }
213
- return {
214
- onShow() {
215
- document.addEventListener("keydown", t);
216
- },
217
- onHide() {
218
- document.removeEventListener("keydown", t);
219
- }
220
- };
221
- }
222
- }, wt = 20, Tt = (e, t, o) => {
223
- var a, c;
224
- const n = (a = e.shortname) == null ? void 0 : a.replaceAll(":", ""), r = (c = t.shortname) == null ? void 0 : c.replaceAll(":", ""), s = n.startsWith(o), i = r.startsWith(o);
225
- return s && !i ? -1 : !s && i ? 1 : n.localeCompare(r);
226
- }, xt = {
227
- items: ({ query: e }) => {
228
- if (e.length < 2)
1907
+ const Ti = /* @__PURE__ */ q(vi, [["render", xi]]), _i = 20, ki = (t, e, o) => {
1908
+ var a, l;
1909
+ const n = (a = t.shortname) == null ? void 0 : a.replaceAll(":", ""), i = (l = e.shortname) == null ? void 0 : l.replaceAll(":", ""), s = n.startsWith(o), r = i.startsWith(o);
1910
+ return s && !r ? -1 : !s && r ? 1 : n.localeCompare(i);
1911
+ }, Ci = {
1912
+ items: ({ query: t }) => {
1913
+ if (t.length < 2)
229
1914
  return [];
230
- const t = Object.values(We());
231
- return e = e.toLowerCase(), t.filter(
1915
+ const e = Object.values(Bn());
1916
+ return t = t.toLowerCase(), e.filter(
232
1917
  (n) => {
233
- var r;
1918
+ var i;
234
1919
  return [
235
1920
  n.name,
236
- (r = n.shortname) == null ? void 0 : r.replaceAll(":", ""),
1921
+ (i = n.shortname) == null ? void 0 : i.replaceAll(":", ""),
237
1922
  ...n.keywords || []
238
- ].some((s) => s && s.startsWith(e));
1923
+ ].some((s) => s && s.startsWith(t));
239
1924
  }
240
- ).splice(0, wt).sort((n, r) => Tt(n, r, e)).map((n) => ({ code: n.shortname }));
1925
+ ).splice(0, _i).sort((n, i) => ki(n, i, t)).map((n) => ({ code: n.shortname }));
241
1926
  },
242
- command: ({ editor: e, range: t, props: o }) => {
243
- var s, i;
244
- const n = e.view.state.selection.$to.nodeAfter;
245
- ((s = n == null ? void 0 : n.text) == null ? void 0 : s.startsWith(" ")) && (t.to += 1), e.chain().focus().insertContentAt(t, [
1927
+ command: ({ editor: t, range: e, props: o }) => {
1928
+ var s, r;
1929
+ const n = t.view.state.selection.$to.nodeAfter;
1930
+ ((s = n == null ? void 0 : n.text) == null ? void 0 : s.startsWith(" ")) && (e.to += 1), t.chain().focus().insertContentAt(e, [
246
1931
  {
247
1932
  type: "emoji",
248
1933
  attrs: o
249
1934
  }
250
- ]).run(), (i = window.getSelection()) == null || i.collapseToEnd();
1935
+ ]).run(), (r = window.getSelection()) == null || r.collapseToEnd();
251
1936
  },
252
- render: () => {
253
- let e, t, o = !1;
254
- return {
255
- onStart: (n) => {
256
- e = new R(N, {
257
- props: {
258
- itemComponent: M(bt),
259
- itemType: "emoji",
260
- ...n
261
- },
262
- editor: n.editor
263
- }), n.clientRect && (t = B("body", {
264
- getReferenceClientRect: n.clientRect,
265
- appendTo: () => document.body,
266
- content: e.element,
267
- showOnCreate: !1,
268
- onShow: () => {
269
- o = !0;
270
- },
271
- onHidden: () => {
272
- o = !1;
273
- },
274
- interactive: !0,
275
- trigger: "manual",
276
- placement: "top-start",
277
- zIndex: 650,
278
- plugins: [D]
279
- }), n.items.length > 0 && (t == null || t[0].show()));
280
- },
281
- onUpdate(n) {
282
- e == null || e.updateProps(n), n.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), t == null || t[0].setProps({
283
- getReferenceClientRect: n.clientRect
284
- });
285
- },
286
- onKeyDown(n) {
287
- var r;
288
- if (o)
289
- return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
290
- },
291
- onExit() {
292
- t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
293
- }
294
- };
295
- }
296
- }, Ct = /(:\w+:)$/, Et = new RegExp(X + "$"), Lt = (e) => {
297
- if (e && j(e[0]))
298
- return { text: e[2] || e[0] };
299
- }, vt = (e) => [...e.matchAll(Ge)].filter((o) => j(o[0])).map((o) => ({
1937
+ render: Ct(Ti, "emoji")
1938
+ }, Oi = /(:\w+:)$/, Ei = new RegExp(ge + "$"), Si = (t) => {
1939
+ if (t && At(t[0]))
1940
+ return { text: t[2] || t[0] };
1941
+ }, Li = (t) => [...t.matchAll(Un)].filter((o) => At(o[0])).map((o) => ({
300
1942
  index: o.index,
301
1943
  text: o[0],
302
1944
  match: o
303
- })), St = W.create({
1945
+ })), Ii = ae.create({
304
1946
  name: "emoji",
305
1947
  addOptions() {
306
1948
  return {
@@ -312,7 +1954,7 @@ const bt = /* @__PURE__ */ g(kt, [["render", yt]]), D = {
312
1954
  selectable: !1,
313
1955
  atom: !0,
314
1956
  addNodeView() {
315
- return S(ht);
1957
+ return mt(ii);
316
1958
  },
317
1959
  addAttributes() {
318
1960
  return {
@@ -328,44 +1970,44 @@ const bt = /* @__PURE__ */ g(kt, [["render", yt]]), D = {
328
1970
  }
329
1971
  ];
330
1972
  },
331
- renderText({ node: e }) {
332
- return Xe(j(e.attrs.code).unicode_output);
1973
+ renderText({ node: t }) {
1974
+ return Pn(At(t.attrs.code).unicode_output);
333
1975
  },
334
- renderHTML({ HTMLAttributes: e }) {
335
- return ["emoji-component", T(this.options.HTMLAttributes, e)];
1976
+ renderHTML({ HTMLAttributes: t }) {
1977
+ return ["emoji-component", st(this.options.HTMLAttributes, t)];
336
1978
  },
337
1979
  addInputRules() {
338
1980
  return [
339
- new se({
340
- find: (e) => {
341
- const t = e.match(Ct) || e.match(Et);
342
- if (t)
343
- return Lt(t);
1981
+ new Xe({
1982
+ find: (t) => {
1983
+ const e = t.match(Oi) || t.match(Ei);
1984
+ if (e)
1985
+ return Si(e);
344
1986
  },
345
- handler: ({ state: e, range: t, match: o }) => {
346
- const { tr: n } = e, r = t.from, s = t.to;
347
- n.replaceWith(r, s, this.type.create({ code: o[0] }));
1987
+ handler: ({ state: t, range: e, match: o }) => {
1988
+ const { tr: n } = t, i = e.from, s = e.to;
1989
+ n.replaceWith(i, s, this.type.create({ code: o[0] }));
348
1990
  }
349
1991
  })
350
1992
  ];
351
1993
  },
352
1994
  addPasteRules() {
353
1995
  return [
354
- O({
355
- find: vt,
1996
+ Et({
1997
+ find: Li,
356
1998
  type: this.type,
357
- getAttributes(e) {
1999
+ getAttributes(t) {
358
2000
  return {
359
- code: e[0]
2001
+ code: t[0]
360
2002
  };
361
2003
  }
362
2004
  }),
363
- O({
364
- find: ze,
2005
+ Et({
2006
+ find: Nn,
365
2007
  type: this.type,
366
- getAttributes(e) {
2008
+ getAttributes(t) {
367
2009
  return {
368
- code: e[0]
2010
+ code: t[0]
369
2011
  };
370
2012
  }
371
2013
  })
@@ -373,156 +2015,156 @@ const bt = /* @__PURE__ */ g(kt, [["render", yt]]), D = {
373
2015
  },
374
2016
  addProseMirrorPlugins() {
375
2017
  return [
376
- Pe({
2018
+ $n({
377
2019
  char: ":",
378
- pluginKey: new $("emoji"),
2020
+ pluginKey: new rt("emoji"),
379
2021
  editor: this.editor,
380
2022
  ...this.options.suggestion,
381
- ...xt
2023
+ ...Ci
382
2024
  })
383
2025
  ];
384
2026
  },
385
2027
  addKeyboardShortcuts() {
386
2028
  return {
387
- Backspace: () => this.editor.commands.command(({ tr: e, state: t }) => {
2029
+ Backspace: () => this.editor.commands.command(({ tr: t, state: e }) => {
388
2030
  let o = !1;
389
- const { selection: n } = t, { empty: r, anchor: s } = n;
390
- return r ? (t.doc.nodesBetween(s - 1, s, (i, a) => {
391
- if (i.type.name === this.name)
392
- return o = !0, e.insertText("", a, a + i.nodeSize), !1;
2031
+ const { selection: n } = e, { empty: i, anchor: s } = n;
2032
+ return i ? (e.doc.nodesBetween(s - 1, s, (r, a) => {
2033
+ if (r.type.name === this.name)
2034
+ return o = !0, t.insertText("", a, a + r.nodeSize), !1;
393
2035
  }), o) : !1;
394
2036
  })
395
2037
  };
396
2038
  }
397
2039
  });
398
- function $t(e, t, o = () => !0) {
2040
+ function Di(t, e, o = () => !0) {
399
2041
  const n = [];
400
- t.lastIndex = 0;
401
- let r;
402
- for (; r = t.exec(e); )
403
- o(e, r) && n.push(r);
2042
+ e.lastIndex = 0;
2043
+ let i;
2044
+ for (; i = e.exec(t); )
2045
+ o(t, i) && n.push(i);
404
2046
  return n;
405
2047
  }
406
- function It(e, t) {
407
- return !["#", "@"].includes(e.charAt(t.index)) && !["#", "@"].includes(e.charAt(t.index - 1));
2048
+ function Ai(t, e) {
2049
+ return !["#", "@"].includes(t.charAt(e.index)) && !["#", "@"].includes(t.charAt(e.index - 1));
408
2050
  }
409
- function At(e) {
410
- const t = new RegExp(
2051
+ function Ri(t) {
2052
+ const e = new RegExp(
411
2053
  "(?:" + [
412
2054
  `[!?.,:;'"]`,
413
2055
  "(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"
414
2056
  ].join("|"),
415
2057
  "g"
416
2058
  );
417
- return e.replace(t, "");
2059
+ return t.replace(e, "");
418
2060
  }
419
- function Rt(e, t) {
420
- const o = e.slice(0, t + 1).search(/\S+\s*$/), n = e.slice(t).search(/\s/);
2061
+ function Mi(t, e) {
2062
+ const o = t.slice(0, e + 1).search(/\S+\s*$/), n = t.slice(e).search(/\s/);
421
2063
  if (n < 0) {
422
- const r = e.slice(o);
2064
+ const i = t.slice(o);
423
2065
  return {
424
- text: r,
2066
+ text: i,
425
2067
  from: o,
426
- to: o + r.length
2068
+ to: o + i.length
427
2069
  };
428
2070
  }
429
2071
  return {
430
- text: e.slice(o, n + t),
2072
+ text: t.slice(o, n + e),
431
2073
  from: o,
432
- to: n + t
2074
+ to: n + e
433
2075
  };
434
2076
  }
435
- function H(e, t, o, n) {
436
- const r = Rt(e, t);
437
- if (n.lastIndex = 0, !n.test(r.text))
438
- return r;
439
- const s = o === "left" ? r.from - 1 : r.to + 1;
440
- return s <= 0 || s >= e.length || s === t ? r : H(e, s, o, n);
2077
+ function Lt(t, e, o, n) {
2078
+ const i = Mi(t, e);
2079
+ if (n.lastIndex = 0, !n.test(i.text))
2080
+ return i;
2081
+ const s = o === "left" ? i.from - 1 : i.to + 1;
2082
+ return s <= 0 || s >= t.length || s === e ? i : Lt(t, s, o, n);
441
2083
  }
442
- function Mt(e, t, o, n) {
443
- const r = Math.max(e.from - 1, 0), s = Math.min(e.to + 1, t.content.size), i = ie(r, s, t);
444
- for (const a of i)
2084
+ function Hi(t, e, o, n) {
2085
+ const i = Math.max(t.from - 1, 0), s = Math.min(t.to + 1, e.content.size), r = Ye(i, s, e);
2086
+ for (const a of r)
445
2087
  a.mark.type === n && o.removeMark(a.from, a.to, n);
446
2088
  }
447
- const U = Qe(1, 15);
448
- function q(e, t, o, n, r, s) {
449
- if (!e)
2089
+ const ie = zn(1, 15);
2090
+ function se(t, e, o, n, i, s) {
2091
+ if (!t)
450
2092
  return;
451
- let i = o - t - 1;
452
- i = i < 0 ? 0 : i;
453
- const a = n - t, c = H(
454
- e,
455
- i,
2093
+ let r = o - e - 1;
2094
+ r = r < 0 ? 0 : r;
2095
+ const a = n - e, l = Lt(
2096
+ t,
2097
+ r,
456
2098
  "left",
457
- U
458
- ), h = H(
459
- e,
2099
+ ie
2100
+ ), u = Lt(
2101
+ t,
460
2102
  a,
461
2103
  "right",
462
- U
463
- ), _ = e.slice(c.from, h.to);
464
- $t(_, Ye, It).forEach((x) => {
465
- const E = At(x[0]), A = t + c.from + x.index + 1, te = A + E.length;
466
- r.addMark(A, te, s.create());
2104
+ ie
2105
+ ), d = t.slice(l.from, u.to);
2106
+ Di(d, jn, Ai).forEach((h) => {
2107
+ const f = Ri(h[0]), p = e + l.from + h.index + 1, m = p + f.length;
2108
+ i.addMark(p, m, s.create());
467
2109
  });
468
2110
  }
469
- function Bt(e) {
470
- let t = !1;
471
- return new He({
472
- key: new $("autolink"),
473
- appendTransaction: (o, n, r) => {
474
- const s = o.some((_) => _.docChanged) && !n.doc.eq(r.doc);
475
- if (t && !s)
2111
+ function $i(t) {
2112
+ let e = !1;
2113
+ return new It({
2114
+ key: new rt("autolink"),
2115
+ appendTransaction: (o, n, i) => {
2116
+ const s = o.some((d) => d.docChanged) && !n.doc.eq(i.doc);
2117
+ if (e && !s)
476
2118
  return;
477
- const { tr: i } = r, { textContent: a } = r.doc;
478
- t || q(a, 0, 0, a.length, i, e.type), t = !0;
479
- const c = ae(
2119
+ const { tr: r } = i, { textContent: a } = i.doc;
2120
+ e || se(a, 0, 0, a.length, r, t.type), e = !0;
2121
+ const l = Ge(
480
2122
  n.doc,
481
2123
  [...o]
482
2124
  );
483
- return ce(c).forEach(({ oldRange: _, newRange: k }) => {
484
- Mt(k, r.doc, i, e.type), le(
485
- r.doc,
486
- k,
487
- (E) => E.isTextblock
488
- ).forEach(({ node: E, pos: A }) => {
489
- q(
490
- E.textContent,
491
- A,
492
- _.from,
493
- k.to,
494
- i,
495
- e.type
2125
+ return Je(l).forEach(({ oldRange: d, newRange: c }) => {
2126
+ Hi(c, i.doc, r, t.type), Ze(
2127
+ i.doc,
2128
+ c,
2129
+ (f) => f.isTextblock
2130
+ ).forEach(({ node: f, pos: p }) => {
2131
+ se(
2132
+ f.textContent,
2133
+ p,
2134
+ d.from,
2135
+ c.to,
2136
+ r,
2137
+ t.type
496
2138
  );
497
2139
  });
498
- }), i;
2140
+ }), r;
499
2141
  }
500
2142
  });
501
2143
  }
502
- const Nt = {
2144
+ const Bi = {
503
2145
  class: "d-link d-c-text d-d-inline-block d-wb-break-all",
504
2146
  rel: "noopener noreferrer nofollow"
505
- }, Dt = de.create({
2147
+ }, Ni = Qe.create({
506
2148
  name: "CustomLink",
507
- renderHTML({ HTMLAttributes: e }) {
2149
+ renderHTML({ HTMLAttributes: t }) {
508
2150
  return [
509
2151
  "a",
510
- T(
2152
+ st(
511
2153
  this.options.HTMLAttributes,
512
- e,
513
- Nt
2154
+ t,
2155
+ Bi
514
2156
  )
515
2157
  ];
516
2158
  },
517
- renderText({ node: e }) {
518
- return e.attrs.text;
2159
+ renderText({ node: t }) {
2160
+ return t.attrs.text;
519
2161
  },
520
2162
  addProseMirrorPlugins() {
521
2163
  return [
522
- Bt({ type: this.type })
2164
+ $i({ type: this.type })
523
2165
  ];
524
2166
  }
525
- }), Ot = et.extend({
2167
+ }), Pi = Kn.extend({
526
2168
  name: "ConfigurableImage",
527
2169
  addAttributes() {
528
2170
  return {
@@ -546,21 +2188,21 @@ const Nt = {
546
2188
  }
547
2189
  };
548
2190
  }
549
- }).configure({ inline: !0, allowBase64: !0 }), Ht = z.extend({
2191
+ }).configure({ inline: !0, allowBase64: !0 }), Ui = me.extend({
550
2192
  parseHTML() {
551
2193
  return [{ tag: "div" }];
552
2194
  },
553
- renderHTML({ HTMLAttributes: e }) {
554
- return ["div", T(this.options.HTMLAttributes, e), 0];
2195
+ renderHTML({ HTMLAttributes: t }) {
2196
+ return ["div", st(this.options.HTMLAttributes, t), 0];
555
2197
  }
556
- }), Pt = {
2198
+ }), Vi = {
557
2199
  compatConfig: { MODE: 3 },
558
2200
  name: "MentionComponent",
559
2201
  components: {
560
- NodeViewWrapper: v,
561
- DtLink: Q
2202
+ NodeViewWrapper: pt,
2203
+ DtLink: we
562
2204
  },
563
- props: L,
2205
+ props: ft,
564
2206
  computed: {
565
2207
  text() {
566
2208
  return "@" + this.$props.node.attrs.name;
@@ -568,26 +2210,26 @@ const Nt = {
568
2210
  },
569
2211
  methods: {
570
2212
  handleClick() {
571
- const e = {
2213
+ const t = {
572
2214
  name: this.$props.node.attrs.name,
573
2215
  id: this.$props.node.attrs.id,
574
2216
  avatarSrc: this.$props.node.attrs.avatarSrc,
575
2217
  contactKey: this.$props.node.attrs.contactKey
576
2218
  };
577
- this.$props.editor.emit("mention-click", e);
2219
+ this.$props.editor.emit("mention-click", t);
578
2220
  }
579
2221
  }
580
2222
  };
581
- function jt(e, t, o, n, r, s) {
582
- const i = l("dt-link"), a = l("node-view-wrapper");
583
- return d(), p(a, { class: "d-d-inline-block" }, {
584
- default: u(() => [
585
- m(i, {
2223
+ function ji(t, e, o, n, i, s) {
2224
+ const r = T("dt-link"), a = T("node-view-wrapper");
2225
+ return k(), M(a, { class: "d-d-inline-block" }, {
2226
+ default: C(() => [
2227
+ I(r, {
586
2228
  kind: "mention",
587
- onClick: P(s.handleClick, ["prevent"])
2229
+ onClick: Dt(s.handleClick, ["prevent"])
588
2230
  }, {
589
- default: u(() => [
590
- C(f(s.text), 1)
2231
+ default: C(() => [
2232
+ at($(s.text), 1)
591
2233
  ]),
592
2234
  _: 1
593
2235
  }, 8, ["onClick"])
@@ -595,9 +2237,9 @@ function jt(e, t, o, n, r, s) {
595
2237
  _: 1
596
2238
  });
597
2239
  }
598
- const Vt = /* @__PURE__ */ g(Pt, [["render", jt]]), Kt = V.extend({
2240
+ const zi = /* @__PURE__ */ q(Vi, [["render", ji]]), Fi = Rt.extend({
599
2241
  addNodeView() {
600
- return S(Vt);
2242
+ return mt(zi);
601
2243
  },
602
2244
  parseHTML() {
603
2245
  return [
@@ -622,27 +2264,27 @@ const Vt = /* @__PURE__ */ g(Pt, [["render", jt]]), Kt = V.extend({
622
2264
  }
623
2265
  };
624
2266
  },
625
- renderText({ node: e }) {
626
- return `@${e.attrs.id}`;
2267
+ renderText({ node: t }) {
2268
+ return `@${t.attrs.id}`;
627
2269
  },
628
- renderHTML({ HTMLAttributes: e }) {
629
- return ["mention-component", T(this.options.HTMLAttributes, e)];
2270
+ renderHTML({ HTMLAttributes: t }) {
2271
+ return ["mention-component", st(this.options.HTMLAttributes, t)];
630
2272
  }
631
2273
  }).configure({
632
2274
  suggestion: {
633
2275
  char: "@",
634
- pluginKey: new $("mentionSuggestion")
2276
+ pluginKey: new rt("mentionSuggestion")
635
2277
  }
636
- }), Ft = {
2278
+ }), Ki = {
637
2279
  compatConfig: { MODE: 3 },
638
2280
  name: "ChannelComponent",
639
2281
  components: {
640
- NodeViewWrapper: v,
641
- DtLink: Q,
642
- DtIconLock: tt,
643
- DtStack: I
2282
+ NodeViewWrapper: pt,
2283
+ DtLink: we,
2284
+ DtIconLock: Wn,
2285
+ DtStack: gt
644
2286
  },
645
- props: L,
2287
+ props: ft,
646
2288
  computed: {
647
2289
  text() {
648
2290
  return this.$props.node.attrs.locked ? this.$props.node.attrs.name : "#" + this.$props.node.attrs.name;
@@ -650,35 +2292,35 @@ const Vt = /* @__PURE__ */ g(Pt, [["render", jt]]), Kt = V.extend({
650
2292
  },
651
2293
  methods: {
652
2294
  handleClick() {
653
- const e = {
2295
+ const t = {
654
2296
  name: this.$props.node.attrs.name,
655
2297
  id: this.$props.node.attrs.id,
656
2298
  locked: this.$props.node.attrs.locked,
657
2299
  channelKey: this.$props.node.attrs.channelKey
658
2300
  };
659
- this.$props.editor.emit("channel-click", e);
2301
+ this.$props.editor.emit("channel-click", t);
660
2302
  }
661
2303
  }
662
2304
  };
663
- function Ut(e, t, o, n, r, s) {
664
- const i = l("dt-icon-lock"), a = l("dt-stack"), c = l("dt-link"), h = l("node-view-wrapper");
665
- return d(), p(h, { class: "d-d-inline-block" }, {
666
- default: u(() => [
667
- m(c, {
2305
+ function Wi(t, e, o, n, i, s) {
2306
+ const r = T("dt-icon-lock"), a = T("dt-stack"), l = T("dt-link"), u = T("node-view-wrapper");
2307
+ return k(), M(u, { class: "d-d-inline-block" }, {
2308
+ default: C(() => [
2309
+ I(l, {
668
2310
  kind: "mention",
669
- onClick: P(s.handleClick, ["prevent"])
2311
+ onClick: Dt(s.handleClick, ["prevent"])
670
2312
  }, {
671
- default: u(() => [
672
- m(a, {
2313
+ default: C(() => [
2314
+ I(a, {
673
2315
  direction: "row",
674
2316
  gap: "0"
675
2317
  }, {
676
- default: u(() => [
677
- e.$props.node.attrs.locked ? (d(), p(i, {
2318
+ default: C(() => [
2319
+ t.$props.node.attrs.locked ? (k(), M(r, {
678
2320
  key: 0,
679
2321
  size: "200"
680
- })) : w("", !0),
681
- b("span", null, f(s.text), 1)
2322
+ })) : it("", !0),
2323
+ nt("span", null, $(s.text), 1)
682
2324
  ]),
683
2325
  _: 1
684
2326
  })
@@ -689,10 +2331,10 @@ function Ut(e, t, o, n, r, s) {
689
2331
  _: 1
690
2332
  });
691
2333
  }
692
- const qt = /* @__PURE__ */ g(Ft, [["render", Ut]]), Wt = V.extend({
2334
+ const qi = /* @__PURE__ */ q(Ki, [["render", Wi]]), Xi = Rt.extend({
693
2335
  name: "channel",
694
2336
  addNodeView() {
695
- return S(qt);
2337
+ return mt(qi);
696
2338
  },
697
2339
  parseHTML() {
698
2340
  return [
@@ -717,25 +2359,25 @@ const qt = /* @__PURE__ */ g(Ft, [["render", Ut]]), Wt = V.extend({
717
2359
  }
718
2360
  };
719
2361
  },
720
- renderText({ node: e }) {
721
- return `#${e.attrs.id}`;
2362
+ renderText({ node: t }) {
2363
+ return `#${t.attrs.id}`;
722
2364
  },
723
- renderHTML({ HTMLAttributes: e }) {
724
- return ["channel-component", T(this.options.HTMLAttributes, e)];
2365
+ renderHTML({ HTMLAttributes: t }) {
2366
+ return ["channel-component", st(this.options.HTMLAttributes, t)];
725
2367
  }
726
2368
  }).configure({
727
2369
  suggestion: {
728
2370
  char: "#",
729
- pluginKey: new $("channelSuggestion")
2371
+ pluginKey: new rt("channelSuggestion")
730
2372
  }
731
- }), zt = {
2373
+ }), Yi = {
732
2374
  compatConfig: { MODE: 3 },
733
2375
  name: "SlashCommandsComponent",
734
2376
  components: {
735
- NodeViewWrapper: v
2377
+ NodeViewWrapper: pt
736
2378
  },
737
2379
  props: {
738
- ...L
2380
+ ...ft
739
2381
  },
740
2382
  emits: ["selected-command"],
741
2383
  computed: {
@@ -744,37 +2386,37 @@ const qt = /* @__PURE__ */ g(Ft, [["render", Ut]]), Wt = V.extend({
744
2386
  }
745
2387
  },
746
2388
  created() {
747
- var o, n, r;
748
- const e = this.$props.node.attrs.command;
749
- this.$emit("selected-command", e);
750
- const t = (r = (n = (o = this.editor) == null ? void 0 : o.storage) == null ? void 0 : n["slash-commands"]) == null ? void 0 : r.onSelectedCommand;
751
- t && typeof t == "function" && t(e);
2389
+ var o, n, i;
2390
+ const t = this.$props.node.attrs.command;
2391
+ this.$emit("selected-command", t);
2392
+ const e = (i = (n = (o = this.editor) == null ? void 0 : o.storage) == null ? void 0 : n["slash-commands"]) == null ? void 0 : i.onSelectedCommand;
2393
+ e && typeof e == "function" && e(t);
752
2394
  }
753
2395
  };
754
- function Xt(e, t, o, n, r, s) {
755
- const i = l("node-view-wrapper");
756
- return d(), p(i, { class: "d-d-inline-block" }, {
757
- default: u(() => [
758
- C(f(s.text), 1)
2396
+ function Gi(t, e, o, n, i, s) {
2397
+ const r = T("node-view-wrapper");
2398
+ return k(), M(r, { class: "d-d-inline-block" }, {
2399
+ default: C(() => [
2400
+ at($(s.text), 1)
759
2401
  ]),
760
2402
  _: 1
761
2403
  });
762
2404
  }
763
- const Gt = /* @__PURE__ */ g(zt, [["render", Xt]]), Jt = (e, t) => [...e.matchAll(t)].map((n) => {
764
- let r = n[2];
765
- return r.endsWith(" ") || (r += " "), {
2405
+ const Ji = /* @__PURE__ */ q(Yi, [["render", Gi]]), Zi = (t, e) => [...t.matchAll(e)].map((n) => {
2406
+ let i = n[2];
2407
+ return i.endsWith(" ") || (i += " "), {
766
2408
  index: n.index,
767
- text: r,
2409
+ text: i,
768
2410
  match: n
769
2411
  };
770
- }), Yt = V.extend({
2412
+ }), Qi = Rt.extend({
771
2413
  name: "slash-commands",
772
2414
  group: "inline",
773
2415
  inline: !0,
774
2416
  addOptions() {
775
- var e;
2417
+ var t;
776
2418
  return {
777
- ...(e = this.parent) == null ? void 0 : e.call(this),
2419
+ ...(t = this.parent) == null ? void 0 : t.call(this),
778
2420
  onSelectedCommand: null
779
2421
  };
780
2422
  },
@@ -784,7 +2426,7 @@ const Gt = /* @__PURE__ */ g(zt, [["render", Xt]]), Jt = (e, t) => [...e.matchAl
784
2426
  };
785
2427
  },
786
2428
  addNodeView() {
787
- return S(Gt);
2429
+ return mt(Ji);
788
2430
  },
789
2431
  parseHTML() {
790
2432
  return [
@@ -806,18 +2448,18 @@ const Gt = /* @__PURE__ */ g(zt, [["render", Xt]]), Jt = (e, t) => [...e.matchAl
806
2448
  }
807
2449
  };
808
2450
  },
809
- renderText({ node: e }) {
810
- return `/${e.attrs.command}`;
2451
+ renderText({ node: t }) {
2452
+ return `/${t.attrs.command}`;
811
2453
  },
812
- renderHTML({ HTMLAttributes: e }) {
813
- return ["command-component", T(this.options.HTMLAttributes, e)];
2454
+ renderHTML({ HTMLAttributes: t }) {
2455
+ return ["command-component", st(this.options.HTMLAttributes, t)];
814
2456
  },
815
2457
  addInputRules() {
816
2458
  var o;
817
- const e = (o = this.options.suggestion) == null ? void 0 : o.items({ query: "" }).map((n) => n.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) $`);
2459
+ const t = (o = this.options.suggestion) == null ? void 0 : o.items({ query: "" }).map((n) => n.command), e = new RegExp(`^((?:\\/)(${t.join("|")})) $`);
818
2460
  return [
819
- ue({
820
- find: t,
2461
+ tn({
2462
+ find: e,
821
2463
  type: this.type,
822
2464
  getAttributes(n) {
823
2465
  return { command: n[2] };
@@ -827,10 +2469,10 @@ const Gt = /* @__PURE__ */ g(zt, [["render", Xt]]), Jt = (e, t) => [...e.matchAl
827
2469
  },
828
2470
  addPasteRules() {
829
2471
  var o;
830
- const e = (o = this.options.suggestion) == null ? void 0 : o.items({ query: "" }).map((n) => n.command), t = new RegExp(`^((?:\\/)(${e.join("|")})) ?$`, "g");
2472
+ const t = (o = this.options.suggestion) == null ? void 0 : o.items({ query: "" }).map((n) => n.command), e = new RegExp(`^((?:\\/)(${t.join("|")})) ?$`, "g");
831
2473
  return [
832
- O({
833
- find: (n) => Jt(n, t),
2474
+ Et({
2475
+ find: (n) => Zi(n, e),
834
2476
  type: this.type,
835
2477
  getAttributes(n) {
836
2478
  return { command: n[0].trim() };
@@ -841,48 +2483,48 @@ const Gt = /* @__PURE__ */ g(zt, [["render", Xt]]), Jt = (e, t) => [...e.matchAl
841
2483
  }).configure({
842
2484
  suggestion: {
843
2485
  char: "/",
844
- pluginKey: new $("slashCommandSuggestion")
2486
+ pluginKey: new rt("slashCommandSuggestion")
845
2487
  }
846
- }), Qt = 100, Zt = {
2488
+ }), ts = 100, es = {
847
2489
  name: "VariableComponent",
848
2490
  components: {
849
- DtBadge: rt,
850
- DtButton: ee,
851
- DtPopover: ot,
852
- DtInput: nt,
853
- NodeViewWrapper: v
2491
+ DtBadge: Yn,
2492
+ DtButton: ve,
2493
+ DtPopover: Xn,
2494
+ DtInput: qn,
2495
+ NodeViewWrapper: pt
854
2496
  },
855
- props: L,
2497
+ props: ft,
856
2498
  data() {
857
2499
  return {
858
- i18n: new Z(),
859
- MAX_VARIABLE_ALT_LENGTH: Qt
2500
+ i18n: new be(),
2501
+ MAX_VARIABLE_ALT_LENGTH: ts
860
2502
  };
861
2503
  },
862
2504
  computed: {
863
2505
  altText: {
864
2506
  get() {
865
- var e, t;
866
- return ((t = (e = this.node) == null ? void 0 : e.attrs) == null ? void 0 : t.altText) || "";
2507
+ var t, e;
2508
+ return ((e = (t = this.node) == null ? void 0 : t.attrs) == null ? void 0 : e.altText) || "";
867
2509
  },
868
- set(e) {
869
- this.updateAttributes({ altText: e });
2510
+ set(t) {
2511
+ this.updateAttributes({ altText: t });
870
2512
  }
871
2513
  },
872
2514
  variableId() {
873
- var e, t;
874
- return (t = (e = this.node) == null ? void 0 : e.attrs) == null ? void 0 : t.id;
2515
+ var t, e;
2516
+ return (e = (t = this.node) == null ? void 0 : t.attrs) == null ? void 0 : e.id;
875
2517
  },
876
2518
  placeholder() {
877
- var e;
878
- return ((e = this.variableData) == null ? void 0 : e.placeholder) || "";
2519
+ var t;
2520
+ return ((t = this.variableData) == null ? void 0 : t.placeholder) || "";
879
2521
  },
880
2522
  variableItems() {
881
- var e, t;
882
- return ((t = (e = this.extension) == null ? void 0 : e.options) == null ? void 0 : t.variableItems) || [];
2523
+ var t, e;
2524
+ return ((e = (t = this.extension) == null ? void 0 : t.options) == null ? void 0 : e.variableItems) || [];
883
2525
  },
884
2526
  variableData() {
885
- return this.variableItems.find((e) => e.id === this.variableId);
2527
+ return this.variableItems.find((t) => t.id === this.variableId);
886
2528
  },
887
2529
  badgeLabel() {
888
2530
  return `{} ${this.placeholder}`;
@@ -892,20 +2534,20 @@ const Gt = /* @__PURE__ */ g(zt, [["render", Xt]]), Jt = (e, t) => [...e.matchAl
892
2534
  }
893
2535
  }
894
2536
  };
895
- function en(e, t, o, n, r, s) {
896
- const i = l("dt-badge"), a = l("dt-button"), c = l("dt-input"), h = l("dt-popover"), _ = l("node-view-wrapper");
897
- return d(), p(_, { class: "d-d-inline-block" }, {
898
- default: u(() => [
899
- m(h, {
2537
+ function ns(t, e, o, n, i, s) {
2538
+ const r = T("dt-badge"), a = T("dt-button"), l = T("dt-input"), u = T("dt-popover"), d = T("node-view-wrapper");
2539
+ return k(), M(d, { class: "d-d-inline-block" }, {
2540
+ default: C(() => [
2541
+ I(u, {
900
2542
  padding: "small",
901
2543
  "navigation-type": "arrow-keys",
902
2544
  placement: "top-start",
903
2545
  modal: !1
904
2546
  }, {
905
- anchor: u(({ attrs: k }) => [
906
- m(a, J(k, { kind: "unstyled" }), {
907
- default: u(() => [
908
- m(i, {
2547
+ anchor: C(({ attrs: c }) => [
2548
+ I(a, pe(c, { kind: "unstyled" }), {
2549
+ default: C(() => [
2550
+ I(r, {
909
2551
  text: s.badgeLabel,
910
2552
  contenteditable: "false"
911
2553
  }, null, 8, ["text"])
@@ -913,23 +2555,23 @@ function en(e, t, o, n, r, s) {
913
2555
  _: 1
914
2556
  }, 16)
915
2557
  ]),
916
- content: u(({ close: k }) => [
917
- m(c, {
2558
+ content: C(({ close: c }) => [
2559
+ I(l, {
918
2560
  modelValue: s.altText,
919
- "onUpdate:modelValue": t[0] || (t[0] = (x) => s.altText = x),
2561
+ "onUpdate:modelValue": e[0] || (e[0] = (h) => s.altText = h),
920
2562
  "root-class": "d-p8 d-w332",
921
- label: r.i18n.$t("DIALTONE_EDITOR_VARIABLE_LABEL"),
2563
+ label: i.i18n.$t("DIALTONE_EDITOR_VARIABLE_LABEL"),
922
2564
  placeholder: s.placeholderText,
923
2565
  validate: {
924
2566
  length: {
925
- description: r.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION"),
926
- message: r.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE"),
927
- max: r.MAX_VARIABLE_ALT_LENGTH,
928
- warn: r.MAX_VARIABLE_ALT_LENGTH,
2567
+ description: i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION"),
2568
+ message: i.i18n.$t("DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE"),
2569
+ max: i.MAX_VARIABLE_ALT_LENGTH,
2570
+ warn: i.MAX_VARIABLE_ALT_LENGTH,
929
2571
  limitMaxLength: !0
930
2572
  }
931
2573
  },
932
- onKeyup: qe((x) => k(), ["enter"])
2574
+ onKeyup: hn((h) => c(), ["enter"])
933
2575
  }, null, 8, ["modelValue", "label", "placeholder", "validate", "onKeyup"])
934
2576
  ]),
935
2577
  _: 1
@@ -938,7 +2580,7 @@ function en(e, t, o, n, r, s) {
938
2580
  _: 1
939
2581
  });
940
2582
  }
941
- const tn = /* @__PURE__ */ g(Zt, [["render", en]]), nn = W.create({
2583
+ const os = /* @__PURE__ */ q(es, [["render", ns]]), is = ae.create({
942
2584
  name: "variable",
943
2585
  group: "inline",
944
2586
  inline: !0,
@@ -951,22 +2593,22 @@ const tn = /* @__PURE__ */ g(Zt, [["render", en]]), nn = W.create({
951
2593
  };
952
2594
  },
953
2595
  addNodeView() {
954
- return S(tn);
2596
+ return mt(os);
955
2597
  },
956
2598
  addAttributes() {
957
2599
  return {
958
2600
  id: {
959
2601
  default: null,
960
- parseHTML: (e) => e.getAttribute("data-variable-id"),
961
- renderHTML: (e) => e.id ? {
962
- "data-variable-id": e.id
2602
+ parseHTML: (t) => t.getAttribute("data-variable-id"),
2603
+ renderHTML: (t) => t.id ? {
2604
+ "data-variable-id": t.id
963
2605
  } : {}
964
2606
  },
965
2607
  altText: {
966
2608
  default: "",
967
- parseHTML: (e) => e.getAttribute("data-alt-text"),
968
- renderHTML: (e) => e.altText ? {
969
- "data-alt-text": e.altText
2609
+ parseHTML: (t) => t.getAttribute("data-alt-text"),
2610
+ renderHTML: (t) => t.altText ? {
2611
+ "data-alt-text": t.altText
970
2612
  } : {}
971
2613
  }
972
2614
  };
@@ -978,35 +2620,35 @@ const tn = /* @__PURE__ */ g(Zt, [["render", en]]), nn = W.create({
978
2620
  }
979
2621
  ];
980
2622
  },
981
- renderText({ node: e }) {
982
- return e.attrs.altText;
2623
+ renderText({ node: t }) {
2624
+ return t.attrs.altText;
983
2625
  },
984
- renderHTML({ node: e, HTMLAttributes: t }) {
2626
+ renderHTML({ node: t, HTMLAttributes: e }) {
985
2627
  return [
986
2628
  "variable",
987
- T(this.options.HTMLAttributes, t, {
988
- "data-variable-id": e.attrs.id,
989
- "data-alt-text": e.attrs.altText
2629
+ st(this.options.HTMLAttributes, e, {
2630
+ "data-variable-id": t.attrs.id,
2631
+ "data-alt-text": t.attrs.altText
990
2632
  })
991
2633
  ];
992
2634
  },
993
2635
  addCommands() {
994
2636
  return {
995
- insertVariable: (e = {}) => ({ commands: t }) => t.insertContent({
2637
+ insertVariable: (t = {}) => ({ commands: e }) => e.insertContent({
996
2638
  type: this.name,
997
2639
  attrs: {
998
- id: e.id || null,
999
- altText: e.altText || ""
2640
+ id: t.id || null,
2641
+ altText: t.altText || ""
1000
2642
  }
1001
2643
  })
1002
2644
  };
1003
2645
  }
1004
- }), on = {
2646
+ }), ss = {
1005
2647
  compatConfig: { MODE: 3 },
1006
2648
  name: "MentionSuggestion",
1007
2649
  components: {
1008
- DtAvatar: at,
1009
- DtStack: I
2650
+ DtAvatar: Zn,
2651
+ DtStack: gt
1010
2652
  },
1011
2653
  props: {
1012
2654
  item: {
@@ -1042,22 +2684,22 @@ const tn = /* @__PURE__ */ g(Zt, [["render", en]]), nn = W.create({
1042
2684
  return this.item.showDetails;
1043
2685
  }
1044
2686
  }
1045
- }, rn = { class: "d-mention-suggestion__name" }, sn = {
2687
+ }, rs = { class: "d-mention-suggestion__name" }, as = {
1046
2688
  key: 1,
1047
2689
  class: "d-mention-suggestion__divider"
1048
- }, an = {
2690
+ }, ls = {
1049
2691
  key: 2,
1050
2692
  class: "d-mention-suggestion__status"
1051
2693
  };
1052
- function cn(e, t, o, n, r, s) {
1053
- const i = l("dt-avatar"), a = l("dt-stack");
1054
- return d(), p(a, {
2694
+ function cs(t, e, o, n, i, s) {
2695
+ const r = T("dt-avatar"), a = T("dt-stack");
2696
+ return k(), M(a, {
1055
2697
  direction: "row",
1056
2698
  class: "d-mention-suggestion__container",
1057
2699
  gap: "400"
1058
2700
  }, {
1059
- default: u(() => [
1060
- m(i, {
2701
+ default: C(() => [
2702
+ I(r, {
1061
2703
  "full-name": s.name,
1062
2704
  "image-src": s.avatarSrc,
1063
2705
  "image-alt": s.name,
@@ -1065,28 +2707,28 @@ function cn(e, t, o, n, r, s) {
1065
2707
  presence: s.presence,
1066
2708
  size: "sm"
1067
2709
  }, null, 8, ["full-name", "image-src", "image-alt", "show-presence", "presence"]),
1068
- m(a, {
2710
+ I(a, {
1069
2711
  class: "d-mention-suggestion__details-container",
1070
2712
  gap: "100"
1071
2713
  }, {
1072
- default: u(() => [
1073
- b("span", rn, f(s.name), 1),
1074
- s.showDetails ? (d(), p(a, {
2714
+ default: C(() => [
2715
+ nt("span", rs, $(s.name), 1),
2716
+ s.showDetails ? (k(), M(a, {
1075
2717
  key: 0,
1076
2718
  direction: "row",
1077
2719
  gap: "300",
1078
2720
  class: "d-label--sm-plain"
1079
2721
  }, {
1080
- default: u(() => [
1081
- s.presenceText ? (d(), y("span", {
2722
+ default: C(() => [
2723
+ s.presenceText ? (k(), et("span", {
1082
2724
  key: 0,
1083
- class: G(["d-mention-suggestion__presence", [s.presenceFontColorClass]])
1084
- }, f(s.presenceText), 3)) : w("", !0),
1085
- s.status && s.presenceText ? (d(), y("div", sn, " • ")) : w("", !0),
1086
- s.status ? (d(), y("div", an, f(s.status), 1)) : w("", !0)
2725
+ class: fe(["d-mention-suggestion__presence", [s.presenceFontColorClass]])
2726
+ }, $(s.presenceText), 3)) : it("", !0),
2727
+ s.status && s.presenceText ? (k(), et("div", as, " • ")) : it("", !0),
2728
+ s.status ? (k(), et("div", ls, $(s.status), 1)) : it("", !0)
1087
2729
  ]),
1088
2730
  _: 1
1089
- })) : w("", !0)
2731
+ })) : it("", !0)
1090
2732
  ]),
1091
2733
  _: 1
1092
2734
  })
@@ -1094,62 +2736,19 @@ function cn(e, t, o, n, r, s) {
1094
2736
  _: 1
1095
2737
  });
1096
2738
  }
1097
- const ln = /* @__PURE__ */ g(on, [["render", cn]]), dn = {
2739
+ const ds = /* @__PURE__ */ q(ss, [["render", cs]]), us = {
1098
2740
  // This function comes from the user and passed to the editor directly.
1099
2741
  // This will also activate the mention plugin on the editor
1100
2742
  // items: ({ query }) => { return [] },
1101
2743
  allowSpaces: !0,
1102
- render: () => {
1103
- let e, t, o = !1;
1104
- return {
1105
- onStart: (n) => {
1106
- e = new R(N, {
1107
- props: {
1108
- itemComponent: M(ln),
1109
- itemType: "mention",
1110
- ...n
1111
- },
1112
- editor: n.editor
1113
- }), n.clientRect && (t = B("body", {
1114
- getReferenceClientRect: n.clientRect,
1115
- appendTo: () => document.body,
1116
- content: e.element,
1117
- showOnCreate: !1,
1118
- onShow: () => {
1119
- o = !0;
1120
- },
1121
- onHidden: () => {
1122
- o = !1;
1123
- },
1124
- interactive: !0,
1125
- trigger: "manual",
1126
- placement: "top-start",
1127
- zIndex: 650,
1128
- plugins: [D]
1129
- }), n.items.length > 0 && (t == null || t[0].show()));
1130
- },
1131
- onUpdate(n) {
1132
- e == null || e.updateProps(n), n.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), n.clientRect && (t == null || t[0].setProps({
1133
- getReferenceClientRect: n.clientRect
1134
- }));
1135
- },
1136
- onKeyDown(n) {
1137
- var r;
1138
- if (o)
1139
- return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
1140
- },
1141
- onExit() {
1142
- t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
1143
- }
1144
- };
1145
- }
1146
- }, un = {
2744
+ render: Ct(ds, "mention")
2745
+ }, hs = {
1147
2746
  compatConfig: { MODE: 3 },
1148
2747
  name: "ChannelSuggestion",
1149
2748
  components: {
1150
- DtStack: I,
1151
- DtIconHash: ct,
1152
- DtIconLock: lt
2749
+ DtStack: gt,
2750
+ DtIconHash: Qn,
2751
+ DtIconLock: to
1153
2752
  },
1154
2753
  props: {
1155
2754
  item: {
@@ -1163,75 +2762,32 @@ const ln = /* @__PURE__ */ g(on, [["render", cn]]), dn = {
1163
2762
  }
1164
2763
  }
1165
2764
  };
1166
- function mn(e, t, o, n, r, s) {
1167
- const i = l("dt-icon-hash"), a = l("dt-icon-lock"), c = l("dt-stack");
1168
- return d(), p(c, {
2765
+ function fs(t, e, o, n, i, s) {
2766
+ const r = T("dt-icon-hash"), a = T("dt-icon-lock"), l = T("dt-stack");
2767
+ return k(), M(l, {
1169
2768
  direction: "row",
1170
2769
  gap: "400"
1171
2770
  }, {
1172
- default: u(() => [
1173
- o.item.locked ? (d(), p(a, {
2771
+ default: C(() => [
2772
+ o.item.locked ? (k(), M(a, {
1174
2773
  key: 1,
1175
2774
  size: "300"
1176
- })) : (d(), p(i, {
2775
+ })) : (k(), M(r, {
1177
2776
  key: 0,
1178
2777
  size: "300"
1179
2778
  })),
1180
- b("span", null, f(s.name), 1)
2779
+ nt("span", null, $(s.name), 1)
1181
2780
  ]),
1182
2781
  _: 1
1183
2782
  });
1184
2783
  }
1185
- const hn = /* @__PURE__ */ g(un, [["render", mn]]), pn = {
2784
+ const ps = /* @__PURE__ */ q(hs, [["render", fs]]), ms = {
1186
2785
  // This function comes from the user and passed to the editor directly.
1187
2786
  // This will also activate the mention plugin on the editor
1188
2787
  // items: ({ query }) => { return [] },
1189
2788
  allowSpaces: !0,
1190
- render: () => {
1191
- let e, t, o = !1;
1192
- return {
1193
- onStart: (n) => {
1194
- e = new R(N, {
1195
- props: {
1196
- itemComponent: M(hn),
1197
- itemType: "channel",
1198
- ...n
1199
- },
1200
- editor: n.editor
1201
- }), n.clientRect && (t = B("body", {
1202
- getReferenceClientRect: n.clientRect,
1203
- appendTo: () => document.body,
1204
- content: e.element,
1205
- showOnCreate: !1,
1206
- onShow: () => {
1207
- o = !0;
1208
- },
1209
- onHidden: () => {
1210
- o = !1;
1211
- },
1212
- interactive: !0,
1213
- trigger: "manual",
1214
- placement: "top-start",
1215
- zIndex: 650,
1216
- plugins: [D]
1217
- }), n.items.length > 0 && (t == null || t[0].show()));
1218
- },
1219
- onUpdate(n) {
1220
- e == null || e.updateProps(n), n.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), n.clientRect && (t == null || t[0].setProps({
1221
- getReferenceClientRect: n.clientRect
1222
- }));
1223
- },
1224
- onKeyDown(n) {
1225
- var r;
1226
- if (o)
1227
- return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
1228
- },
1229
- onExit() {
1230
- t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
1231
- }
1232
- };
1233
- }
1234
- }, fn = {
2789
+ render: Ct(ps, "channel")
2790
+ }, gs = {
1235
2791
  compatConfig: { MODE: 3 },
1236
2792
  name: "SlashCommandSuggestion",
1237
2793
  props: {
@@ -1251,75 +2807,31 @@ const hn = /* @__PURE__ */ g(un, [["render", mn]]), pn = {
1251
2807
  return this.item.parametersExample;
1252
2808
  }
1253
2809
  }
1254
- }, gn = { class: "d-body--md-compact" }, _n = { key: 0 }, kn = { class: "d-body--sm d-fc-tertiary" };
1255
- function yn(e, t, o, n, r, s) {
1256
- return d(), y("div", null, [
1257
- b("div", gn, [
1258
- b("span", null, "/" + f(s.command), 1),
1259
- s.parametersExample ? (d(), y("span", _n, f(s.parametersExample), 1)) : w("", !0)
2810
+ }, ys = { class: "d-body--md-compact" }, ws = { key: 0 }, bs = { class: "d-body--sm d-fc-tertiary" };
2811
+ function vs(t, e, o, n, i, s) {
2812
+ return k(), et("div", null, [
2813
+ nt("div", ys, [
2814
+ nt("span", null, "/" + $(s.command), 1),
2815
+ s.parametersExample ? (k(), et("span", ws, $(s.parametersExample), 1)) : it("", !0)
1260
2816
  ]),
1261
- b("div", kn, f(s.description), 1)
2817
+ nt("div", bs, $(s.description), 1)
1262
2818
  ]);
1263
2819
  }
1264
- const bn = /* @__PURE__ */ g(fn, [["render", yn]]), wn = {
2820
+ const xs = /* @__PURE__ */ q(gs, [["render", vs]]), Ts = {
1265
2821
  // This function comes from the user and passed to the editor directly.
1266
2822
  // This will also activate the mention plugin on the editor
1267
2823
  // items: ({ query }) => { return [] },
1268
2824
  allowSpaces: !0,
1269
2825
  startOfLine: !0,
1270
- render: () => {
1271
- let e, t, o = !1;
1272
- return {
1273
- onStart: (n) => {
1274
- e = new R(N, {
1275
- parent: void 0,
1276
- props: {
1277
- itemComponent: M(bn),
1278
- itemType: "slash-command",
1279
- ...n
1280
- },
1281
- editor: n.editor
1282
- }), n.clientRect && (t = B("body", {
1283
- getReferenceClientRect: n.clientRect,
1284
- appendTo: () => document.body,
1285
- content: e.element,
1286
- showOnCreate: !1,
1287
- onShow: () => {
1288
- o = !0;
1289
- },
1290
- onHidden: () => {
1291
- o = !1;
1292
- },
1293
- interactive: !0,
1294
- trigger: "manual",
1295
- placement: "top-start",
1296
- zIndex: 650,
1297
- plugins: [D]
1298
- }), n.items.length > 0 && (t == null || t[0].show()));
1299
- },
1300
- onUpdate(n) {
1301
- e == null || e.updateProps(n), n.items.length > 0 ? t == null || t[0].show() : t == null || t[0].hide(), n.clientRect && (t == null || t[0].setProps({
1302
- getReferenceClientRect: n.clientRect
1303
- }));
1304
- },
1305
- onKeyDown(n) {
1306
- var r;
1307
- if (o)
1308
- return (r = e == null ? void 0 : e.ref) == null ? void 0 : r.onKeyDown(n);
1309
- },
1310
- onExit() {
1311
- t == null || t[0].destroy(), t = null, e == null || e.destroy(), e = null;
1312
- }
1313
- };
1314
- }
1315
- }, Tn = {
2826
+ render: Ct(xs, "slash-command")
2827
+ }, _s = {
1316
2828
  compatConfig: { MODE: 3 },
1317
2829
  name: "DtRichTextEditor",
1318
2830
  components: {
1319
- EditorContent: oe,
1320
- BubbleMenu: ne,
1321
- DtButton: ee,
1322
- DtStack: I
2831
+ EditorContent: ze,
2832
+ BubbleMenu: Qo,
2833
+ DtButton: ve,
2834
+ DtStack: gt
1323
2835
  },
1324
2836
  props: {
1325
2837
  /**
@@ -1390,8 +2902,8 @@ const bn = /* @__PURE__ */ g(fn, [["render", yn]]), wn = {
1390
2902
  autoFocus: {
1391
2903
  type: [Boolean, String, Number],
1392
2904
  default: !1,
1393
- validator(e) {
1394
- return typeof e == "string" ? it.includes(e) : !0;
2905
+ validator(t) {
2906
+ return typeof t == "string" ? Jn.includes(t) : !0;
1395
2907
  }
1396
2908
  },
1397
2909
  /**
@@ -1403,8 +2915,8 @@ const bn = /* @__PURE__ */ g(fn, [["render", yn]]), wn = {
1403
2915
  outputFormat: {
1404
2916
  type: String,
1405
2917
  default: "html",
1406
- validator(e) {
1407
- return st.includes(e);
2918
+ validator(t) {
2919
+ return Gn.includes(t);
1408
2920
  }
1409
2921
  },
1410
2922
  /**
@@ -1699,24 +3211,24 @@ const bn = /* @__PURE__ */ g(fn, [["render", yn]]), wn = {
1699
3211
  data() {
1700
3212
  return {
1701
3213
  editor: null,
1702
- tippyOptions: {
1703
- appendTo: () => {
1704
- var e;
1705
- return (e = K(this.$refs.editor.$el).getRootNode()) == null ? void 0 : e.querySelector("body");
1706
- },
3214
+ appendTo: () => {
3215
+ var t;
3216
+ return (t = zt(this.$refs.editor.$el).getRootNode()) == null ? void 0 : t.querySelector("body");
3217
+ },
3218
+ floatingOptions: {
1707
3219
  placement: "top-start"
1708
3220
  },
1709
- i18n: new Z(),
3221
+ i18n: new be(),
1710
3222
  // JSON-to-markdown converter
1711
3223
  jsonToMarkdownConverter: {
1712
- convertToMarkdown(e) {
1713
- return this.processNode(e);
3224
+ convertToMarkdown(t) {
3225
+ return this.processNode(t);
1714
3226
  },
1715
- processNodeContent(e) {
1716
- return e.content ? e.content.map((t) => this.processNode(t)).join("") : "";
3227
+ processNodeContent(t) {
3228
+ return t.content ? t.content.map((e) => this.processNode(e)).join("") : "";
1717
3229
  },
1718
- processNode(e) {
1719
- if (!e) return "";
3230
+ processNode(t) {
3231
+ if (!t) return "";
1720
3232
  const o = {
1721
3233
  doc: (n) => this.processDocNode(n),
1722
3234
  paragraph: (n) => this.processParagraphNode(n),
@@ -1732,83 +3244,83 @@ const bn = /* @__PURE__ */ g(fn, [["render", yn]]), wn = {
1732
3244
  "slash-commands": (n) => this.processSlashCommandsNode(n),
1733
3245
  emoji: (n) => this.processEmojiNode(n),
1734
3246
  variable: (n) => this.processVariableNode(n)
1735
- }[e.type];
1736
- return o ? o(e) : this.processUnknownNode(e);
3247
+ }[t.type];
3248
+ return o ? o(t) : this.processUnknownNode(t);
1737
3249
  },
1738
- processDocNode(e) {
1739
- return this.processNodeContent(e);
3250
+ processDocNode(t) {
3251
+ return this.processNodeContent(t);
1740
3252
  },
1741
- processParagraphNode(e) {
1742
- const t = this.processNodeContent(e);
1743
- return t ? t + `
3253
+ processParagraphNode(t) {
3254
+ const e = this.processNodeContent(t);
3255
+ return e ? e + `
1744
3256
  ` : `
1745
3257
  `;
1746
3258
  },
1747
- processTextNode(e) {
1748
- let t = e.text || "";
1749
- return e.marks && (t = this.applyMarks(t, e.marks)), t;
3259
+ processTextNode(t) {
3260
+ let e = t.text || "";
3261
+ return t.marks && (e = this.applyMarks(e, t.marks)), e;
1750
3262
  },
1751
3263
  processHardBreakNode() {
1752
3264
  return `
1753
3265
  `;
1754
3266
  },
1755
- processBlockquoteNode(e) {
1756
- return this.processNodeContent(e).split(`
3267
+ processBlockquoteNode(t) {
3268
+ return this.processNodeContent(t).split(`
1757
3269
  `).map((o) => o ? `> ${o}` : ">").join(`
1758
3270
  `) + `
1759
3271
  `;
1760
3272
  },
1761
- processBulletListNode(e) {
1762
- return this.processNodeContent(e);
3273
+ processBulletListNode(t) {
3274
+ return this.processNodeContent(t);
1763
3275
  },
1764
- processOrderedListNode(e) {
1765
- return e.content ? e.content.map((t, o) => this.processNode(t).replace(/^- /, `${o + 1}. `)).join("") : "";
3276
+ processOrderedListNode(t) {
3277
+ return t.content ? t.content.map((e, o) => this.processNode(e).replace(/^- /, `${o + 1}. `)).join("") : "";
1766
3278
  },
1767
- processListItemNode(e) {
1768
- const t = this.processNodeContent(e);
1769
- return t ? `- ${t.replace(/\n$/, "")}
3279
+ processListItemNode(t) {
3280
+ const e = this.processNodeContent(t);
3281
+ return e ? `- ${e.replace(/\n$/, "")}
1770
3282
  ` : "";
1771
3283
  },
1772
- processCodeBlockNode(e) {
3284
+ processCodeBlockNode(t) {
1773
3285
  return `\`\`\`
1774
- ${this.processNodeContent(e)}
3286
+ ${this.processNodeContent(t)}
1775
3287
  \`\`\``;
1776
3288
  },
1777
- processMentionNode(e) {
1778
- var r, s, i;
1779
- const t = ((r = e.attrs) == null ? void 0 : r.name) || "", o = ((s = e.attrs) == null ? void 0 : s.id) || "", n = ((i = e.attrs) == null ? void 0 : i.contactKey) || "";
1780
- return `<!-- @mention: {"id": "${o}", "contactKey": "${n}", "name": "${t}"} -->`;
3289
+ processMentionNode(t) {
3290
+ var i, s, r;
3291
+ const e = ((i = t.attrs) == null ? void 0 : i.name) || "", o = ((s = t.attrs) == null ? void 0 : s.id) || "", n = ((r = t.attrs) == null ? void 0 : r.contactKey) || "";
3292
+ return `<!-- @mention: {"id": "${o}", "contactKey": "${n}", "name": "${e}"} -->`;
1781
3293
  },
1782
- processChannelNode(e) {
1783
- var s, i, a, c;
1784
- const t = ((s = e.attrs) == null ? void 0 : s.name) || "", o = ((i = e.attrs) == null ? void 0 : i.id) || "", n = ((a = e.attrs) == null ? void 0 : a.locked.toString()) || "", r = ((c = e.attrs) == null ? void 0 : c.channelKey) || "";
1785
- return `<!-- @channel: {"id": "${o}", "channelKey": "${r}", "name": "${t}", "locked": "${n}"} -->`;
3294
+ processChannelNode(t) {
3295
+ var s, r, a, l;
3296
+ const e = ((s = t.attrs) == null ? void 0 : s.name) || "", o = ((r = t.attrs) == null ? void 0 : r.id) || "", n = ((a = t.attrs) == null ? void 0 : a.locked.toString()) || "", i = ((l = t.attrs) == null ? void 0 : l.channelKey) || "";
3297
+ return `<!-- @channel: {"id": "${o}", "channelKey": "${i}", "name": "${e}", "locked": "${n}"} -->`;
1786
3298
  },
1787
- processSlashCommandsNode(e) {
1788
- var n, r;
1789
- const t = ((n = e.attrs) == null ? void 0 : n.command) || "", o = ((r = e.attrs) == null ? void 0 : r.parameters) || "";
1790
- return `/${t}${o ? ` ${o}` : ""}`;
3299
+ processSlashCommandsNode(t) {
3300
+ var n, i;
3301
+ const e = ((n = t.attrs) == null ? void 0 : n.command) || "", o = ((i = t.attrs) == null ? void 0 : i.parameters) || "";
3302
+ return `/${e}${o ? ` ${o}` : ""}`;
1791
3303
  },
1792
- processEmojiNode(e) {
1793
- var t;
1794
- return ((t = e.attrs) == null ? void 0 : t.code) || "";
3304
+ processEmojiNode(t) {
3305
+ var e;
3306
+ return ((e = t.attrs) == null ? void 0 : e.code) || "";
1795
3307
  },
1796
- processVariableNode(e) {
1797
- var n, r;
1798
- const t = ((n = e.attrs) == null ? void 0 : n.id) || "", o = ((r = e.attrs) == null ? void 0 : r.altText) || "";
1799
- return `{{${t}=${o}}}`;
3308
+ processVariableNode(t) {
3309
+ var n, i;
3310
+ const e = ((n = t.attrs) == null ? void 0 : n.id) || "", o = ((i = t.attrs) == null ? void 0 : i.altText) || "";
3311
+ return `{{${e}=${o}}}`;
1800
3312
  },
1801
- processUnknownNode(e) {
1802
- return this.processNodeContent(e);
3313
+ processUnknownNode(t) {
3314
+ return this.processNodeContent(t);
1803
3315
  },
1804
- applyMarks(e, t) {
1805
- let o = e;
1806
- return [...t].sort((r, s) => {
1807
- const i = { link: 0, bold: 1, italic: 2, strike: 3, code: 4 };
1808
- return (i[r.type] || 5) - (i[s.type] || 5);
1809
- }).forEach((r) => {
3316
+ applyMarks(t, e) {
3317
+ let o = t;
3318
+ return [...e].sort((i, s) => {
3319
+ const r = { link: 0, bold: 1, italic: 2, strike: 3, code: 4 };
3320
+ return (r[i.type] || 5) - (r[s.type] || 5);
3321
+ }).forEach((i) => {
1810
3322
  var s;
1811
- switch (r.type) {
3323
+ switch (i.type) {
1812
3324
  case "bold":
1813
3325
  o = `**${o}**`;
1814
3326
  break;
@@ -1822,8 +3334,8 @@ ${this.processNodeContent(e)}
1822
3334
  o = `\`${o}\``;
1823
3335
  break;
1824
3336
  case "link": {
1825
- const i = ((s = r.attrs) == null ? void 0 : s.href) || "";
1826
- o = `[${o}](${i})`;
3337
+ const r = ((s = i.attrs) == null ? void 0 : s.href) || "";
3338
+ o = `[${o}](${r})`;
1827
3339
  break;
1828
3340
  }
1829
3341
  }
@@ -1846,33 +3358,33 @@ ${this.processNodeContent(e)}
1846
3358
  },
1847
3359
  // eslint-disable-next-line complexity
1848
3360
  extensions() {
1849
- const e = [ge, Se, Ie, ke];
1850
- e.push(this.useDivTags ? Ht : z), this.allowBold && e.push(be), this.allowBlockquote && e.push(he), this.allowBulletList && (e.push(we), e.push(Ce.extend({
3361
+ const t = [gn, Ln, yn, vn];
3362
+ t.push(this.useDivTags ? Ui : me), this.allowBold && t.push(xn), this.allowBlockquote && t.push(fn), this.allowBulletList && (t.push(Tn), t.push(_n.extend({
1851
3363
  renderText({ node: n }) {
1852
3364
  return n.textContent;
1853
3365
  }
1854
- })), e.push(Ee)), this.allowItalic && e.push(Te), this.allowStrike && e.push(Le), this.allowUnderline && e.push(ve), this.placeholder && e.push(
1855
- ye.configure({ placeholder: this.placeholder })
3366
+ })), t.push(kn)), this.allowItalic && t.push(Cn), this.allowStrike && t.push(En), this.allowUnderline && t.push(Sn), this.placeholder && t.push(
3367
+ wn.configure({ placeholder: this.placeholder })
1856
3368
  );
1857
- const t = this, o = me.create({
3369
+ const e = this, o = en.create({
1858
3370
  addKeyboardShortcuts() {
1859
3371
  return {
1860
- "Shift-Enter": ({ editor: n }) => t.allowLineBreaks ? !1 : (n.commands.first(({ commands: r }) => [
1861
- () => r.newlineInCode(),
1862
- () => t.allowBulletList && r.splitListItem("listItem"),
1863
- () => r.createParagraphNear(),
1864
- () => r.liftEmptyBlock(),
1865
- () => r.splitBlock()
3372
+ "Shift-Enter": ({ editor: n }) => e.allowLineBreaks ? !1 : (n.commands.first(({ commands: i }) => [
3373
+ () => i.newlineInCode(),
3374
+ () => e.allowBulletList && i.splitListItem("listItem"),
3375
+ () => i.createParagraphNear(),
3376
+ () => i.liftEmptyBlock(),
3377
+ () => i.splitBlock()
1866
3378
  ]), !0),
1867
- Enter: () => t.allowLineBreaks ? !1 : (t.$emit("enter"), !0)
3379
+ Enter: () => e.allowLineBreaks ? !1 : (e.$emit("enter"), !0)
1868
3380
  };
1869
3381
  }
1870
3382
  });
1871
- if (e.push(o), this.link && e.push(xe.extend({
3383
+ if (t.push(o), this.link && t.push(On.extend({
1872
3384
  inclusive: !1,
1873
3385
  addKeyboardShortcuts() {
1874
3386
  return {
1875
- "Mod-k": () => (t.$emit("edit-link"), !0)
3387
+ "Mod-k": () => (e.$emit("edit-link"), !0)
1876
3388
  };
1877
3389
  }
1878
3390
  }).configure({
@@ -1881,29 +3393,29 @@ ${this.processNodeContent(e)}
1881
3393
  },
1882
3394
  openOnClick: !1,
1883
3395
  autolink: !0,
1884
- protocols: F
1885
- })), this.customLink && e.push(this.getExtension(Dt, this.customLink)), this.mentionSuggestion) {
1886
- const n = { ...this.mentionSuggestion, ...dn };
1887
- e.push(Kt.configure({ suggestion: n }));
3396
+ protocols: Ft
3397
+ })), this.customLink && t.push(this.getExtension(Ni, this.customLink)), this.mentionSuggestion) {
3398
+ const n = { ...this.mentionSuggestion, ...us };
3399
+ t.push(Fi.configure({ suggestion: n }));
1888
3400
  }
1889
3401
  if (this.channelSuggestion) {
1890
- const n = { ...this.channelSuggestion, ...pn };
1891
- e.push(Wt.configure({ suggestion: n }));
3402
+ const n = { ...this.channelSuggestion, ...ms };
3403
+ t.push(Xi.configure({ suggestion: n }));
1892
3404
  }
1893
3405
  if (this.slashCommandSuggestion) {
1894
- const n = { ...this.slashCommandSuggestion, ...wn };
1895
- e.push(Yt.configure({
3406
+ const n = { ...this.slashCommandSuggestion, ...Ts };
3407
+ t.push(Qi.configure({
1896
3408
  suggestion: n,
1897
- onSelectedCommand: (r) => {
1898
- this.$emit("selected-command", r);
3409
+ onSelectedCommand: (i) => {
3410
+ this.$emit("selected-command", i);
1899
3411
  }
1900
3412
  }));
1901
3413
  }
1902
- return this.allowVariable && e.push(nn.configure({
3414
+ return this.allowVariable && t.push(is.configure({
1903
3415
  variableItems: this.variableItems
1904
- })), e.push(St), e.push($e.configure({
3416
+ })), t.push(Ii), t.push(In.configure({
1905
3417
  types: ["paragraph"]
1906
- })), this.allowCode && e.push(fe), this.allowCodeblock && e.push(pe.extend({
3418
+ })), this.allowCode && t.push(mn), this.allowCodeblock && t.push(pn.extend({
1907
3419
  renderText({ node: n }) {
1908
3420
  return `\`\`\`
1909
3421
  ${n.textContent}
@@ -1913,15 +3425,21 @@ ${n.textContent}
1913
3425
  HTMLAttributes: {
1914
3426
  class: "d-rich-text-editor__code-block"
1915
3427
  }
1916
- })), this.allowInlineImages && e.push(Ot), (this.allowFontFamily || this.allowFontColor) && (e.push(Ne), this.allowFontColor && e.push(De), this.allowFontFamily && e.push(Oe)), this.additionalExtensions.length && e.push(...this.additionalExtensions), this.allowTables && e.push(Ae.configure({ resizable: !0 }), Be, Me, Re, _e), e;
3428
+ })), this.allowInlineImages && t.push(Pi), (this.allowFontFamily || this.allowFontColor) && t.push(Hn.configure({
3429
+ color: this.allowFontColor,
3430
+ backgroundColor: !1,
3431
+ fontFamily: this.allowFontFamily,
3432
+ fontSize: !1,
3433
+ lineHeight: !1
3434
+ })), this.additionalExtensions.length && t.push(...this.additionalExtensions), this.allowTables && t.push(Dn.configure({ resizable: !0 }), An, Rn, Mn, bn), t;
1917
3435
  },
1918
3436
  inputAttrs() {
1919
- const e = {
3437
+ const t = {
1920
3438
  "aria-label": this.inputAriaLabel,
1921
3439
  "aria-multiline": !0,
1922
3440
  role: "textbox"
1923
3441
  };
1924
- return this.editable || (e["aria-readonly"] = !0), e;
3442
+ return this.editable || (t["aria-readonly"] = !0), t;
1925
3443
  }
1926
3444
  },
1927
3445
  /**
@@ -1930,20 +3448,20 @@ ${n.textContent}
1930
3448
  * to be hooked up to the Editor's own API.
1931
3449
  */
1932
3450
  watch: {
1933
- editable(e) {
1934
- this.editor.setEditable(e), this.updateEditorAttributes({ "aria-readonly": !e });
3451
+ editable(t) {
3452
+ this.editor.setEditable(t), this.updateEditorAttributes({ "aria-readonly": !t });
1935
3453
  },
1936
- inputClass(e) {
1937
- this.updateEditorAttributes({ class: e });
3454
+ inputClass(t) {
3455
+ this.updateEditorAttributes({ class: t });
1938
3456
  },
1939
- inputAriaLabel(e) {
1940
- this.updateEditorAttributes({ "aria-label": e });
3457
+ inputAriaLabel(t) {
3458
+ this.updateEditorAttributes({ "aria-label": t });
1941
3459
  },
1942
3460
  extensions() {
1943
3461
  this.destroyEditor(), this.createEditor();
1944
3462
  },
1945
- modelValue(e) {
1946
- this.processValue(e);
3463
+ modelValue(t) {
3464
+ this.processValue(t);
1947
3465
  }
1948
3466
  },
1949
3467
  created() {
@@ -1953,15 +3471,16 @@ ${n.textContent}
1953
3471
  this.destroyEditor();
1954
3472
  },
1955
3473
  mounted() {
1956
- Ze(K(this.$el), this.$options.name), this.processValue(this.modelValue, !1);
3474
+ Fn(zt(this.$el), this.$options.name), this.processValue(this.modelValue, !1);
1957
3475
  },
1958
3476
  methods: {
1959
3477
  createEditor() {
1960
- this.editor = new re({
3478
+ this.editor = new Fe({
1961
3479
  autofocus: this.autoFocus,
1962
3480
  content: this.modelValue,
1963
3481
  editable: this.editable,
1964
3482
  extensions: this.extensions,
3483
+ shouldRerenderOnTransaction: !1,
1965
3484
  parseOptions: {
1966
3485
  preserveWhitespace: "full"
1967
3486
  },
@@ -1970,151 +3489,152 @@ ${n.textContent}
1970
3489
  ...this.inputAttrs,
1971
3490
  class: this.inputClass
1972
3491
  },
1973
- handleKeyDown: (e, t) => {
3492
+ handleKeyDown: (t, e) => {
1974
3493
  if (!this.preventTyping) return !1;
1975
3494
  const o = ["Backspace"];
1976
- return !this.allowLineBreaks && !t.shiftKey && o.push("Enter"), !o.includes(t.key);
3495
+ return !this.allowLineBreaks && !e.shiftKey && o.push("Enter"), !o.includes(e.key);
1977
3496
  },
1978
- handlePaste: (e, t) => {
1979
- const o = t.clipboardData || window.clipboardData, n = o.getData("text/plain"), r = o.getData("text/html");
1980
- return this.processPasteData(e, n, r);
3497
+ handlePaste: (t, e) => {
3498
+ const o = e.clipboardData || window.clipboardData, n = o.getData("text/plain"), i = o.getData("text/html");
3499
+ return this.processPasteData(t, n, i);
1981
3500
  },
1982
3501
  // Moves the <br /> tags inside the previous closing tag to avoid
1983
3502
  // Prosemirror wrapping them within another </p> tag.
1984
- transformPastedHTML(e) {
1985
- return e.replace(/(<\/\w+>)((<br \/>)+)/g, "$2$3$1");
3503
+ transformPastedHTML(t) {
3504
+ return t.replace(/(<\/\w+>)((<br \/>)+)/g, "$2$3$1");
1986
3505
  }
1987
3506
  }
1988
3507
  }), this.addEditorListeners();
1989
3508
  },
1990
- bubbleMenuShouldShow({ editor: e }) {
1991
- return e.isActive("link");
3509
+ bubbleMenuShouldShow({ editor: t }) {
3510
+ return t.isActive("link");
1992
3511
  },
1993
3512
  /**
1994
3513
  * If the selection contains a link, return the existing link text.
1995
3514
  * Otherwise, use just the selected text.
1996
3515
  * @param editor the editor instance.
1997
3516
  */
1998
- getSelectedLinkText(e) {
1999
- var a, c, h;
2000
- const { view: t, state: o } = e, { from: n, to: r } = t.state.selection, s = o.doc.textBetween(n, r, ""), i = this.editor.state.doc.nodeAt(n);
2001
- return i && ((h = (c = (a = i.marks) == null ? void 0 : a.at(0)) == null ? void 0 : c.type) == null ? void 0 : h.name) === "link" ? i.textContent : s;
3517
+ getSelectedLinkText(t) {
3518
+ var a, l, u;
3519
+ const { view: e, state: o } = t, { from: n, to: i } = e.state.selection, s = o.doc.textBetween(n, i, ""), r = this.editor.state.doc.nodeAt(n);
3520
+ return r && ((u = (l = (a = r.marks) == null ? void 0 : a.at(0)) == null ? void 0 : l.type) == null ? void 0 : u.name) === "link" ? r.textContent : s;
2002
3521
  },
2003
3522
  editLink() {
2004
- const e = this.getSelectedLinkText(this.editor), t = {
3523
+ const t = this.getSelectedLinkText(this.editor), e = {
2005
3524
  href: this.editor.getAttributes("link").href,
2006
- text: e
3525
+ text: t
2007
3526
  };
2008
- this.$emit("edit-link", t);
3527
+ this.$emit("edit-link", e);
2009
3528
  },
2010
3529
  removeLink() {
2011
- var e, t, o, n;
2012
- (n = (o = (t = (e = this.editor) == null ? void 0 : e.chain()) == null ? void 0 : t.focus()) == null ? void 0 : o.unsetLink()) == null || n.run();
3530
+ var t, e, o, n;
3531
+ (n = (o = (e = (t = this.editor) == null ? void 0 : t.chain()) == null ? void 0 : e.focus()) == null ? void 0 : o.unsetLink()) == null || n.run();
2013
3532
  },
2014
3533
  openLink() {
2015
- var t, o;
2016
- (o = (t = this.editor) == null ? void 0 : t.chain()) == null || o.focus();
2017
- const e = this.editor.getAttributes("link").href;
2018
- window.open(e, "_blank");
2019
- },
2020
- setLink(e, t, o, n = F, r) {
2021
- var a, c, h;
2022
- if (!e) {
3534
+ var e, o;
3535
+ (o = (e = this.editor) == null ? void 0 : e.chain()) == null || o.focus();
3536
+ const t = this.editor.getAttributes("link").href;
3537
+ window.open(t, "_blank");
3538
+ },
3539
+ setLink(t, e, o, n = Ft, i) {
3540
+ var a, l, u;
3541
+ if (!t) {
2023
3542
  this.removeLink();
2024
3543
  return;
2025
3544
  }
2026
- n.find((_) => _.test(e)) || (e = `${r}${e}`), this.editor.chain().focus().extendMarkRange("link").run();
2027
- const i = (h = (c = (a = this.editor) == null ? void 0 : a.view) == null ? void 0 : c.state) == null ? void 0 : h.selection;
2028
- this.editor.chain().focus().insertContent(t).setTextSelection({ from: i.from, to: i.from + t.length }).setLink({ href: e, class: o.class }).run();
3545
+ n.find((d) => d.test(t)) || (t = `${i}${t}`), this.editor.chain().focus().extendMarkRange("link").run();
3546
+ const r = (u = (l = (a = this.editor) == null ? void 0 : a.view) == null ? void 0 : l.state) == null ? void 0 : u.selection;
3547
+ this.editor.chain().focus().insertContent(e).setTextSelection({ from: r.from, to: r.from + e.length }).setLink({ href: t, class: o.class }).run();
2029
3548
  },
2030
- processValue(e, t = !0) {
3549
+ processValue(t, e = !0) {
3550
+ if (!this.editor) return;
2031
3551
  const o = this.getOutput();
2032
- if (!(t && dt(e, o))) {
2033
- if (typeof e == "string" && this.outputFormat === "text") {
2034
- const n = new RegExp(`(${X})`, "g");
2035
- e = e == null ? void 0 : e.replace(n, '<emoji-component code="$1"></emoji-component>');
3552
+ if (!(e && eo(t, o))) {
3553
+ if (typeof t == "string" && this.outputFormat === "text") {
3554
+ const n = new RegExp(`(${ge})`, "g");
3555
+ t = t == null ? void 0 : t.replace(n, '<emoji-component code="$1"></emoji-component>');
2036
3556
  }
2037
- this.editor.commands.setContent(e, !1, { preserveWhitespace: "full" });
3557
+ this.editor.commands.setContent(t, { emitUpdate: !1, parseOptions: { preserveWhitespace: "full" } });
2038
3558
  }
2039
3559
  },
2040
3560
  destroyEditor() {
2041
3561
  this.editor.destroy();
2042
3562
  },
2043
- insertPlainTextWithHardBreaks(e, t) {
2044
- const r = (this.pasteRichText ? t : t.replace(/\r\n/g, `
3563
+ insertPlainTextWithHardBreaks(t, e) {
3564
+ const i = (this.pasteRichText ? e : e.replace(/\r\n/g, `
2045
3565
  `).replace(/\n\n/g, `
2046
3566
  `)).replace(/[\r\n]+$/, "").split(/\r?\n/), s = [];
2047
- for (let i = 0; i < r.length; i++)
2048
- i > 0 && s.push({ type: "hardBreak" }), r[i] && s.push({ type: "text", text: r[i] });
3567
+ for (let r = 0; r < i.length; r++)
3568
+ r > 0 && s.push({ type: "hardBreak" }), i[r] && s.push({ type: "text", text: i[r] });
2049
3569
  this.editor.chain().focus().insertContent(s).run();
2050
3570
  },
2051
- shouldPreserveLineBreaks(e, t) {
2052
- return this.pasteRichText ? !t && e && this.hasBlankLines(e) : !!e;
3571
+ shouldPreserveLineBreaks(t, e) {
3572
+ return this.pasteRichText ? !e && t && this.hasBlankLines(t) : !!t;
2053
3573
  },
2054
- processPasteData(e, t, o) {
2055
- if (this.shouldPreserveLineBreaks(t, o))
2056
- return this.insertPlainTextWithHardBreaks(e, t), !0;
3574
+ processPasteData(t, e, o) {
3575
+ if (this.shouldPreserveLineBreaks(e, o))
3576
+ return this.insertPlainTextWithHardBreaks(t, e), !0;
2057
3577
  if (this.shouldHandlePreformattedHTML(o)) {
2058
3578
  const n = this.extractPreformattedText(o);
2059
3579
  if (n && n.includes(`
2060
3580
  `))
2061
- return this.insertPlainTextWithHardBreaks(e, n), !0;
3581
+ return this.insertPlainTextWithHardBreaks(t, n), !0;
2062
3582
  }
2063
3583
  return !1;
2064
3584
  },
2065
- shouldHandlePreformattedHTML(e) {
2066
- return this.pasteRichText && e && this.containsPreformattedContent(e);
3585
+ shouldHandlePreformattedHTML(t) {
3586
+ return this.pasteRichText && t && this.containsPreformattedContent(t);
2067
3587
  },
2068
- containsPreformattedContent(e) {
2069
- const t = document.createElement("div");
2070
- t.innerHTML = e;
2071
- const o = t.querySelectorAll("*");
3588
+ containsPreformattedContent(t) {
3589
+ const e = document.createElement("div");
3590
+ e.innerHTML = t;
3591
+ const o = e.querySelectorAll("*");
2072
3592
  for (const n of o)
2073
3593
  if (this.hasPreWhitespace(n) && this.hasLineBreaks(n))
2074
3594
  return !0;
2075
3595
  return !1;
2076
3596
  },
2077
- hasPreWhitespace(e) {
2078
- const t = e.getAttribute("style") || "", o = e.style.whiteSpace || "", n = o === "pre" || o === "pre-wrap", r = t.includes("white-space: pre");
2079
- return n || r;
3597
+ hasPreWhitespace(t) {
3598
+ const e = t.getAttribute("style") || "", o = t.style.whiteSpace || "", n = o === "pre" || o === "pre-wrap", i = e.includes("white-space: pre");
3599
+ return n || i;
2080
3600
  },
2081
- hasLineBreaks(e) {
2082
- return e.textContent && e.textContent.includes(`
3601
+ hasLineBreaks(t) {
3602
+ return t.textContent && t.textContent.includes(`
2083
3603
  `);
2084
3604
  },
2085
- hasBlankLines(e) {
2086
- return e.includes(`
3605
+ hasBlankLines(t) {
3606
+ return t.includes(`
2087
3607
 
2088
- `) || /\n\s*\n/.test(e);
2089
- },
2090
- extractPreformattedText(e) {
2091
- const t = document.createElement("div");
2092
- return t.innerHTML = e, this.walkAndExtractText(t);
2093
- },
2094
- walkAndExtractText(e) {
2095
- let t = "";
2096
- if (e.nodeType === Node.TEXT_NODE)
2097
- t += e.textContent;
2098
- else if (e.nodeType === Node.ELEMENT_NODE)
2099
- if (this.hasPreWhitespace(e))
2100
- t += e.textContent;
3608
+ `) || /\n\s*\n/.test(t);
3609
+ },
3610
+ extractPreformattedText(t) {
3611
+ const e = document.createElement("div");
3612
+ return e.innerHTML = t, this.walkAndExtractText(e);
3613
+ },
3614
+ walkAndExtractText(t) {
3615
+ let e = "";
3616
+ if (t.nodeType === Node.TEXT_NODE)
3617
+ e += t.textContent;
3618
+ else if (t.nodeType === Node.ELEMENT_NODE)
3619
+ if (this.hasPreWhitespace(t))
3620
+ e += t.textContent;
2101
3621
  else
2102
- for (const o of e.childNodes)
2103
- t += this.walkAndExtractText(o);
2104
- return t;
3622
+ for (const o of t.childNodes)
3623
+ e += this.walkAndExtractText(o);
3624
+ return e;
2105
3625
  },
2106
3626
  triggerInputChangeEvents() {
2107
- const e = this.getOutput();
2108
- this.$emit("input", e), this.$emit("update:modelValue", e);
2109
- const t = this.editor.getJSON();
2110
- this.$emit("json-input", t);
3627
+ const t = this.getOutput();
3628
+ this.$emit("input", t), this.$emit("update:modelValue", t);
3629
+ const e = this.editor.getJSON();
3630
+ this.$emit("json-input", e);
2111
3631
  const o = this.editor.getHTML();
2112
3632
  this.$emit("html-input", o);
2113
3633
  const n = this.editor.getText({ blockSeparator: `
2114
3634
  ` });
2115
3635
  this.$emit("text-input", n);
2116
- const r = this.jsonToMarkdownConverter.convertToMarkdown(t);
2117
- this.$emit("markdown-input", r);
3636
+ const i = this.jsonToMarkdownConverter.convertToMarkdown(e);
3637
+ this.$emit("markdown-input", i);
2118
3638
  },
2119
3639
  /**
2120
3640
  * The Editor exposes event hooks that we have to map our emits into. See
@@ -2125,16 +3645,16 @@ ${n.textContent}
2125
3645
  this.triggerInputChangeEvents();
2126
3646
  }), this.editor.on("update", () => {
2127
3647
  this.triggerInputChangeEvents();
2128
- }), this.editor.on("selectionUpdate", ({ editor: e }) => {
2129
- this.$emit("selected", this.getSelectedLinkText(e));
2130
- }), this.editor.on("focus", ({ event: e }) => {
2131
- this.$emit("focus", e);
2132
- }), this.editor.on("blur", ({ event: e }) => {
2133
- this.$emit("blur", e);
2134
- }), this.editor.on("mention-click", (e) => {
2135
- this.$emit("mention-click", e);
2136
- }), this.editor.on("channel-click", (e) => {
2137
- this.$emit("channel-click", e);
3648
+ }), this.editor.on("selectionUpdate", ({ editor: t }) => {
3649
+ this.$emit("selected", this.getSelectedLinkText(t));
3650
+ }), this.editor.on("focus", ({ event: t }) => {
3651
+ this.$emit("focus", t);
3652
+ }), this.editor.on("blur", ({ event: t }) => {
3653
+ this.$emit("blur", t);
3654
+ }), this.editor.on("mention-click", (t) => {
3655
+ this.$emit("mention-click", t);
3656
+ }), this.editor.on("channel-click", (t) => {
3657
+ this.$emit("channel-click", t);
2138
3658
  });
2139
3659
  },
2140
3660
  getOutput() {
@@ -2151,17 +3671,17 @@ ${n.textContent}
2151
3671
  ` });
2152
3672
  }
2153
3673
  },
2154
- getExtension(e, t) {
3674
+ getExtension(t, e) {
2155
3675
  var o;
2156
- return typeof t == "boolean" ? e : (o = e.configure) == null ? void 0 : o.call(e, t);
3676
+ return typeof e == "boolean" ? t : (o = t.configure) == null ? void 0 : o.call(t, e);
2157
3677
  },
2158
- updateEditorAttributes(e) {
3678
+ updateEditorAttributes(t) {
2159
3679
  this.editor.setOptions({
2160
3680
  editorProps: {
2161
3681
  attributes: {
2162
3682
  ...this.inputAttrs,
2163
3683
  class: this.inputClass,
2164
- ...e
3684
+ ...t
2165
3685
  }
2166
3686
  }
2167
3687
  });
@@ -2170,52 +3690,53 @@ ${n.textContent}
2170
3690
  this.editor.commands.focus();
2171
3691
  }
2172
3692
  }
2173
- }, xn = { class: "d-popover__dialog" };
2174
- function Cn(e, t, o, n, r, s) {
2175
- const i = l("dt-button"), a = l("dt-stack"), c = l("bubble-menu"), h = l("editor-content");
2176
- return d(), y("div", null, [
2177
- r.editor && o.link && !o.hideLinkBubbleMenu ? (d(), p(c, {
3693
+ }, ks = { class: "d-popover__dialog" };
3694
+ function Cs(t, e, o, n, i, s) {
3695
+ const r = T("dt-button"), a = T("dt-stack"), l = T("bubble-menu"), u = T("editor-content");
3696
+ return k(), et("div", null, [
3697
+ i.editor && o.link && !o.hideLinkBubbleMenu ? (k(), M(l, {
2178
3698
  key: 0,
2179
- editor: r.editor,
3699
+ editor: i.editor,
2180
3700
  "should-show": s.bubbleMenuShouldShow,
2181
- "tippy-options": r.tippyOptions,
3701
+ options: i.floatingOptions,
3702
+ "append-to": i.appendTo,
2182
3703
  style: { visibility: "visible" }
2183
3704
  }, {
2184
- default: u(() => [
2185
- b("div", xn, [
2186
- m(a, {
3705
+ default: C(() => [
3706
+ nt("div", ks, [
3707
+ I(a, {
2187
3708
  direction: "row",
2188
3709
  class: "d-rich-text-editor-bubble-menu__button-stack",
2189
3710
  gap: "0"
2190
3711
  }, {
2191
- default: u(() => [
2192
- m(i, {
3712
+ default: C(() => [
3713
+ I(r, {
2193
3714
  kind: "muted",
2194
3715
  importance: "clear",
2195
3716
  onClick: s.editLink
2196
3717
  }, {
2197
- default: u(() => [
2198
- C(f(r.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL")), 1)
3718
+ default: C(() => [
3719
+ at($(i.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL")), 1)
2199
3720
  ]),
2200
3721
  _: 1
2201
3722
  }, 8, ["onClick"]),
2202
- m(i, {
3723
+ I(r, {
2203
3724
  kind: "muted",
2204
3725
  importance: "clear",
2205
3726
  onClick: s.openLink
2206
3727
  }, {
2207
- default: u(() => [
2208
- C(f(r.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL")), 1)
3728
+ default: C(() => [
3729
+ at($(i.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL")), 1)
2209
3730
  ]),
2210
3731
  _: 1
2211
3732
  }, 8, ["onClick"]),
2212
- m(i, {
3733
+ I(r, {
2213
3734
  kind: "danger",
2214
3735
  importance: "clear",
2215
3736
  onClick: s.removeLink
2216
3737
  }, {
2217
- default: u(() => [
2218
- C(f(r.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL")), 1)
3738
+ default: C(() => [
3739
+ at($(i.i18n.$t("DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL")), 1)
2219
3740
  ]),
2220
3741
  _: 1
2221
3742
  }, 8, ["onClick"])
@@ -2225,17 +3746,17 @@ function Cn(e, t, o, n, r, s) {
2225
3746
  ])
2226
3747
  ]),
2227
3748
  _: 1
2228
- }, 8, ["editor", "should-show", "tippy-options"])) : w("", !0),
2229
- m(h, J({
3749
+ }, 8, ["editor", "should-show", "options", "append-to"])) : it("", !0),
3750
+ I(u, pe({
2230
3751
  ref: "editor",
2231
- editor: r.editor,
3752
+ editor: i.editor,
2232
3753
  class: "d-rich-text-editor",
2233
3754
  "data-qa": "dt-rich-text-editor"
2234
3755
  }, s.attrs), null, 16, ["editor"])
2235
3756
  ]);
2236
3757
  }
2237
- const Eo = /* @__PURE__ */ g(Tn, [["render", Cn]]);
3758
+ const gr = /* @__PURE__ */ q(_s, [["render", Cs]]);
2238
3759
  export {
2239
- Eo as default
3760
+ gr as default
2240
3761
  };
2241
3762
  //# sourceMappingURL=rich-text-editor.js.map