@editora/core 1.0.22 → 1.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/README.md +247 -243
  2. package/dist/{A11yCheckerPlugin.native-qW_njhLY.mjs → A11yCheckerPlugin.native-BBCsR5Ur.mjs} +7 -5
  3. package/dist/{AnchorPlugin.native-Drmxhy98.mjs → AnchorPlugin.native-Dk9R26cF.mjs} +20 -19
  4. package/dist/{ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs → ApprovalWorkflowPlugin.native-AeJsehXM.mjs} +56 -55
  5. package/dist/{BackgroundColorPlugin.native-H3XyYD7_.mjs → BackgroundColorPlugin.native-DCAd94kp.mjs} +103 -98
  6. package/dist/{BlocksLibraryPlugin.native-CownM6Rk.mjs → BlocksLibraryPlugin.native-D9OPcnQV.mjs} +42 -43
  7. package/dist/{CitationsPlugin.native-C_7wWQ-k.mjs → CitationsPlugin.native-BFChgCSV.mjs} +51 -51
  8. package/dist/{CodePlugin.native-CAHk9ecG.mjs → CodePlugin.native-BRBEIqY7.mjs} +167 -113
  9. package/dist/{CodePlugin.native-DZgIez08.mjs → CodePlugin.native-CPfKDrkr.mjs} +1383 -1094
  10. package/dist/{CodeSamplePlugin.native-svbAFWh_.mjs → CodeSamplePlugin.native-Bai8bgl3.mjs} +5 -5
  11. package/dist/{CommentsPlugin.native-DncTHiEe.mjs → CommentsPlugin.native-DHCDUm9f.mjs} +161 -141
  12. package/dist/{ConditionalContentPlugin.native-Bf7XgRSW.mjs → ConditionalContentPlugin.native-B3R6xcqn.mjs} +3 -3
  13. package/dist/{ContentRulesPlugin.native-vPx5nC73.mjs → ContentRulesPlugin.native-BISqhQKJ.mjs} +52 -52
  14. package/dist/{DataBindingPlugin.native-B7lpI_0c.mjs → DataBindingPlugin.native-DbaDeXNp.mjs} +37 -37
  15. package/dist/{DocumentManagerPlugin.native-B8K-Oqom.mjs → DocumentManagerPlugin.native-tZqIa9o5.mjs} +21 -20
  16. package/dist/{EmbedIframePlugin.native-BfZ_HGlV.mjs → EmbedIframePlugin.native-qHMf1Jtg.mjs} +7 -7
  17. package/dist/{EmojisPlugin.native-D92aaOKi.mjs → EmojisPlugin.native-B64efKg5.mjs} +4 -4
  18. package/dist/{FormatPainterPlugin.native-BhjzsiVq.mjs → FormatPainterPlugin.native-CAc1N6xU.mjs} +183 -161
  19. package/dist/{HeadingPlugin.native-DZdvubrQ.mjs → HeadingPlugin.native-C3YiGERx.mjs} +85 -72
  20. package/dist/HistoryPlugin.native-C8GyxsgC.mjs +330 -0
  21. package/dist/{LinkPlugin.native-BsQXYsK6.mjs → LinkPlugin.native-Dt_p6Ukb.mjs} +4 -4
  22. package/dist/ListPlugin.native-UYaoRiub.mjs +239 -0
  23. package/dist/{MathPlugin.native-Byo3WL0f.mjs → MathPlugin.native-Cq9WQ7cq.mjs} +148 -130
  24. package/dist/MediaManagerPlugin.native-BjrEarV6.mjs +1161 -0
  25. package/dist/{MediaManagerPlugin.native-BT1NZIJS.mjs → MediaManagerPlugin.native-CRi24Mrb.mjs} +340 -281
  26. package/dist/{MentionPlugin.native-S_lwGZQO.mjs → MentionPlugin.native-Zb1dwdxU.mjs} +304 -300
  27. package/dist/{MergeTagPlugin.native-7-6F3S1Y.mjs → MergeTagPlugin.native-BXkVPvCo.mjs} +6 -4
  28. package/dist/{PIIRedactionPlugin.native-g7j4jOmm.mjs → PIIRedactionPlugin.native-Cm0bpzQb.mjs} +2 -2
  29. package/dist/{PreviewPlugin.native-Dv5OsffK.mjs → PreviewPlugin.native-CrfiwP2J.mjs} +2 -2
  30. package/dist/{SlashCommandsPlugin.native-BDIIwGNs.mjs → SlashCommandsPlugin.native-BzGTRmMB.mjs} +264 -240
  31. package/dist/{SmartPastePlugin.native-BATLCds5.mjs → SmartPastePlugin.native-DnOJhDsf.mjs} +2 -2
  32. package/dist/{SpecialCharactersPlugin.native-CdZoc1GB.mjs → SpecialCharactersPlugin.native-B0XaCfjZ.mjs} +4 -4
  33. package/dist/{SpellCheckPlugin.native-BGm2qPfn.mjs → SpellCheckPlugin.native-BE7os1Xj.mjs} +302 -265
  34. package/dist/{TablePlugin.native-C1YZ372P.mjs → TablePlugin.native-CWxEFpV8.mjs} +159 -136
  35. package/dist/{TemplatePlugin.native-Dwk8TgxI.mjs → TemplatePlugin.native-OD8Wc1R7.mjs} +6 -4
  36. package/dist/{TextColorPlugin.native-KMZ2uzlq.mjs → TextColorPlugin.native-C2IjioNM.mjs} +75 -71
  37. package/dist/{TranslationWorkflowPlugin.native-CZtG--06.mjs → TranslationWorkflowPlugin.native-BGXVJD9f.mjs} +101 -98
  38. package/dist/{VersionDiffPlugin.native-Ca1fMWUJ.mjs → VersionDiffPlugin.native-DJZIzFSK.mjs} +11 -11
  39. package/dist/anchoredPopover-QN4jNbW1.mjs +134 -0
  40. package/dist/confirmDialog-BP8hZPpX.mjs +112 -0
  41. package/dist/dialogHelpers-Dzn8DHoF.mjs +194 -0
  42. package/dist/{documentManager-BWK_-KJp.mjs → documentManager-8gnG-uG_.mjs} +1728 -1715
  43. package/dist/editora.min.js +21 -21
  44. package/dist/editora.umd.js +10 -10
  45. package/dist/{index-C1sO7DAC.js → index--wO0CZVN.js} +6 -6
  46. package/dist/{index-DGMYWPLx.mjs → index-BICrB5kg.mjs} +397 -326
  47. package/dist/index.cjs.js +1 -1
  48. package/dist/index.esm.js +2 -2
  49. package/dist/katex-DLIObQUm.mjs +11683 -0
  50. package/dist/katex.min--Ws3c9be.mjs +6 -0
  51. package/dist/notify-DCQGpmq-.mjs +60 -0
  52. package/dist/plugin-loader.js +54 -54
  53. package/dist/webcomponent-core.js +305 -234
  54. package/dist/webcomponent-core.min.css +1 -1
  55. package/dist/webcomponent-core.min.js +153 -80
  56. package/dist/webcomponent.cjs.js +1 -1
  57. package/dist/webcomponent.esm.js +1 -1
  58. package/dist/webcomponent.js +631 -560
  59. package/dist/webcomponent.min.css +1 -1
  60. package/dist/webcomponent.min.js +1677 -1328
  61. package/package.json +1 -1
  62. package/dist/HistoryPlugin.native-DPvhks6h.mjs +0 -246
  63. package/dist/ListPlugin.native-Bt0LANbO.mjs +0 -139
  64. package/dist/anchoredPopover-DJFD2oAP.mjs +0 -116
  65. package/dist/dialogHelpers-DBf7WqYH.mjs +0 -40
@@ -1,22 +1,23 @@
1
- const p = ".rte-content, .editora-content", ie = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", w = '.rte-mention[data-mention="true"]', b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', N = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap();
2
- let F = !1, S = !1, T = null, k = 0;
3
- function X(e, n) {
1
+ import { a as T } from "./dialogHelpers-Dzn8DHoF.mjs";
2
+ const g = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", w = '.rte-mention[data-mention="true"]', y = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', R = /* @__PURE__ */ new WeakMap(), A = /* @__PURE__ */ new WeakMap();
3
+ let Q = !1, S = !1, C = null, L = 0;
4
+ function J(e, n) {
4
5
  if (n === e.innerHTML) return;
5
6
  const o = window.execEditorCommand || window.executeEditorCommand;
6
7
  if (typeof o == "function")
7
8
  try {
8
9
  o("recordDomTransaction", e, n, e.innerHTML);
9
- } catch (t) {
10
+ } catch (r) {
10
11
  }
11
12
  }
12
- function J(e) {
13
+ function Z(e) {
13
14
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
14
15
  }
15
16
  function h(e, n) {
16
17
  const o = window.getSelection();
17
18
  o && (o.removeAllRanges(), o.addRange(n), e.focus({ preventScroll: !0 }));
18
19
  }
19
- function A(e, n) {
20
+ function O(e, n) {
20
21
  return e.startContainer === n.startContainer && e.startOffset === n.startOffset && e.endContainer === n.endContainer && e.endOffset === n.endOffset;
21
22
  }
22
23
  function E(e) {
@@ -25,82 +26,82 @@ function E(e) {
25
26
  const o = n.getRangeAt(0);
26
27
  return e.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
27
28
  }
28
- function C(e) {
29
+ function v(e) {
29
30
  Array.from(e.querySelectorAll(w)).forEach((o) => {
30
31
  o.setAttribute("data-mention", "true"), o.setAttribute("contenteditable", "false"), o.setAttribute("spellcheck", "false"), o.setAttribute("draggable", "false"), o.classList.add("rte-mention");
31
32
  });
32
33
  }
33
- function Q(e) {
34
+ function U(e) {
34
35
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
35
36
  }
36
- function ae(e) {
37
- return e.closest(ie) || e;
37
+ function le(e) {
38
+ return e.closest(ae) || e;
38
39
  }
39
- function L(e) {
40
+ function M(e) {
40
41
  return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
41
42
  }
42
- function le(e) {
43
- const n = ae(e);
44
- if (L(n)) return !0;
43
+ function se(e) {
44
+ const n = le(e);
45
+ if (M(n)) return !0;
45
46
  const o = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
46
- return L(o) ? !0 : L(document.documentElement) || L(document.body);
47
+ return M(o) ? !0 : M(document.documentElement) || M(document.body);
47
48
  }
48
- function Z(e, n) {
49
- e.classList.remove("rte-mention-theme-dark"), le(n) && e.classList.add("rte-mention-theme-dark");
49
+ function Y(e, n) {
50
+ e.classList.remove("rte-mention-theme-dark"), se(n) && e.classList.add("rte-mention-theme-dark");
50
51
  }
51
- function se(e) {
52
+ function ce(e) {
52
53
  if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
53
54
  if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
54
- const t = e.editorElement;
55
- if (t.matches(p)) return t;
56
- const r = t.querySelector(p);
57
- if (r instanceof HTMLElement) return r;
55
+ const r = e.editorElement;
56
+ if (r.matches(g)) return r;
57
+ const t = r.querySelector(g);
58
+ if (t instanceof HTMLElement) return t;
58
59
  }
59
60
  const n = window.getSelection();
60
61
  if (n && n.rangeCount > 0) {
61
- const t = n.getRangeAt(0).startContainer, r = t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement, i = r == null ? void 0 : r.closest(p);
62
+ const r = n.getRangeAt(0).startContainer, t = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement, i = t == null ? void 0 : t.closest(g);
62
63
  if (i) return i;
63
64
  }
64
65
  const o = document.activeElement;
65
66
  if (o) {
66
- if (o.matches(p)) return o;
67
- const t = o.closest(p);
68
- if (t) return t;
67
+ if (o.matches(g)) return o;
68
+ const r = o.closest(g);
69
+ if (r) return r;
69
70
  }
70
- return document.querySelector(p);
71
+ return document.querySelector(g);
71
72
  }
72
73
  function x(e) {
73
74
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
74
75
  }
75
- function q(e) {
76
+ function P(e) {
76
77
  return typeof e == "object" && e !== null && !Array.isArray(e);
77
78
  }
78
- function ce(e, n) {
79
- return n ? n.split(".").filter(Boolean).reduce((o, t) => {
80
- if (!(!q(o) && !Array.isArray(o)))
81
- return o[t];
79
+ function ue(e, n) {
80
+ return n ? n.split(".").filter(Boolean).reduce((o, r) => {
81
+ if (!(!P(o) && !Array.isArray(o)))
82
+ return o[r];
82
83
  }, e) : e;
83
84
  }
84
- function ue(e) {
85
+ function de(e) {
85
86
  return e ? /\s|[([{"'`]/.test(e) : !0;
86
87
  }
87
- function de(e) {
88
+ function fe(e) {
88
89
  if (!e.collapsed) return null;
89
90
  const n = e.startContainer, o = e.startOffset;
90
91
  if (n.nodeType === Node.TEXT_NODE) {
91
- const t = n;
92
+ const r = n;
92
93
  return {
93
- node: t,
94
- textBefore: t.data.slice(0, o),
94
+ node: r,
95
+ textBefore: r.data.slice(0, o),
95
96
  caretOffset: o
96
97
  };
97
98
  }
98
99
  if (n.nodeType === Node.ELEMENT_NODE) {
99
- const t = n;
100
+ const r = n;
100
101
  if (o > 0) {
101
- const r = t.childNodes[o - 1];
102
- if (r && r.nodeType === Node.TEXT_NODE) {
103
- const i = r;
102
+ const t = r.childNodes[o - 1];
103
+ if (t && t.nodeType === Node.TEXT_NODE) {
104
+ const i = t;
104
105
  return {
105
106
  node: i,
106
107
  textBefore: i.data,
@@ -111,98 +112,99 @@ function de(e) {
111
112
  }
112
113
  return null;
113
114
  }
114
- function fe(e, n, o) {
115
- let t = -1, r = "";
115
+ function me(e, n, o) {
116
+ let r = -1, t = "";
116
117
  if (n.forEach((a) => {
117
118
  const l = e.lastIndexOf(a);
118
- l > t && (t = l, r = a);
119
- }), t < 0 || !ue(e[t - 1])) return null;
120
- const i = e.slice(t + 1);
119
+ l > r && (r = l, t = a);
120
+ }), r < 0 || !de(e[r - 1])) return null;
121
+ const i = e.slice(r + 1);
121
122
  return /\s/.test(i) || i.length > o ? null : {
122
- trigger: r,
123
+ trigger: t,
123
124
  query: i,
124
- startOffset: t
125
+ startOffset: r
125
126
  };
126
127
  }
127
- function me(e, n) {
128
+ function pe(e, n) {
128
129
  const o = n.cloneRange();
129
130
  o.collapse(!1);
130
- const t = o.getClientRects();
131
- if (t.length > 0)
132
- return t[t.length - 1];
133
- const r = document.createElement("span");
134
- r.textContent = "​", r.style.position = "relative", o.insertNode(r);
135
- const i = r.getBoundingClientRect();
136
- return r.remove(), e.normalize(), i;
137
- }
138
- function ge(e, n) {
131
+ const r = o.getClientRects();
132
+ if (r.length > 0)
133
+ return r[r.length - 1];
134
+ const t = document.createElement("span");
135
+ t.textContent = "​", t.style.position = "relative", o.insertNode(t);
136
+ const i = t.getBoundingClientRect();
137
+ return t.remove(), e.normalize(), i;
138
+ }
139
+ let ge = 0;
140
+ function he(e, n) {
139
141
  if (e.panel && e.list) return;
140
142
  const o = document.createElement("div");
141
143
  o.className = "rte-mention-panel", o.style.display = "none";
142
- const t = document.createElement("div");
143
- t.className = "rte-mention-list", o.appendChild(t), document.body.appendChild(o), Z(o, e.editor), e.panel = o, e.list = t, o.addEventListener("mousedown", (r) => {
144
- r.preventDefault();
145
- }), o.addEventListener("click", (r) => {
146
- const i = r.target;
144
+ const r = document.createElement("div");
145
+ r.className = "rte-mention-list", r.setAttribute("role", "listbox"), r.setAttribute("aria-label", "Mentions"), r.id = `rte-mention-list-${++ge}`, o.appendChild(r), document.body.appendChild(o), Y(o, e.editor), e.panel = o, e.list = r, o.addEventListener("mousedown", (t) => {
146
+ t.preventDefault();
147
+ }), o.addEventListener("click", (t) => {
148
+ const i = t.target;
147
149
  if (!i) return;
148
150
  const a = i.closest(".rte-mention-item");
149
151
  if (!a) return;
150
152
  const l = Number(a.getAttribute("data-index"));
151
- Number.isFinite(l) && ee(e, n, l);
153
+ Number.isFinite(l) && ne(e, n, l);
152
154
  });
153
155
  }
154
156
  function m(e) {
155
- e.panel && (e.debounceHandle !== null && (window.clearTimeout(e.debounceHandle), e.debounceHandle = null), e.abortController && (e.abortController.abort(), e.abortController = null), e.panel.style.display = "none", e.panel.classList.remove("show"), e.isOpen = !1, e.loading = !1, e.items = [], e.activeIndex = 0, e.query = "", e.replaceRange = null);
157
+ e.panel && (e.debounceHandle !== null && (window.clearTimeout(e.debounceHandle), e.debounceHandle = null), e.abortController && (e.abortController.abort(), e.abortController = null), e.panel.style.display = "none", e.panel.classList.remove("show"), e.isOpen = !1, e.loading = !1, e.items = [], e.activeIndex = 0, e.query = "", e.replaceRange = null, T(e.editor, null, null));
156
158
  }
157
- function U(e, n) {
159
+ function W(e, n) {
158
160
  if (!e.panel) return;
159
- Z(e.panel, e.editor);
160
- const o = me(e.editor, n), t = e.panel;
161
- t.style.display = "block", t.classList.add("show"), t.style.left = "0px", t.style.top = "0px";
162
- const r = t.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight, l = Math.max(8, Math.min(o.left, i - r.width - 8));
161
+ Y(e.panel, e.editor);
162
+ const o = pe(e.editor, n), r = e.panel;
163
+ r.style.display = "block", r.classList.add("show"), r.style.left = "0px", r.style.top = "0px";
164
+ const t = r.getBoundingClientRect(), i = window.innerWidth, a = window.innerHeight, l = Math.max(8, Math.min(o.left, i - t.width - 8));
163
165
  let s = o.bottom + 8;
164
- s + r.height > a - 8 && (s = Math.max(8, o.top - r.height - 8)), t.style.position = "fixed", t.style.left = `${l}px`, t.style.top = `${s}px`;
166
+ s + t.height > a - 8 && (s = Math.max(8, o.top - t.height - 8)), r.style.position = "fixed", r.style.left = `${l}px`, r.style.top = `${s}px`;
165
167
  }
166
- function pe(e, n) {
168
+ function be(e, n) {
167
169
  if (!n) return x(e);
168
- const o = e.toLowerCase(), t = n.toLowerCase(), r = o.indexOf(t);
169
- if (r < 0) return x(e);
170
- const i = x(e.slice(0, r)), a = x(e.slice(r, r + n.length)), l = x(e.slice(r + n.length));
170
+ const o = e.toLowerCase(), r = n.toLowerCase(), t = o.indexOf(r);
171
+ if (t < 0) return x(e);
172
+ const i = x(e.slice(0, t)), a = x(e.slice(t, t + n.length)), l = x(e.slice(t + n.length));
171
173
  return `${i}<mark>${a}</mark>${l}`;
172
174
  }
173
- function W(e, n) {
175
+ function G(e, n) {
174
176
  if (!e.list) return;
175
177
  const o = e.list;
176
178
  if (o.innerHTML = "", e.loading) {
177
- const t = document.createElement("div");
178
- t.className = "rte-mention-empty", t.textContent = n.loadingText, o.appendChild(t);
179
+ const r = document.createElement("div");
180
+ r.className = "rte-mention-empty", r.textContent = n.loadingText, o.appendChild(r), T(e.editor, null, null);
179
181
  return;
180
182
  }
181
183
  if (e.items.length === 0) {
182
- const t = document.createElement("div");
183
- t.className = "rte-mention-empty", t.textContent = e.query.length > 0 ? n.noResultsText : n.emptyStateText, o.appendChild(t);
184
+ const r = document.createElement("div");
185
+ r.className = "rte-mention-empty", r.textContent = e.query.length > 0 ? n.noResultsText : n.emptyStateText, o.appendChild(r), T(e.editor, null, null);
184
186
  return;
185
187
  }
186
- e.items.forEach((t, r) => {
188
+ e.items.forEach((r, t) => {
187
189
  const i = document.createElement("button");
188
- i.type = "button", i.className = "rte-mention-item", r === e.activeIndex && i.classList.add("active"), i.setAttribute("data-index", String(r));
189
- const a = n.itemRenderer ? n.itemRenderer(t, e.query) : `<span class="rte-mention-item-label">${pe(t.label, e.query)}</span>${t.meta ? `<span class="rte-mention-item-meta">${x(t.meta)}</span>` : ""}`;
190
+ i.type = "button", i.className = "rte-mention-item", t === e.activeIndex && i.classList.add("active"), i.setAttribute("data-index", String(t)), i.setAttribute("role", "option"), i.id = `${o.id}-${t}`, i.setAttribute("aria-selected", t === e.activeIndex ? "true" : "false");
191
+ const a = n.itemRenderer ? n.itemRenderer(r, e.query) : `<span class="rte-mention-item-label">${be(r.label, e.query)}</span>${r.meta ? `<span class="rte-mention-item-meta">${x(r.meta)}</span>` : ""}`;
190
192
  i.innerHTML = a, o.appendChild(i);
191
- });
193
+ }), T(e.editor, o, o.children[e.activeIndex]);
192
194
  }
193
- function Y(e, n) {
194
- const o = /* @__PURE__ */ new Set(), t = [];
195
- return e.forEach((r) => {
196
- const i = (r.id || "").trim();
197
- !i || o.has(i) || (o.add(i), t.push({
195
+ function ee(e, n) {
196
+ const o = /* @__PURE__ */ new Set(), r = [];
197
+ return e.forEach((t) => {
198
+ const i = (t.id || "").trim();
199
+ !i || o.has(i) || (o.add(i), r.push({
198
200
  id: i,
199
- label: r.label || i,
200
- value: r.value,
201
- meta: r.meta
201
+ label: t.label || i,
202
+ value: t.value,
203
+ meta: t.meta
202
204
  }));
203
- }), t.slice(0, n);
205
+ }), r.slice(0, n);
204
206
  }
205
- function he(e, n) {
207
+ function ye(e, n) {
206
208
  if (e.buildRequest) {
207
209
  const c = e.buildRequest(n);
208
210
  return {
@@ -210,9 +212,9 @@ function he(e, n) {
210
212
  init: c.init || {}
211
213
  };
212
214
  }
213
- const o = (e.method || "GET").toUpperCase(), t = typeof e.headers == "function" ? e.headers(n) : e.headers || {}, r = e.queryParam || "q", i = e.triggerParam || "trigger", a = e.limitParam || "limit", l = e.staticParams || {}, s = {
215
+ const o = (e.method || "GET").toUpperCase(), r = typeof e.headers == "function" ? e.headers(n) : e.headers || {}, t = e.queryParam || "q", i = e.triggerParam || "trigger", a = e.limitParam || "limit", l = e.staticParams || {}, s = {
214
216
  method: o,
215
- headers: { ...t },
217
+ headers: { ...r },
216
218
  credentials: e.credentials,
217
219
  mode: e.mode,
218
220
  cache: e.cache,
@@ -220,192 +222,192 @@ function he(e, n) {
220
222
  }, f = new URL(e.url, window.location.origin);
221
223
  if (o === "GET" || o === "HEAD") {
222
224
  const c = new URLSearchParams(f.search);
223
- Object.entries(l).forEach(([u, g]) => c.set(u, String(g))), c.set(r, n.query), c.set(i, n.trigger), c.set(a, String(n.limit)), f.search = c.toString();
225
+ Object.entries(l).forEach(([u, p]) => c.set(u, String(p))), c.set(t, n.query), c.set(i, n.trigger), c.set(a, String(n.limit)), f.search = c.toString();
224
226
  } else {
225
227
  const c = typeof e.body == "function" ? e.body(n) : e.body, u = {
226
- [r]: n.query,
228
+ [t]: n.query,
227
229
  [i]: n.trigger,
228
230
  [a]: n.limit,
229
231
  ...l
230
- }, g = c != null ? c : u;
231
- if (q(g)) {
232
- s.body = JSON.stringify(g);
233
- const y = s.headers;
234
- !y["Content-Type"] && !y["content-type"] && (y["Content-Type"] = "application/json");
232
+ }, p = c != null ? c : u;
233
+ if (P(p)) {
234
+ s.body = JSON.stringify(p);
235
+ const b = s.headers;
236
+ !b["Content-Type"] && !b["content-type"] && (b["Content-Type"] = "application/json");
235
237
  } else
236
- s.body = g;
238
+ s.body = p;
237
239
  }
238
240
  return { url: f.toString(), init: s };
239
241
  }
240
- async function ye(e, n, o, t) {
242
+ async function Ee(e, n, o, r) {
241
243
  var f, c;
242
- const r = n.api;
243
- if (!r) return [];
244
+ const t = n.api;
245
+ if (!t) return [];
244
246
  e.abortController && e.abortController.abort();
245
247
  const i = new AbortController();
246
248
  e.abortController = i;
247
249
  const a = {
248
250
  query: o,
249
- trigger: t,
251
+ trigger: r,
250
252
  limit: n.maxSuggestions,
251
253
  signal: i.signal
252
- }, l = Math.max(0, (f = r.timeoutMs) != null ? f : 1e4);
254
+ }, l = Math.max(0, (f = t.timeoutMs) != null ? f : 1e4);
253
255
  let s = null;
254
256
  l > 0 && (s = window.setTimeout(() => i.abort(), l));
255
257
  try {
256
- const { url: u, init: g } = he(r, a), y = await fetch(u, {
257
- ...g,
258
+ const { url: u, init: p } = ye(t, a), b = await fetch(u, {
259
+ ...p,
258
260
  signal: i.signal
259
261
  });
260
- if (!y.ok)
261
- throw new Error(`Mention API request failed: ${y.status}`);
262
- const v = (r.responseType || "json") === "text" ? await y.text() : await y.json();
263
- let I = [];
264
- if (r.transformResponse)
265
- I = r.transformResponse(v, a) || [];
262
+ if (!b.ok)
263
+ throw new Error(`Mention API request failed: ${b.status}`);
264
+ const k = (t.responseType || "json") === "text" ? await b.text() : await b.json();
265
+ let H = [];
266
+ if (t.transformResponse)
267
+ H = t.transformResponse(k, a) || [];
266
268
  else {
267
- const P = ce(v, r.responsePath);
268
- I = (Array.isArray(P) ? P : Array.isArray(v) ? v : []).map((d, re) => {
269
- var _, $, B, j, z;
270
- if (r.mapItem)
271
- return r.mapItem(d, re);
272
- if (!q(d)) return null;
273
- const H = String((B = ($ = (_ = d.id) != null ? _ : d.value) != null ? $ : d.key) != null ? B : "").trim();
274
- if (!H) return null;
275
- const oe = String((z = (j = d.label) != null ? j : d.name) != null ? z : H).trim();
269
+ const $ = ue(k, t.responsePath);
270
+ H = (Array.isArray($) ? $ : Array.isArray(k) ? k : []).map((d, oe) => {
271
+ var _, B, j, z, F;
272
+ if (t.mapItem)
273
+ return t.mapItem(d, oe);
274
+ if (!P(d)) return null;
275
+ const D = String((j = (B = (_ = d.id) != null ? _ : d.value) != null ? B : d.key) != null ? j : "").trim();
276
+ if (!D) return null;
277
+ const ie = String((F = (z = d.label) != null ? z : d.name) != null ? F : D).trim();
276
278
  return {
277
- id: H,
278
- label: oe,
279
+ id: D,
280
+ label: ie,
279
281
  value: d.value ? String(d.value) : void 0,
280
282
  meta: d.meta ? String(d.meta) : void 0
281
283
  };
282
284
  }).filter((d) => !!d);
283
285
  }
284
- return Y(I, n.maxSuggestions);
286
+ return ee(H, n.maxSuggestions);
285
287
  } catch (u) {
286
- return (u == null ? void 0 : u.name) !== "AbortError" && ((c = r.onError) == null || c.call(r, u, a)), [];
288
+ return (u == null ? void 0 : u.name) !== "AbortError" && ((c = t.onError) == null || c.call(t, u, a)), [];
287
289
  } finally {
288
290
  s !== null && window.clearTimeout(s), e.abortController === i && (e.abortController = null);
289
291
  }
290
292
  }
291
- async function be(e, n, o, t) {
292
- const r = ++e.requestId;
293
+ async function xe(e, n, o, r) {
294
+ const t = ++e.requestId;
293
295
  let i = [];
294
296
  if (n.search) {
295
- const a = await n.search(o, t);
297
+ const a = await n.search(o, r);
296
298
  i = Array.isArray(a) ? a : [];
297
299
  } else if (n.api)
298
- i = await ye(e, n, o, t);
300
+ i = await Ee(e, n, o, r);
299
301
  else {
300
302
  const a = o.toLowerCase();
301
303
  i = n.items.filter((l) => a ? l.label.toLowerCase().includes(a) || l.id.toLowerCase().includes(a) : !0);
302
304
  }
303
- return r !== e.requestId ? [] : Y(i, n.maxSuggestions);
304
- }
305
- function Ee(e, n, o) {
306
- const t = e.editor;
307
- if (C(t), !window.getSelection()) return !1;
308
- const i = t.innerHTML;
309
- let a = e.replaceRange ? e.replaceRange.cloneRange() : E(t);
310
- if (!a || !t.contains(a.commonAncestorContainer) && (a = E(t), !a))
305
+ return t !== e.requestId ? [] : ee(i, n.maxSuggestions);
306
+ }
307
+ function we(e, n, o) {
308
+ const r = e.editor;
309
+ if (v(r), !window.getSelection()) return !1;
310
+ const i = r.innerHTML;
311
+ let a = e.replaceRange ? e.replaceRange.cloneRange() : E(r);
312
+ if (!a || !r.contains(a.commonAncestorContainer) && (a = E(r), !a))
311
313
  return !1;
312
- const l = O(t, a.cloneRange(), "after");
313
- A(l, a) || (h(t, l), a = l), a.deleteContents();
314
+ const l = I(r, a.cloneRange(), "after");
315
+ O(l, a) || (h(r, l), a = l), a.deleteContents();
314
316
  const s = document.createElement("span");
315
317
  s.className = "rte-mention", s.setAttribute("data-mention", "true"), s.setAttribute("data-mention-id", o.id), s.setAttribute("contenteditable", "false"), s.textContent = o.value || `${e.trigger}${o.label}`, a.insertNode(s);
316
318
  let f = s, c = 1;
317
319
  if (n.insertSpaceAfterMention) {
318
- const g = document.createTextNode(" ");
319
- s.after(g), f = g, c = 1;
320
+ const p = document.createTextNode(" ");
321
+ s.after(p), f = p, c = 1;
320
322
  }
321
323
  const u = document.createRange();
322
- return u.setStart(f, c), u.collapse(!0), h(t, u), m(e), C(t), J(t), X(t, i), !0;
324
+ return u.setStart(f, c), u.collapse(!0), h(r, u), m(e), v(r), Z(r), J(r, i), !0;
323
325
  }
324
- function ee(e, n, o) {
326
+ function ne(e, n, o) {
325
327
  if (o < 0 || o >= e.items.length) return;
326
- const t = e.items[o];
327
- Ee(e, n, t);
328
+ const r = e.items[o];
329
+ we(e, n, r);
328
330
  }
329
- function xe(e) {
331
+ function Te(e) {
330
332
  return e.startContainer !== e.endContainer || e.startContainer.nodeType !== Node.ELEMENT_NODE || e.endOffset - e.startOffset !== 1 ? null : e.startContainer.childNodes[e.startOffset] || null;
331
333
  }
332
- function we(e, n) {
333
- const o = xe(e);
334
+ function Ce(e, n) {
335
+ const o = Te(e);
334
336
  return !(o instanceof HTMLElement) || !o.matches(w) || !n.contains(o) ? null : o;
335
337
  }
336
- function ne(e, n) {
337
- const o = we(e, n);
338
+ function te(e, n) {
339
+ const o = Ce(e, n);
338
340
  if (o) return o;
339
- const t = Q(e.startContainer), r = t == null ? void 0 : t.closest(w);
340
- if (r && n.contains(r)) return r;
341
- const i = Q(e.endContainer), a = i == null ? void 0 : i.closest(w);
341
+ const r = U(e.startContainer), t = r == null ? void 0 : r.closest(w);
342
+ if (t && n.contains(t)) return t;
343
+ const i = U(e.endContainer), a = i == null ? void 0 : i.closest(w);
342
344
  return a && n.contains(a) ? a : null;
343
345
  }
344
- function O(e, n, o = "after") {
345
- const t = ne(n, e);
346
- if (!t) return n;
347
- const r = document.createRange();
348
- return o === "before" ? r.setStartBefore(t) : r.setStartAfter(t), r.collapse(!0), r;
349
- }
350
- function G(e, n, o = "after") {
346
+ function I(e, n, o = "after") {
347
+ const r = te(n, e);
348
+ if (!r) return n;
351
349
  const t = document.createRange();
352
- o === "before" ? t.setStartBefore(n) : t.setStartAfter(n), t.collapse(!0), h(e, t);
350
+ return o === "before" ? t.setStartBefore(r) : t.setStartAfter(r), t.collapse(!0), t;
351
+ }
352
+ function K(e, n, o = "after") {
353
+ const r = document.createRange();
354
+ o === "before" ? r.setStartBefore(n) : r.setStartAfter(n), r.collapse(!0), h(e, r);
353
355
  }
354
- function Te(e, n, o) {
356
+ function ve(e, n, o) {
355
357
  if (!e.collapsed) return null;
356
- const t = e.startContainer, r = e.startOffset;
358
+ const r = e.startContainer, t = e.startOffset;
357
359
  let i = null;
358
- if (t.nodeType === Node.TEXT_NODE) {
359
- const a = t;
360
- n === "backward" && r === 0 ? i = a.previousSibling : n === "forward" && r === a.length && (i = a.nextSibling);
361
- } else if (t.nodeType === Node.ELEMENT_NODE) {
362
- const a = t;
363
- n === "backward" && r > 0 ? i = a.childNodes[r - 1] || null : n === "forward" && r < a.childNodes.length && (i = a.childNodes[r] || null);
360
+ if (r.nodeType === Node.TEXT_NODE) {
361
+ const a = r;
362
+ n === "backward" && t === 0 ? i = a.previousSibling : n === "forward" && t === a.length && (i = a.nextSibling);
363
+ } else if (r.nodeType === Node.ELEMENT_NODE) {
364
+ const a = r;
365
+ n === "backward" && t > 0 ? i = a.childNodes[t - 1] || null : n === "forward" && t < a.childNodes.length && (i = a.childNodes[t] || null);
364
366
  }
365
367
  return !(i instanceof HTMLElement) || !i.matches(w) || !o.contains(i) ? null : i;
366
368
  }
367
- function K(e, n) {
369
+ function V(e, n) {
368
370
  const o = E(e);
369
371
  if (!o) return !1;
370
- const t = Te(o, n, e);
371
- if (!t) return !1;
372
- const r = t.parentNode;
372
+ const r = ve(o, n, e);
373
373
  if (!r) return !1;
374
- const i = e.innerHTML, a = Array.prototype.indexOf.call(r.childNodes, t);
375
- t.remove();
374
+ const t = r.parentNode;
375
+ if (!t) return !1;
376
+ const i = e.innerHTML, a = Array.prototype.indexOf.call(t.childNodes, r);
377
+ r.remove();
376
378
  const l = document.createRange();
377
- return l.setStart(r, Math.max(0, a)), l.collapse(!0), h(e, l), J(e), X(e, i), !0;
379
+ return l.setStart(t, Math.max(0, a)), l.collapse(!0), h(e, l), Z(e), J(e, i), !0;
378
380
  }
379
- function te(e, n, o, t, r, i) {
381
+ function re(e, n, o, r, t, i) {
380
382
  var s;
381
- if (ge(e, n), e.query = t, e.trigger = r, e.replaceRange = i.cloneRange(), e.loading = !!(n.api && !n.search), e.debounceHandle !== null && (window.clearTimeout(e.debounceHandle), e.debounceHandle = null), !e.panel) return;
382
- e.isOpen || (e.panel.style.display = "block", e.panel.classList.add("show"), e.isOpen = !0), W(e, n), U(e, o);
383
+ if (he(e, n), e.query = r, e.trigger = t, e.replaceRange = i.cloneRange(), e.loading = !!(n.api && !n.search), e.debounceHandle !== null && (window.clearTimeout(e.debounceHandle), e.debounceHandle = null), !e.panel) return;
384
+ e.isOpen || (e.panel.style.display = "block", e.panel.classList.add("show"), e.isOpen = !0), G(e, n), W(e, o);
383
385
  const a = () => {
384
- e.debounceHandle = null, be(e, n, t, r).then((f) => {
385
- e.loading = !1, e.items = f, e.activeIndex = 0, e.panel && (W(e, n), U(e, o));
386
+ e.debounceHandle = null, xe(e, n, r, t).then((f) => {
387
+ e.loading = !1, e.items = f, e.activeIndex = 0, e.panel && (G(e, n), W(e, o));
386
388
  });
387
389
  }, l = n.api && !n.search ? Math.max(0, (s = n.api.debounceMs) != null ? s : 180) : 0;
388
390
  l > 0 ? e.debounceHandle = window.setTimeout(a, l) : a();
389
391
  }
390
- function Ce(e, n) {
392
+ function ke(e, n) {
391
393
  const o = e.editor;
392
- C(o);
393
- let t = E(o);
394
- if (!t || !t.collapsed) {
394
+ v(o);
395
+ let r = E(o);
396
+ if (!r || !r.collapsed) {
395
397
  m(e);
396
398
  return;
397
399
  }
398
- const r = O(o, t.cloneRange(), "after");
399
- if (!A(r, t)) {
400
- h(o, r), t = r, m(e);
400
+ const t = I(o, r.cloneRange(), "after");
401
+ if (!O(t, r)) {
402
+ h(o, t), r = t, m(e);
401
403
  return;
402
404
  }
403
- const i = de(t);
405
+ const i = fe(r);
404
406
  if (!i) {
405
407
  m(e);
406
408
  return;
407
409
  }
408
- const a = fe(i.textBefore, n.triggerChars, n.maxQueryLength);
410
+ const a = me(i.textBefore, n.triggerChars, n.maxQueryLength);
409
411
  if (!a) {
410
412
  m(e);
411
413
  return;
@@ -417,19 +419,21 @@ function Ce(e, n) {
417
419
  if (e.dismissedNode === i.node && e.dismissedOffset === a.startOffset)
418
420
  return;
419
421
  e.dismissedNode = null, e.dismissedOffset = -1;
420
- const l = t.cloneRange();
421
- l.setStart(i.node, a.startOffset), l.setEnd(i.node, i.caretOffset), te(e, n, t, a.query, a.trigger, l);
422
+ const l = r.cloneRange();
423
+ l.setStart(i.node, a.startOffset), l.setEnd(i.node, i.caretOffset), re(e, n, r, a.query, a.trigger, l);
422
424
  }
423
- function V(e, n) {
425
+ function X(e, n) {
424
426
  if (e.items.length === 0) return;
425
427
  const o = e.items.length;
426
428
  if (e.activeIndex = ((e.activeIndex + n) % o + o) % o, !e.list) return;
427
- const t = Array.from(e.list.querySelectorAll(".rte-mention-item"));
428
- t.forEach((i, a) => i.classList.toggle("active", a === e.activeIndex));
429
- const r = t[e.activeIndex];
430
- r == null || r.scrollIntoView({ block: "nearest" });
429
+ const r = Array.from(e.list.querySelectorAll(".rte-mention-item"));
430
+ r.forEach((i, a) => {
431
+ i.classList.toggle("active", a === e.activeIndex), i.setAttribute("aria-selected", a === e.activeIndex ? "true" : "false");
432
+ });
433
+ const t = r[e.activeIndex];
434
+ T(e.editor, e.list, t != null ? t : null), t == null || t.scrollIntoView({ block: "nearest" });
431
435
  }
432
- function ve(e) {
436
+ function Le(e) {
433
437
  return {
434
438
  editor: e,
435
439
  panel: null,
@@ -448,104 +452,104 @@ function ve(e) {
448
452
  dismissedOffset: -1
449
453
  };
450
454
  }
451
- function ke(e) {
455
+ function Me(e) {
452
456
  var o;
453
- const n = N.get(e);
454
- n && ((o = n.panel) != null && o.parentNode && n.panel.parentNode.removeChild(n.panel), N.delete(e));
455
- }
456
- function D(e, n, o) {
457
- if (R.has(e)) return;
458
- C(e);
459
- const t = {
460
- beforeInput: (r) => {
461
- C(e);
457
+ const n = R.get(e);
458
+ n && ((o = n.panel) != null && o.parentNode && n.panel.parentNode.removeChild(n.panel), R.delete(e));
459
+ }
460
+ function q(e, n, o) {
461
+ if (A.has(e)) return;
462
+ v(e);
463
+ const r = {
464
+ beforeInput: (t) => {
465
+ v(e);
462
466
  const i = E(e);
463
467
  if (!i) return;
464
- const a = ne(i, e);
468
+ const a = te(i, e);
465
469
  if (!a) return;
466
- const l = r.inputType || "";
470
+ const l = t.inputType || "";
467
471
  if (l.startsWith("insert")) {
468
- if (r.preventDefault(), G(e, a, "after"), l === "insertParagraph" || l === "insertLineBreak") {
472
+ if (t.preventDefault(), K(e, a, "after"), l === "insertParagraph" || l === "insertLineBreak") {
469
473
  const s = l === "insertLineBreak" ? "insertLineBreak" : "insertParagraph";
470
474
  document.execCommand(s, !1);
471
475
  return;
472
476
  }
473
477
  if (l === "insertText" || l === "insertCompositionText") {
474
- const s = r.data || "";
478
+ const s = t.data || "";
475
479
  if (!s) return;
476
480
  document.execCommand("insertText", !1, s);
477
481
  }
478
482
  }
479
483
  },
480
484
  input: () => {
481
- Ce(n, o);
485
+ ke(n, o);
482
486
  },
483
- keydown: (r) => {
487
+ keydown: (t) => {
484
488
  if (n.isOpen) {
485
- if (r.key === "ArrowDown") {
486
- r.preventDefault(), V(n, 1);
489
+ if (t.key === "ArrowDown") {
490
+ t.preventDefault(), X(n, 1);
487
491
  return;
488
492
  }
489
- if (r.key === "ArrowUp") {
490
- r.preventDefault(), V(n, -1);
493
+ if (t.key === "ArrowUp") {
494
+ t.preventDefault(), X(n, -1);
491
495
  return;
492
496
  }
493
- if (r.key === "Enter" || r.key === "Tab") {
494
- r.preventDefault(), ee(n, o, n.activeIndex);
497
+ if (t.key === "Enter" || t.key === "Tab") {
498
+ t.preventDefault(), ne(n, o, n.activeIndex);
495
499
  return;
496
500
  }
497
- if (r.key === "Escape") {
498
- r.preventDefault(), n.replaceRange && (n.dismissedNode = n.replaceRange.startContainer, n.dismissedOffset = n.replaceRange.startOffset), m(n);
501
+ if (t.key === "Escape") {
502
+ t.preventDefault(), n.replaceRange && (n.dismissedNode = n.replaceRange.startContainer, n.dismissedOffset = n.replaceRange.startOffset), m(n);
499
503
  return;
500
504
  }
501
505
  }
502
506
  const i = E(e);
503
507
  if (i) {
504
- const a = O(e, i.cloneRange(), "after");
505
- if (!A(a, i)) {
506
- if (r.key === "Enter") {
507
- r.preventDefault(), h(e, a), document.execCommand("insertParagraph", !1);
508
+ const a = I(e, i.cloneRange(), "after");
509
+ if (!O(a, i)) {
510
+ if (t.key === "Enter") {
511
+ t.preventDefault(), h(e, a), document.execCommand("insertParagraph", !1);
508
512
  return;
509
513
  }
510
- r.key.length === 1 && !r.metaKey && !r.ctrlKey && !r.altKey && h(e, a);
514
+ t.key.length === 1 && !t.metaKey && !t.ctrlKey && !t.altKey && h(e, a);
511
515
  }
512
516
  }
513
- if (r.key === "Backspace" && K(e, "backward")) {
514
- r.preventDefault();
517
+ if (t.key === "Backspace" && V(e, "backward")) {
518
+ t.preventDefault();
515
519
  return;
516
520
  }
517
- if (r.key === "Delete" && K(e, "forward")) {
518
- r.preventDefault();
521
+ if (t.key === "Delete" && V(e, "forward")) {
522
+ t.preventDefault();
519
523
  return;
520
524
  }
521
525
  },
522
- click: (r) => {
523
- const i = r.target;
526
+ click: (t) => {
527
+ const i = t.target;
524
528
  if (!i) return;
525
529
  const a = i.nodeType === Node.ELEMENT_NODE ? i : i.parentElement, l = a == null ? void 0 : a.closest(w);
526
- !l || !e.contains(l) || (r.preventDefault(), r.stopPropagation(), G(e, l, "after"), m(n));
530
+ !l || !e.contains(l) || (t.preventDefault(), t.stopPropagation(), K(e, l, "after"), m(n));
527
531
  },
528
532
  blur: () => {
529
533
  window.setTimeout(() => {
530
- const r = document.activeElement;
531
- n.panel && r && n.panel.contains(r) || m(n);
534
+ const t = document.activeElement;
535
+ n.panel && t && n.panel.contains(t) || m(n);
532
536
  }, 0);
533
537
  },
534
- mousedown: (r) => {
538
+ mousedown: (t) => {
535
539
  if (!n.isOpen || !n.panel) return;
536
- const i = r.target;
540
+ const i = t.target;
537
541
  i && !n.panel.contains(i) && !e.contains(i) && m(n);
538
542
  }
539
543
  };
540
- e.addEventListener("beforeinput", t.beforeInput), e.addEventListener("input", t.input), e.addEventListener("keydown", t.keydown), e.addEventListener("click", t.click), e.addEventListener("blur", t.blur), document.addEventListener("mousedown", t.mousedown, !0), R.set(e, t);
544
+ e.addEventListener("beforeinput", r.beforeInput), e.addEventListener("input", r.input), e.addEventListener("keydown", r.keydown), e.addEventListener("click", r.click), e.addEventListener("blur", r.blur), document.addEventListener("mousedown", r.mousedown, !0), A.set(e, r);
541
545
  }
542
- function Le(e) {
543
- const n = R.get(e);
544
- n && (e.removeEventListener("beforeinput", n.beforeInput), e.removeEventListener("input", n.input), e.removeEventListener("keydown", n.keydown), e.removeEventListener("click", n.click), e.removeEventListener("blur", n.blur), document.removeEventListener("mousedown", n.mousedown, !0), R.delete(e));
546
+ function Ne(e) {
547
+ const n = A.get(e);
548
+ n && (e.removeEventListener("beforeinput", n.beforeInput), e.removeEventListener("input", n.input), e.removeEventListener("keydown", n.keydown), e.removeEventListener("click", n.click), e.removeEventListener("blur", n.blur), document.removeEventListener("mousedown", n.mousedown, !0), A.delete(e));
545
549
  }
546
- function Me() {
547
- if (F || typeof document == "undefined") return;
548
- F = !0;
550
+ function Re() {
551
+ if (Q || typeof document == "undefined") return;
552
+ Q = !0;
549
553
  const e = document.createElement("style");
550
554
  e.id = "rte-mention-plugin-styles", e.textContent = `
551
555
  .rte-mention {
@@ -609,58 +613,58 @@ function Me() {
609
613
 
610
614
  .rte-mention-item-meta {
611
615
  font-size: 12px;
612
- color: #64748b;
616
+ color: #475569;
613
617
  white-space: nowrap;
614
618
  }
615
619
 
616
620
  .rte-mention-empty {
617
621
  padding: 12px;
618
- color: #64748b;
622
+ color: #475569;
619
623
  font-size: 13px;
620
624
  text-align: center;
621
625
  }
622
626
 
623
- ${b} .rte-mention {
627
+ ${y} .rte-mention {
624
628
  background: rgba(37, 99, 235, 0.25);
625
629
  color: #bfdbfe;
626
630
  }
627
631
 
628
- ${b} .rte-mention-panel,
632
+ ${y} .rte-mention-panel,
629
633
  .rte-mention-panel.rte-mention-theme-dark {
630
634
  border-color: #364152;
631
635
  background: #1f2937;
632
636
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.48);
633
637
  }
634
638
 
635
- ${b} .rte-mention-item,
639
+ ${y} .rte-mention-item,
636
640
  .rte-mention-panel.rte-mention-theme-dark .rte-mention-item {
637
641
  color: #e5e7eb;
638
642
  }
639
643
 
640
- ${b} .rte-mention-item:hover,
641
- ${b} .rte-mention-item.active,
644
+ ${y} .rte-mention-item:hover,
645
+ ${y} .rte-mention-item.active,
642
646
  .rte-mention-panel.rte-mention-theme-dark .rte-mention-item:hover,
643
647
  .rte-mention-panel.rte-mention-theme-dark .rte-mention-item.active {
644
648
  background: #334155;
645
649
  color: #bfdbfe;
646
650
  }
647
651
 
648
- ${b} .rte-mention-item-meta,
649
- ${b} .rte-mention-empty,
652
+ ${y} .rte-mention-item-meta,
653
+ ${y} .rte-mention-empty,
650
654
  .rte-mention-panel.rte-mention-theme-dark .rte-mention-item-meta,
651
655
  .rte-mention-panel.rte-mention-theme-dark .rte-mention-empty {
652
- color: #9ca3af;
656
+ color: #cbd5e1;
653
657
  }
654
658
  `, document.head.appendChild(e);
655
659
  }
656
- function Ne(e) {
657
- var o, t, r;
660
+ function Ae(e) {
661
+ var o, r, t;
658
662
  const n = (e.triggerChars || ["@"]).filter((i) => typeof i == "string" && i.length > 0).map((i) => i[0]);
659
663
  return {
660
664
  triggerChars: n.length > 0 ? n : ["@"],
661
665
  minChars: Math.max(0, (o = e.minChars) != null ? o : 1),
662
- maxQueryLength: Math.max(1, (t = e.maxQueryLength) != null ? t : 32),
663
- maxSuggestions: Math.max(1, (r = e.maxSuggestions) != null ? r : 8),
666
+ maxQueryLength: Math.max(1, (r = e.maxQueryLength) != null ? r : 32),
667
+ maxSuggestions: Math.max(1, (t = e.maxSuggestions) != null ? t : 8),
664
668
  items: e.items || [
665
669
  { id: "john.doe", label: "John Doe", meta: "john@acme.com" },
666
670
  { id: "sarah.lee", label: "Sarah Lee", meta: "sarah@acme.com" },
@@ -675,28 +679,28 @@ function Ne(e) {
675
679
  insertSpaceAfterMention: e.insertSpaceAfterMention !== !1
676
680
  };
677
681
  }
678
- function M(e) {
679
- const n = N.get(e);
682
+ function N(e) {
683
+ const n = R.get(e);
680
684
  if (n) return n;
681
- const o = ve(e);
682
- return N.set(e, o), o;
685
+ const o = Le(e);
686
+ return R.set(e, o), o;
683
687
  }
684
- function Re(e) {
685
- S || (S = !0, T = (n) => {
688
+ function Se(e) {
689
+ S || (S = !0, C = (n) => {
686
690
  const o = n.target;
687
691
  if (!(o instanceof Node)) return;
688
- const t = o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement, r = (t == null ? void 0 : t.closest(p)) || null;
689
- if (!r) return;
690
- const i = M(r);
691
- D(r, i, e);
692
- }, document.addEventListener("focusin", T, !0));
693
- }
694
- function Se() {
695
- !S || !T || (document.removeEventListener("focusin", T, !0), S = !1, T = null);
696
- }
697
- const Ie = (e = {}) => {
698
- Me();
699
- const n = Ne(e);
692
+ const r = o.nodeType === Node.ELEMENT_NODE ? o : o.parentElement, t = (r == null ? void 0 : r.closest(g)) || null;
693
+ if (!t) return;
694
+ const i = N(t);
695
+ q(t, i, e);
696
+ }, document.addEventListener("focusin", C, !0));
697
+ }
698
+ function Oe() {
699
+ !S || !C || (document.removeEventListener("focusin", C, !0), S = !1, C = null);
700
+ }
701
+ const qe = (e = {}) => {
702
+ Re();
703
+ const n = Ae(e);
700
704
  return {
701
705
  name: "mentions",
702
706
  toolbar: [
@@ -707,33 +711,33 @@ const Ie = (e = {}) => {
707
711
  }
708
712
  ],
709
713
  commands: {
710
- insertMention: (o, t) => {
711
- const r = se(t);
712
- if (!r) return !1;
713
- const i = M(r);
714
- D(r, i, n);
715
- let a = E(r);
716
- a || (a = document.createRange(), a.selectNodeContents(r), a.collapse(!1), h(r, a));
717
- const l = O(r, a.cloneRange(), "after");
718
- A(l, a) || (h(r, l), a = l), i.query = "";
714
+ insertMention: (o, r) => {
715
+ const t = ce(r);
716
+ if (!t) return !1;
717
+ const i = N(t);
718
+ q(t, i, n);
719
+ let a = E(t);
720
+ a || (a = document.createRange(), a.selectNodeContents(t), a.collapse(!1), h(t, a));
721
+ const l = I(t, a.cloneRange(), "after");
722
+ O(l, a) || (h(t, l), a = l), i.query = "";
719
723
  const s = a.cloneRange();
720
- return i.trigger = n.triggerChars[0], te(i, n, a, "", i.trigger, s), !0;
724
+ return i.trigger = n.triggerChars[0], re(i, n, a, "", i.trigger, s), !0;
721
725
  }
722
726
  },
723
727
  init: () => {
724
- k += 1, Re(n), Array.from(document.querySelectorAll(p)).forEach((t) => {
725
- const r = M(t);
726
- D(t, r, n);
728
+ L += 1, Se(n), Array.from(document.querySelectorAll(g)).forEach((r) => {
729
+ const t = N(r);
730
+ q(r, t, n);
727
731
  });
728
732
  },
729
733
  destroy: () => {
730
- k = Math.max(0, k - 1), Array.from(document.querySelectorAll(p)).forEach((t) => {
731
- m(M(t)), Le(t), ke(t);
732
- }), k === 0 && Se();
734
+ L = Math.max(0, L - 1), Array.from(document.querySelectorAll(g)).forEach((r) => {
735
+ m(N(r)), Ne(r), Me(r);
736
+ }), L === 0 && Oe();
733
737
  }
734
738
  };
735
739
  };
736
740
  export {
737
- Ie as MentionPlugin
741
+ qe as MentionPlugin
738
742
  };
739
- //# sourceMappingURL=MentionPlugin.native-S_lwGZQO.mjs.map
743
+ //# sourceMappingURL=MentionPlugin.native-Zb1dwdxU.mjs.map