@editora/core 1.0.9 → 1.0.10

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/{A11yCheckerPlugin.native-58d12bed.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +12 -23
  3. package/dist/{AnchorPlugin.native-289a112a.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +102 -112
  4. package/dist/{ApprovalWorkflowPlugin.native-449ce66c.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +173 -209
  5. package/dist/{BackgroundColorPlugin.native-8aceb5cc.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +9 -16
  6. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  7. package/dist/{BlocksLibraryPlugin.native-1cc51e63.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +149 -205
  8. package/dist/{BoldPlugin.native-f9d7f8e4.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  9. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  10. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  11. package/dist/{CitationsPlugin.native-169fb1e8.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +196 -261
  12. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  13. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  14. package/dist/{CodeSamplePlugin.native-6cc0148e.mjs → CodeSamplePlugin.native-CgGoH-X4.mjs} +10 -19
  15. package/dist/{CommentsPlugin.native-03659874.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +28 -55
  16. package/dist/{ConditionalContentPlugin.native-4983143a.mjs → ConditionalContentPlugin.native-CfhY46rU.mjs} +51 -108
  17. package/dist/{ContentRulesPlugin.native-63ed405b.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +153 -200
  18. package/dist/{DataBindingPlugin.native-427e9d75.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +88 -124
  19. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  20. package/dist/{DocSchemaPlugin.native-8e41eda0.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +112 -166
  21. package/dist/{DocumentManagerPlugin.native-e69895ad.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +4 -4
  22. package/dist/EmbedIframePlugin.native-BF_-LjTq.mjs +740 -0
  23. package/dist/{EmojisPlugin.native-65c5ac47.mjs → EmojisPlugin.native-CitxxlWX.mjs} +6 -11
  24. package/dist/{FontFamilyPlugin.native-f9bc255a.mjs → FontFamilyPlugin.native-j8hMTbg4.mjs} +4 -7
  25. package/dist/{FontSizePlugin.native-f5647872.mjs → FontSizePlugin.native-B_jCh7dY.mjs} +10 -19
  26. package/dist/{FootnotePlugin.native-494657b3.mjs → FootnotePlugin.native-D730OGRm.mjs} +39 -77
  27. package/dist/{FullscreenPlugin.native-87ce92e9.mjs → FullscreenPlugin.native-ChXyxeNw.mjs} +1 -1
  28. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  29. package/dist/{HistoryPlugin.native-92ed4be4.mjs → HistoryPlugin.native-D2wl32jV.mjs} +107 -143
  30. package/dist/{IndentPlugin.native-e4ee902b.mjs → IndentPlugin.native-BHixp8sP.mjs} +12 -23
  31. package/dist/{ItalicPlugin.native-7c95cfbc.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  32. package/dist/{LineHeightPlugin.native-5668f78c.mjs → LineHeightPlugin.native-CM7iXdQj.mjs} +10 -19
  33. package/dist/{LinkPlugin.native-6df29111.mjs → LinkPlugin.native-DYCIcdTm.mjs} +5 -9
  34. package/dist/{ListPlugin.native-fe2e115a.mjs → ListPlugin.native-V7EZC1lM.mjs} +5 -9
  35. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  36. package/dist/{MediaManagerPlugin.native-3cf48a00.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +11 -21
  37. package/dist/{MentionPlugin.native-3b1e8c05.mjs → MentionPlugin.native-BMDlOqur.mjs} +45 -89
  38. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  39. package/dist/{PIIRedactionPlugin.native-7ab10b9f.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +210 -260
  40. package/dist/{PageBreakPlugin.native-1794c5fb.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +16 -31
  41. package/dist/{PreviewPlugin.native-f7b67cc0.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +6 -11
  42. package/dist/{PrintPlugin.native-f6a168c2.mjs → PrintPlugin.native-7qt5v7L5.mjs} +3 -5
  43. package/dist/{SlashCommandsPlugin.native-8d45e511.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +36 -71
  44. package/dist/{SmartPastePlugin.native-a6c5efec.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +173 -219
  45. package/dist/{SpecialCharactersPlugin.native-7f06d4ba.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +101 -85
  46. package/dist/{SpellCheckPlugin.native-04e20834.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +21 -41
  47. package/dist/{StrikethroughPlugin.native-905e9501.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -30
  48. package/dist/{TablePlugin.native-7d5458c1.mjs → TablePlugin.native-DrHX-efe.mjs} +30 -58
  49. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  50. package/dist/{TextAlignmentPlugin.native-9357b3ed.mjs → TextAlignmentPlugin.native-sM_1s00t.mjs} +6 -11
  51. package/dist/{TextColorPlugin.native-d53ed459.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +14 -26
  52. package/dist/{TrackChangesPlugin.native-e96da509.mjs → TrackChangesPlugin.native-Bghu2q4a.mjs} +58 -115
  53. package/dist/{TranslationWorkflowPlugin.native-4e711b1e.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +191 -257
  54. package/dist/{UnderlinePlugin.native-8080c998.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  55. package/dist/{VersionDiffPlugin.native-5bbeff85.mjs → VersionDiffPlugin.native-Bvxgy--t.mjs} +26 -51
  56. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  57. package/dist/{anchoredPopover-5cca53ba.mjs → anchoredPopover-Bxds0VoB.mjs} +1 -1
  58. package/dist/core.css +1 -0
  59. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  60. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +2 -3
  61. package/dist/editora.min.js +13 -14
  62. package/dist/editora.umd.js +13 -14
  63. package/dist/{html2canvas.esm-c51cb3b9.mjs → html2canvas.esm-AYkPY5LS.mjs} +894 -978
  64. package/dist/index-BslAFzmv.mjs +16544 -0
  65. package/dist/index-CPMGUZfB.js +10 -0
  66. package/dist/{index-7da30697.mjs → index-DBoj6QfW.mjs} +127 -164
  67. package/dist/index.cjs.js +1 -1
  68. package/dist/index.es-BYD2KEo6.mjs +6666 -0
  69. package/dist/index.esm.js +7 -12
  70. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  71. package/dist/{jspdf.es.min-780c82db.mjs → jspdf.es.min-BJGtOnRT.mjs} +3784 -4808
  72. package/dist/plugin-loader.js +67 -67
  73. package/dist/{purify.es-3bdbcfc5.mjs → purify.es-CKpwg8Tk.mjs} +10 -20
  74. package/dist/webcomponent-core.js +131 -168
  75. package/dist/webcomponent-core.min.css +1 -1
  76. package/dist/webcomponent-core.min.js +139 -63
  77. package/dist/webcomponent.cjs.js +1 -1
  78. package/dist/webcomponent.esm.js +1 -1
  79. package/dist/webcomponent.js +191 -228
  80. package/dist/webcomponent.min.css +1 -1
  81. package/dist/webcomponent.min.js +1240 -1344
  82. package/package.json +1 -1
  83. package/dist/BlockquotePlugin.native-3541c714.mjs +0 -49
  84. package/dist/CapitalizationPlugin.native-42c135dc.mjs +0 -80
  85. package/dist/ChecklistPlugin.native-3b397ee9.mjs +0 -330
  86. package/dist/ClearFormattingPlugin.native-77baa514.mjs +0 -145
  87. package/dist/CodePlugin.native-989cf0aa.mjs +0 -2740
  88. package/dist/DirectionPlugin.native-4e742f42.mjs +0 -139
  89. package/dist/EmbedIframePlugin.native-55209c87.mjs +0 -568
  90. package/dist/HeadingPlugin.native-e38c4a16.mjs +0 -64
  91. package/dist/MathPlugin.native-735bbac2.mjs +0 -296
  92. package/dist/MergeTagPlugin.native-31cf7d48.mjs +0 -584
  93. package/dist/TemplatePlugin.native-580f0f63.mjs +0 -617
  94. package/dist/_commonjsHelpers-69d58be2.mjs +0 -31
  95. package/dist/documentManager-8327fb6e.mjs +0 -9166
  96. package/dist/index-072ef022.js +0 -11
  97. package/dist/index-49d31221.mjs +0 -16860
  98. package/dist/index.es-b47a189f.mjs +0 -5782
  99. package/dist/style.css +0 -1
@@ -1,4 +1,4 @@
1
- const $ = ".rte-content, .editora-content", gt = "rte-citations-styles", m = "rte-citations-panel", ot = ".rte-citation-ref[data-citation-id]", W = '.rte-citation-bibliography[data-type="citation-bibliography"]', G = '.rte-citation-footnotes[data-type="citation-footnotes"]', x = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', L = ["apa", "mla", "chicago"], Bt = {
1
+ const $ = ".rte-content, .editora-content", pt = "rte-citations-styles", m = "rte-citations-panel", ot = ".rte-citation-ref[data-citation-id]", W = '.rte-citation-bibliography[data-type="citation-bibliography"]', G = '.rte-citation-footnotes[data-type="citation-footnotes"]', x = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', L = ["apa", "mla", "chicago"], Ot = {
2
2
  panelTitle: "Citations",
3
3
  panelAriaLabel: "Citations panel",
4
4
  styleLabel: "Citation style",
@@ -19,43 +19,42 @@ const $ = ".rte-content, .editora-content", gt = "rte-citations-styles", m = "rt
19
19
  deleteRecentText: "x",
20
20
  summaryPrefix: "Citations",
21
21
  invalidMessage: "Author and title are required."
22
- }, f = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new Set();
23
- let I = null, B = null, O = null, k = null, Y = 0, Ot = 0, at = 0, M = null, p = null;
22
+ }, f = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new Set();
23
+ let I = null, B = null, O = null, k = null, Y = 0, Pt = 0, at = 0, M = null, p = null;
24
24
  function g(t) {
25
25
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
26
26
  }
27
- function Pt(t) {
27
+ function Dt(t) {
28
28
  return t.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
29
29
  }
30
- function ht(t, o) {
30
+ function xt(t, o) {
31
31
  const e = o(t);
32
- if (!e)
33
- return "";
32
+ if (!e) return "";
34
33
  const i = e.match(/\d{4}/);
35
34
  return i ? i[0] : e;
36
35
  }
37
- function xt(t, o) {
36
+ function yt(t, o) {
38
37
  const e = o(t);
39
38
  return e ? /^https?:\/\//i.test(e) ? e : `https://${e}` : "";
40
39
  }
41
40
  function F(t) {
42
41
  return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
43
42
  }
44
- function yt(t, o) {
43
+ function Ct(t, o) {
45
44
  return {
46
45
  id: F(o.normalizeText(t.id || "")),
47
46
  author: o.normalizeText(t.author || ""),
48
- year: ht(t.year || "", o.normalizeText) || void 0,
47
+ year: xt(t.year || "", o.normalizeText) || void 0,
49
48
  title: o.normalizeText(t.title || ""),
50
49
  source: o.normalizeText(t.source || "") || void 0,
51
- url: xt(t.url || "", o.normalizeText) || void 0,
50
+ url: yt(t.url || "", o.normalizeText) || void 0,
52
51
  note: o.normalizeText(t.note || "") || void 0
53
52
  };
54
53
  }
55
54
  function Z(t = {}) {
56
55
  var i, n;
57
56
  const o = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", e = {
58
- ...Bt,
57
+ ...Ot,
59
58
  ...t.labels || {}
60
59
  };
61
60
  return {
@@ -64,11 +63,11 @@ function Z(t = {}) {
64
63
  debounceMs: Math.max(80, Number((i = t.debounceMs) != null ? i : 220)),
65
64
  maxRecentCitations: Math.max(3, Math.min(30, Number((n = t.maxRecentCitations) != null ? n : 8))),
66
65
  labels: e,
67
- normalizeText: t.normalizeText || Pt,
66
+ normalizeText: t.normalizeText || Dt,
68
67
  generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
69
68
  };
70
69
  }
71
- function Ct(t) {
70
+ function wt(t) {
72
71
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
73
72
  }
74
73
  function lt(t) {
@@ -77,62 +76,54 @@ function lt(t) {
77
76
  function X(t) {
78
77
  return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
79
78
  }
80
- function Dt(t) {
79
+ function Ht(t) {
81
80
  const o = lt(t);
82
- if (X(o))
83
- return !0;
81
+ if (X(o)) return !0;
84
82
  const e = o.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
85
83
  return X(e) ? !0 : X(document.documentElement) || X(document.body);
86
84
  }
87
85
  function tt(t, o) {
88
- t.classList.remove("rte-citations-theme-dark"), Dt(o) && t.classList.add("rte-citations-theme-dark");
86
+ t.classList.remove("rte-citations-theme-dark"), Ht(o) && t.classList.add("rte-citations-theme-dark");
89
87
  }
90
88
  function h(t, o = !0) {
91
- if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement)
92
- return t.contentElement;
89
+ if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
93
90
  if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
94
91
  const n = t.editorElement;
95
- if (n.matches($))
96
- return n;
92
+ if (n.matches($)) return n;
97
93
  const r = n.querySelector($);
98
- if (r instanceof HTMLElement)
99
- return r;
94
+ if (r instanceof HTMLElement) return r;
100
95
  }
101
96
  const e = window.getSelection();
102
97
  if (e && e.rangeCount > 0) {
103
- const n = e.getRangeAt(0).startContainer, r = Ct(n), a = r == null ? void 0 : r.closest($);
104
- if (a)
105
- return a;
98
+ const n = e.getRangeAt(0).startContainer, r = wt(n), a = r == null ? void 0 : r.closest($);
99
+ if (a) return a;
106
100
  }
107
101
  const i = document.activeElement;
108
102
  if (i) {
109
- if (i.matches($))
110
- return i;
103
+ if (i.matches($)) return i;
111
104
  const n = i.closest($);
112
- if (n)
113
- return n;
105
+ if (n) return n;
114
106
  }
115
107
  return p && p.isConnected ? p : (p && !p.isConnected && (p = null), o ? document.querySelector($) : null);
116
108
  }
117
109
  function S(t) {
118
110
  return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
119
111
  }
120
- function j(t) {
121
- const o = Ct(t);
112
+ function K(t) {
113
+ const o = wt(t);
122
114
  return o ? !!(o.closest(W) || o.closest(G)) : !1;
123
115
  }
124
- function Ht(t, o) {
116
+ function Ft(t, o) {
125
117
  if (at += 1, o.generateCitationId) {
126
118
  const e = o.generateCitationId({ editor: t, index: at }), i = F(o.normalizeText(e || ""));
127
- if (i)
128
- return i;
119
+ if (i) return i;
129
120
  }
130
121
  return `cite-${Date.now().toString(36)}-${at.toString(36)}`;
131
122
  }
132
123
  function st(t) {
133
124
  return t.map((o) => (o || "").trim()).filter(Boolean).join(" ").trim();
134
125
  }
135
- function Ft(t, o) {
126
+ function _t(t, o) {
136
127
  const e = t.author || "Unknown", i = t.year || "n.d.";
137
128
  return o === "mla" ? `(${e} ${i})` : o === "chicago" ? `(${e} ${i})` : `(${e}, ${i})`;
138
129
  }
@@ -163,23 +154,22 @@ function R(t) {
163
154
  (o) => !o.closest(W) && !o.closest(G)
164
155
  );
165
156
  }
166
- function wt(t, o) {
157
+ function vt(t, o) {
167
158
  const e = F(o.normalizeText(t.getAttribute("data-citation-id") || ""));
168
- if (!e)
169
- return null;
159
+ if (!e) return null;
170
160
  const i = o.normalizeText(t.getAttribute("data-citation-author") || ""), n = o.normalizeText(t.getAttribute("data-citation-title") || "");
171
161
  return {
172
162
  id: e,
173
163
  author: i || "Unknown",
174
- year: ht(t.getAttribute("data-citation-year") || "", o.normalizeText) || void 0,
164
+ year: xt(t.getAttribute("data-citation-year") || "", o.normalizeText) || void 0,
175
165
  title: n || "Untitled",
176
166
  source: o.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
177
- url: xt(t.getAttribute("data-citation-url") || "", o.normalizeText) || void 0,
167
+ url: yt(t.getAttribute("data-citation-url") || "", o.normalizeText) || void 0,
178
168
  note: o.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
179
169
  };
180
170
  }
181
- function vt(t, o, e) {
182
- t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", o.id), t.setAttribute("data-citation-author", o.author || ""), t.setAttribute("data-citation-year", o.year || ""), t.setAttribute("data-citation-title", o.title || ""), t.setAttribute("data-citation-source", o.source || ""), t.setAttribute("data-citation-url", o.url || ""), t.setAttribute("data-citation-note", o.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", e), t.textContent = Ft(o, e);
171
+ function Et(t, o, e) {
172
+ t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", o.id), t.setAttribute("data-citation-author", o.author || ""), t.setAttribute("data-citation-year", o.year || ""), t.setAttribute("data-citation-title", o.title || ""), t.setAttribute("data-citation-source", o.source || ""), t.setAttribute("data-citation-url", o.url || ""), t.setAttribute("data-citation-note", o.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", e), t.textContent = _t(o, e);
183
173
  }
184
174
  function it(t, o, e) {
185
175
  const i = lt(t);
@@ -195,12 +185,11 @@ function N(t, o) {
195
185
  const e = T.get(t);
196
186
  return e && L.includes(e) ? e : (o == null ? void 0 : o.defaultStyle) || "apa";
197
187
  }
198
- function K(t, o) {
188
+ function j(t, o) {
199
189
  const e = R(t), i = /* @__PURE__ */ new Map();
200
190
  return e.forEach((n) => {
201
- const r = wt(n, o);
202
- if (!r)
203
- return;
191
+ const r = vt(n, o);
192
+ if (!r) return;
204
193
  if (!i.has(r.id)) {
205
194
  i.set(r.id, r);
206
195
  return;
@@ -217,10 +206,9 @@ function K(t, o) {
217
206
  });
218
207
  }), Array.from(i.values());
219
208
  }
220
- function _t(t, o, e) {
221
- const i = yt(o, e);
222
- if (!i.id || !i.author || !i.title)
223
- return;
209
+ function qt(t, o, e) {
210
+ const i = Ct(o, e);
211
+ if (!i.id || !i.author || !i.title) return;
224
212
  const r = (D.get(t) || []).filter((a) => a.id !== i.id);
225
213
  D.set(t, [i, ...r].slice(0, e.maxRecentCitations));
226
214
  }
@@ -234,18 +222,17 @@ function rt(t, o, e) {
234
222
  const r = Array.from(n.values()).slice(0, e.maxRecentCitations);
235
223
  return D.set(t, r), r;
236
224
  }
237
- function Et(t, o, e, i) {
225
+ function $t(t, o, e, i) {
238
226
  const n = F(i.normalizeText(o || ""));
239
227
  return n && rt(t, e, i).find((a) => a.id === n) || null;
240
228
  }
241
- function qt(t, o, e) {
229
+ function Kt(t, o, e) {
242
230
  const i = F(e.normalizeText(o || ""));
243
- if (!i)
244
- return !1;
231
+ if (!i) return !1;
245
232
  const n = D.get(t) || [], r = n.filter((a) => a.id !== i);
246
233
  return r.length === n.length ? !1 : (D.set(t, r), !0);
247
234
  }
248
- function $t(t, o, e) {
235
+ function St(t, o, e) {
249
236
  const i = document.createElement("section");
250
237
  i.className = t, i.setAttribute("data-type", o), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", e), o === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : o === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
251
238
  const n = document.createElement("h3");
@@ -255,44 +242,42 @@ function $t(t, o, e) {
255
242
  }
256
243
  function jt(t, o) {
257
244
  let e = t.querySelector(W);
258
- e || (e = $t("rte-citation-bibliography", "citation-bibliography", o.labels.bibliographyTitle), t.appendChild(e));
245
+ e || (e = St("rte-citation-bibliography", "citation-bibliography", o.labels.bibliographyTitle), t.appendChild(e));
259
246
  const i = e.querySelector(".rte-citation-section-title");
260
247
  return i && (i.textContent = o.labels.bibliographyTitle), e.setAttribute("aria-label", o.labels.bibliographyTitle), e;
261
248
  }
262
- function Kt(t, o) {
249
+ function Ut(t, o) {
263
250
  let e = t.querySelector(G);
264
- e || (e = $t("rte-citation-footnotes", "citation-footnotes", o.labels.footnotesTitle), t.appendChild(e));
251
+ e || (e = St("rte-citation-footnotes", "citation-footnotes", o.labels.footnotesTitle), t.appendChild(e));
265
252
  const i = e.querySelector(".rte-citation-section-title");
266
253
  return i && (i.textContent = o.labels.footnotesTitle), e.setAttribute("aria-label", o.labels.footnotesTitle), e;
267
254
  }
268
- function St(t, o) {
255
+ function At(t, o) {
269
256
  const e = t.querySelector(o);
270
257
  e == null || e.remove();
271
258
  }
272
- function Ut(t, o, e, i) {
259
+ function Wt(t, o, e, i) {
273
260
  if (o.length === 0) {
274
- St(t, W);
261
+ At(t, W);
275
262
  return;
276
263
  }
277
264
  const r = jt(t, e).querySelector(".rte-citation-list");
278
- if (!r)
279
- return;
265
+ if (!r) return;
280
266
  const a = document.createDocumentFragment();
281
267
  o.forEach((s, d) => {
282
268
  const c = document.createElement("li");
283
269
  c.className = "rte-citation-item", c.id = `rte-citation-entry-${s.id}`, c.setAttribute("data-citation-id", s.id), c.setAttribute("data-citation-number", String(d + 1)), c.textContent = ut(s, i), a.appendChild(c);
284
270
  }), r.innerHTML = "", r.appendChild(a);
285
271
  }
286
- function Wt(t, o, e, i) {
272
+ function Gt(t, o, e, i) {
287
273
  if (!e.enableFootnoteSync || o.length === 0) {
288
- St(t, G), R(t).forEach((l) => {
274
+ At(t, G), R(t).forEach((l) => {
289
275
  l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
290
276
  });
291
277
  return;
292
278
  }
293
- const r = Kt(t, e).querySelector(".rte-citation-list");
294
- if (!r)
295
- return;
279
+ const r = Ut(t, e).querySelector(".rte-citation-list");
280
+ if (!r) return;
296
281
  const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
297
282
  o.forEach((l, u) => {
298
283
  s.set(l.id, u + 1);
@@ -300,8 +285,7 @@ function Wt(t, o, e, i) {
300
285
  const d = /* @__PURE__ */ new Map();
301
286
  R(t).forEach((l) => {
302
287
  const u = l.getAttribute("data-citation-id") || "";
303
- if (!u || !s.has(u))
304
- return;
288
+ if (!u || !s.has(u)) return;
305
289
  const b = (d.get(u) || 0) + 1;
306
290
  d.set(u, b);
307
291
  const w = `rte-citation-ref-${u}-${b}`;
@@ -317,21 +301,21 @@ function Wt(t, o, e, i) {
317
301
  w.className = "rte-citation-footnote-number", w.textContent = `${u + 1}. `;
318
302
  const A = document.createElement("span");
319
303
  A.className = "rte-citation-footnote-text";
320
- const It = l.note ? `${l.note}. ` : "";
321
- A.textContent = `${It}${ut(l, i)}`, b.appendChild(w), b.appendChild(A);
322
- const mt = a.get(l.id);
323
- if (mt) {
304
+ const Bt = l.note ? `${l.note}. ` : "";
305
+ A.textContent = `${Bt}${ut(l, i)}`, b.appendChild(w), b.appendChild(A);
306
+ const gt = a.get(l.id);
307
+ if (gt) {
324
308
  const _ = document.createElement("a");
325
- _.className = "rte-citation-backref", _.href = `#${mt}`, _.setAttribute("aria-label", `Back to citation ${u + 1}`), _.textContent = "Back", b.appendChild(_);
309
+ _.className = "rte-citation-backref", _.href = `#${gt}`, _.setAttribute("aria-label", `Back to citation ${u + 1}`), _.textContent = "Back", b.appendChild(_);
326
310
  }
327
311
  c.appendChild(b);
328
312
  }), r.innerHTML = "", r.appendChild(c);
329
313
  }
330
- function Gt(t, o, e, i) {
314
+ function Vt(t, o, e, i) {
331
315
  const n = ut(o, e);
332
316
  t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${n}`);
333
317
  }
334
- function Vt(t, o, e) {
318
+ function Yt(t, o, e) {
335
319
  const i = R(t);
336
320
  let n = `${o}:${e ? "1" : "0"}:${i.length}`;
337
321
  return i.forEach((r) => {
@@ -340,12 +324,10 @@ function Vt(t, o, e) {
340
324
  }
341
325
  function H(t) {
342
326
  const o = v.get(t);
343
- if (!o)
344
- return;
327
+ if (!o) return;
345
328
  const e = f.get(t) || M;
346
- if (!e)
347
- return;
348
- const i = N(t, e), n = K(t, e), r = rt(t, n, e), a = o.querySelector(".rte-citations-status"), s = o.querySelector('[data-action="cycle-style"]'), d = o.querySelector(".rte-citations-recent-list");
329
+ if (!e) return;
330
+ const i = N(t, e), n = j(t, e), r = rt(t, n, e), a = o.querySelector(".rte-citations-status"), s = o.querySelector('[data-action="cycle-style"]'), d = o.querySelector(".rte-citations-recent-list");
349
331
  if (a) {
350
332
  const c = n.length;
351
333
  a.textContent = `${e.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${e.enableFootnoteSync ? "On" : "Off"}`;
@@ -383,12 +365,12 @@ function H(t) {
383
365
  }
384
366
  }
385
367
  function y(t, o, e = !1) {
386
- const i = N(t, o), n = Vt(t, i, o.enableFootnoteSync);
387
- if (!e && pt.get(t) === n)
388
- return K(t, o);
368
+ const i = N(t, o), n = Yt(t, i, o.enableFootnoteSync);
369
+ if (!e && ht.get(t) === n)
370
+ return j(t, o);
389
371
  const r = R(t), a = /* @__PURE__ */ new Map();
390
372
  r.forEach((c) => {
391
- const l = wt(c, o);
373
+ const l = vt(c, o);
392
374
  l && (a.has(l.id) || a.set(l.id, l));
393
375
  });
394
376
  const s = Array.from(a.values());
@@ -398,12 +380,11 @@ function y(t, o, e = !1) {
398
380
  d.set(c.id, l + 1);
399
381
  }), r.forEach((c) => {
400
382
  const l = c.getAttribute("data-citation-id") || "", u = a.get(l);
401
- if (!u)
402
- return;
403
- vt(c, u, i);
383
+ if (!u) return;
384
+ Et(c, u, i);
404
385
  const b = d.get(u.id) || 1;
405
- Gt(c, u, i, Math.max(1, b));
406
- }), Ut(t, s, o, i), Wt(t, s, o, i), pt.set(t, n), H(t), t.dispatchEvent(
386
+ Vt(c, u, i, Math.max(1, b));
387
+ }), Wt(t, s, o, i), Gt(t, s, o, i), ht.set(t, n), H(t), t.dispatchEvent(
407
388
  new CustomEvent("editora:citations-refreshed", {
408
389
  bubbles: !0,
409
390
  detail: {
@@ -414,27 +395,25 @@ function y(t, o, e = !1) {
414
395
  })
415
396
  ), s;
416
397
  }
417
- function At(t) {
398
+ function kt(t) {
418
399
  const o = Q.get(t);
419
400
  typeof o == "number" && (window.clearTimeout(o), q.delete(o), Q.delete(t));
420
401
  }
421
- function kt(t) {
402
+ function Tt(t) {
422
403
  const o = f.get(t) || M;
423
- if (!o)
424
- return;
425
- At(t);
404
+ if (!o) return;
405
+ kt(t);
426
406
  const e = window.setTimeout(() => {
427
407
  q.delete(e), Q.delete(t), y(t, o, !1);
428
408
  }, o.debounceMs);
429
409
  q.add(e), Q.set(t, e);
430
410
  }
431
- function Yt(t) {
411
+ function Xt(t) {
432
412
  const o = window.getSelection();
433
- if (!o)
434
- throw new Error("Selection unavailable");
413
+ if (!o) throw new Error("Selection unavailable");
435
414
  if (o.rangeCount > 0) {
436
415
  const a = o.getRangeAt(0);
437
- if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
416
+ if (t.contains(a.commonAncestorContainer) && !K(a.commonAncestorContainer))
438
417
  return a.cloneRange();
439
418
  }
440
419
  const e = document.createRange(), i = t.querySelector(W), n = t.querySelector(G), r = i || n;
@@ -444,8 +423,7 @@ function dt(t) {
444
423
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
445
424
  }
446
425
  function ft(t, o) {
447
- if (o === t.innerHTML)
448
- return;
426
+ if (o === t.innerHTML) return;
449
427
  const e = window.execEditorCommand || window.executeEditorCommand;
450
428
  if (typeof e == "function")
451
429
  try {
@@ -453,10 +431,9 @@ function ft(t, o) {
453
431
  } catch (i) {
454
432
  }
455
433
  }
456
- function Tt(t, o) {
434
+ function Mt(t, o) {
457
435
  const e = window.getSelection();
458
- if (!e)
459
- return;
436
+ if (!e) return;
460
437
  const i = document.createRange();
461
438
  if (t.nodeType === Node.TEXT_NODE) {
462
439
  const n = t, r = Math.max(0, Math.min(o, n.length));
@@ -467,7 +444,7 @@ function Tt(t, o) {
467
444
  }
468
445
  i.collapse(!0), e.removeAllRanges(), e.addRange(i);
469
446
  }
470
- function Mt(t) {
447
+ function Lt(t) {
471
448
  if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
472
449
  return null;
473
450
  const o = t.startContainer.childNodes[t.startOffset];
@@ -478,8 +455,7 @@ function J(t, o, e) {
478
455
  if (i.nodeType === Node.ELEMENT_NODE) {
479
456
  const a = i;
480
457
  if (e === "previous") {
481
- if (n > 0)
482
- return a.childNodes[n - 1] || null;
458
+ if (n > 0) return a.childNodes[n - 1] || null;
483
459
  } else if (n < a.childNodes.length)
484
460
  return a.childNodes[n] || null;
485
461
  }
@@ -488,15 +464,13 @@ function J(t, o, e) {
488
464
  let r = i;
489
465
  for (; r && r !== o; ) {
490
466
  const a = e === "previous" ? r.previousSibling : r.nextSibling;
491
- if (a)
492
- return a;
467
+ if (a) return a;
493
468
  r = r.parentNode;
494
469
  }
495
470
  return null;
496
471
  }
497
- function Lt(t, o, e) {
498
- if (!t.collapsed)
499
- return null;
472
+ function Rt(t, o, e) {
473
+ if (!t.collapsed) return null;
500
474
  const i = (a) => a instanceof HTMLElement && a.matches(ot) ? a : null, { startContainer: n, startOffset: r } = t;
501
475
  if (n.nodeType === Node.ELEMENT_NODE) {
502
476
  const a = n;
@@ -517,82 +491,70 @@ function Lt(t, o, e) {
517
491
  }
518
492
  function P(t, o, e) {
519
493
  const i = t.closest($);
520
- if (!i || j(t))
521
- return !1;
494
+ if (!i || K(t)) return !1;
522
495
  const n = t.parentNode;
523
- if (!n)
524
- return !1;
496
+ if (!n) return !1;
525
497
  const r = i.innerHTML, a = Array.from(n.childNodes).indexOf(t);
526
- if (a < 0)
527
- return !1;
498
+ if (a < 0) return !1;
528
499
  const s = t.nextSibling;
529
- return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Tt(n, a), y(i, e, !0), ft(i, r), dt(i), o === "Delete" && i.focus({ preventScroll: !0 }), !0;
500
+ return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Mt(n, a), y(i, e, !0), ft(i, r), dt(i), o === "Delete" && i.focus({ preventScroll: !0 }), !0;
530
501
  }
531
- function Xt(t, o, e) {
532
- if (t.key !== "Backspace" && t.key !== "Delete")
533
- return !1;
502
+ function Jt(t, o, e) {
503
+ if (t.key !== "Backspace" && t.key !== "Delete") return !1;
534
504
  const i = t.key, n = t.target;
535
- if (n != null && n.matches(ot) && o.contains(n) && !j(n))
505
+ if (n != null && n.matches(ot) && o.contains(n) && !K(n))
536
506
  return t.preventDefault(), t.stopPropagation(), P(n, i, e);
537
507
  const r = window.getSelection();
538
- if (!r || r.rangeCount === 0)
539
- return !1;
508
+ if (!r || r.rangeCount === 0) return !1;
540
509
  const a = r.getRangeAt(0);
541
- if (!o.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer))
542
- return !1;
543
- const s = Mt(a);
510
+ if (!o.contains(a.commonAncestorContainer) || K(a.commonAncestorContainer)) return !1;
511
+ const s = Lt(a);
544
512
  if (s)
545
513
  return t.preventDefault(), t.stopPropagation(), P(s, i, e);
546
- const d = Lt(a, o, i);
514
+ const d = Rt(a, o, i);
547
515
  return d ? (t.preventDefault(), t.stopPropagation(), P(d, i, e)) : !1;
548
516
  }
549
- function Rt(t, o, e) {
517
+ function Nt(t, o, e) {
550
518
  const i = F(e.normalizeText(o || ""));
551
- if (!i)
552
- return !1;
519
+ if (!i) return !1;
553
520
  const n = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
554
- if (n.length === 0)
555
- return !1;
521
+ if (n.length === 0) return !1;
556
522
  if (n.length === 1)
557
523
  return P(n[0], "Delete", e);
558
524
  const r = t.innerHTML;
559
525
  return n.forEach((a) => {
560
526
  const s = a.nextSibling;
561
527
  s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
562
- }), Tt(t, t.childNodes.length), y(t, e, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
528
+ }), Mt(t, t.childNodes.length), y(t, e, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
563
529
  }
564
- function Jt(t, o) {
530
+ function Zt(t, o) {
565
531
  const e = window.getSelection();
566
- if (!e || e.rangeCount === 0)
567
- return !1;
532
+ if (!e || e.rangeCount === 0) return !1;
568
533
  const i = e.getRangeAt(0);
569
- if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer))
570
- return !1;
571
- const n = Mt(i);
534
+ if (!t.contains(i.commonAncestorContainer) || K(i.commonAncestorContainer)) return !1;
535
+ const n = Lt(i);
572
536
  if (n)
573
537
  return P(n, "Delete", o);
574
- const r = Lt(i, t, "Backspace");
538
+ const r = Rt(i, t, "Backspace");
575
539
  return r ? P(r, "Backspace", o) : !1;
576
540
  }
577
541
  function et(t, o, e) {
578
542
  var l, u;
579
- const i = yt(o, e);
580
- if (!i.author || !i.title)
581
- return !1;
582
- i.id || (i.id = Ht(t, e));
543
+ const i = Ct(o, e);
544
+ if (!i.author || !i.title) return !1;
545
+ i.id || (i.id = Ft(t, e));
583
546
  const n = t.innerHTML;
584
547
  let r;
585
548
  try {
586
- r = Yt(t);
549
+ r = Xt(t);
587
550
  } catch (b) {
588
551
  return !1;
589
552
  }
590
553
  const a = window.getSelection();
591
- if (!a)
592
- return !1;
554
+ if (!a) return !1;
593
555
  r.collapsed || r.deleteContents();
594
556
  const s = document.createElement("span");
595
- vt(s, i, N(t, e));
557
+ Et(s, i, N(t, e));
596
558
  try {
597
559
  r.insertNode(s);
598
560
  } catch (b) {
@@ -606,18 +568,15 @@ function et(t, o, e) {
606
568
  c.setStart(d.parentNode, Math.max(0, b));
607
569
  } else
608
570
  c.setStartAfter(s);
609
- return c.collapse(!0), a.removeAllRanges(), a.addRange(c), _t(t, i, e), y(t, e, !0), ft(t, n), dt(t), !0;
571
+ return c.collapse(!0), a.removeAllRanges(), a.addRange(c), qt(t, i, e), y(t, e, !0), ft(t, n), dt(t), !0;
610
572
  }
611
- function Zt(t, o) {
612
- if (!o)
613
- return !1;
573
+ function Qt(t, o) {
574
+ if (!o) return !1;
614
575
  const e = R(t).find((r) => r.getAttribute("data-citation-id") === o) || null;
615
- if (!e)
616
- return !1;
576
+ if (!e) return !1;
617
577
  e.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 });
618
578
  const i = window.getSelection();
619
- if (!i)
620
- return !0;
579
+ if (!i) return !0;
621
580
  const n = document.createRange();
622
581
  return n.selectNode(e), i.removeAllRanges(), i.addRange(n), !0;
623
582
  }
@@ -628,21 +587,20 @@ function U(t, o = !1) {
628
587
  const e = v.get(t);
629
588
  e && (e.classList.remove("show"), V.set(t, !1), it(t, "toggleCitationsPanel", !1), o && t.focus({ preventScroll: !0 }));
630
589
  }
631
- function Qt(t) {
590
+ function te(t) {
632
591
  v.forEach((o, e) => {
633
592
  e !== t && U(e, !1);
634
593
  });
635
594
  }
636
595
  function ct(t, o) {
637
- if (!o.classList.contains("show"))
638
- return;
596
+ if (!o.classList.contains("show")) return;
639
597
  const i = lt(t).getBoundingClientRect(), n = Math.min(window.innerWidth - 20, 380), r = Math.max(10, window.innerWidth - n - 10), a = Math.min(Math.max(10, i.right - n), r), s = Math.max(10, Math.min(window.innerHeight - 10 - 260, i.top + 10));
640
598
  o.style.width = `${n}px`, o.style.left = `${a}px`, o.style.top = `${s}px`, o.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
641
599
  }
642
600
  function C(t, o) {
643
601
  return t.querySelector(`[data-field="${o}"]`);
644
602
  }
645
- function te(t) {
603
+ function ee(t) {
646
604
  var s, d, c, l, u, b;
647
605
  const o = ((s = C(t, "author")) == null ? void 0 : s.value) || "", e = ((d = C(t, "year")) == null ? void 0 : d.value) || "", i = ((c = C(t, "title")) == null ? void 0 : c.value) || "", n = ((l = C(t, "source")) == null ? void 0 : l.value) || "", r = ((u = C(t, "url")) == null ? void 0 : u.value) || "", a = ((b = C(t, "note")) == null ? void 0 : b.value) || "";
648
606
  return {
@@ -658,11 +616,11 @@ function E(t, o) {
658
616
  const e = t.querySelector(".rte-citations-live");
659
617
  e && (e.textContent = o);
660
618
  }
661
- function ee(t, o, e) {
619
+ function ne(t, o, e) {
662
620
  const i = C(o, "style");
663
621
  i && (i.value = N(t, e));
664
622
  }
665
- function Nt(t, o, e) {
623
+ function zt(t, o, e) {
666
624
  const i = L.includes(o) ? o : e.defaultStyle;
667
625
  return T.set(t, i), y(t, e, !0), i;
668
626
  }
@@ -670,11 +628,10 @@ function bt(t, o) {
670
628
  const e = N(t, o), i = L.indexOf(e), n = L[(i + 1) % L.length];
671
629
  return T.set(t, n), y(t, o, !0), n;
672
630
  }
673
- function ne(t) {
631
+ function oe(t) {
674
632
  const o = v.get(t);
675
- if (o)
676
- return o;
677
- const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Ot++}`, n = document.createElement("section");
633
+ if (o) return o;
634
+ const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Pt++}`, n = document.createElement("section");
678
635
  n.className = m, n.id = i, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", e.labels.panelAriaLabel), n.setAttribute("tabindex", "-1"), n.innerHTML = `
679
636
  <header class="rte-citations-header">
680
637
  <h2 class="rte-citations-title">${g(e.labels.panelTitle)}</h2>
@@ -734,20 +691,17 @@ function ne(t) {
734
691
  </div>
735
692
  `, n.addEventListener("click", (a) => {
736
693
  const s = a.target;
737
- if (!s)
738
- return;
694
+ if (!s) return;
739
695
  const d = s.closest("[data-action]");
740
- if (!d)
741
- return;
696
+ if (!d) return;
742
697
  const c = d.getAttribute("data-action") || "", l = f.get(t) || M || e;
743
698
  if (f.set(t, l), c === "close") {
744
699
  U(t, !0);
745
700
  return;
746
701
  }
747
702
  if (c === "insert") {
748
- if (S(t))
749
- return;
750
- const u = te(n);
703
+ if (S(t)) return;
704
+ const u = ee(n);
751
705
  if (!l.normalizeText(u.author) || !l.normalizeText(u.title)) {
752
706
  E(n, l.labels.invalidMessage);
753
707
  return;
@@ -768,27 +722,24 @@ function ne(t) {
768
722
  }
769
723
  if (c === "cycle-style") {
770
724
  const u = bt(t, l);
771
- ee(t, n, l), E(n, `Style changed to ${u.toUpperCase()}.`);
725
+ ne(t, n, l), E(n, `Style changed to ${u.toUpperCase()}.`);
772
726
  return;
773
727
  }
774
728
  if (c === "insert-from-recent") {
775
- if (S(t))
776
- return;
777
- const u = d.getAttribute("data-citation-id") || "", b = Et(t, u, K(t, l), l);
778
- if (!b)
779
- return;
729
+ if (S(t)) return;
730
+ const u = d.getAttribute("data-citation-id") || "", b = $t(t, u, j(t, l), l);
731
+ if (!b) return;
780
732
  et(t, b, l), E(n, `Inserted citation: ${b.title}.`);
781
733
  return;
782
734
  }
783
735
  if (c === "delete-by-id") {
784
- if (S(t))
785
- return;
736
+ if (S(t)) return;
786
737
  const u = d.getAttribute("data-citation-id") || "";
787
- if (Rt(t, u, l)) {
738
+ if (Nt(t, u, l)) {
788
739
  E(n, "Citation deleted.");
789
740
  return;
790
741
  }
791
- qt(t, u, l) && (H(t), E(n, "Removed from recent citations."));
742
+ Kt(t, u, l) && (H(t), E(n, "Removed from recent citations."));
792
743
  }
793
744
  }), n.addEventListener("keydown", (a) => {
794
745
  if (a.key === "Escape") {
@@ -796,14 +747,11 @@ function ne(t) {
796
747
  return;
797
748
  }
798
749
  const s = a.target;
799
- if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp")
800
- return;
750
+ if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp") return;
801
751
  const d = Array.from(n.querySelectorAll(".rte-citations-recent-btn"));
802
- if (d.length === 0)
803
- return;
752
+ if (d.length === 0) return;
804
753
  const c = d.indexOf(s);
805
- if (c < 0)
806
- return;
754
+ if (c < 0) return;
807
755
  a.preventDefault();
808
756
  const l = a.key === "ArrowDown" ? 1 : -1, u = (c + l + d.length) % d.length;
809
757
  d[u].focus();
@@ -811,82 +759,81 @@ function ne(t) {
811
759
  const r = C(n, "style");
812
760
  return r == null || r.addEventListener("change", () => {
813
761
  const a = f.get(t) || M || e, s = r.value;
814
- Nt(t, s, a), E(n, `Style changed to ${s.toUpperCase()}.`);
762
+ zt(t, s, a), E(n, `Style changed to ${s.toUpperCase()}.`);
815
763
  }), tt(n, t), document.body.appendChild(n), v.set(t, n), V.set(t, !1), H(t), n;
816
764
  }
817
765
  function z(t) {
818
- const o = ne(t);
819
- Qt(t), o.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(o, t), ct(t, o), H(t);
766
+ const o = oe(t);
767
+ te(t), o.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(o, t), ct(t, o), H(t);
820
768
  const e = C(o, "author");
821
769
  e == null || e.focus();
822
770
  }
823
- function zt(t, o) {
771
+ function It(t, o) {
824
772
  const e = nt(t);
825
773
  return (typeof o == "boolean" ? o : !e) ? z(t) : U(t, !1), !0;
826
774
  }
827
- function oe(t) {
828
- const o = t.key.toLowerCase();
829
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "c";
775
+ function mt(t) {
776
+ return typeof t.key == "string" ? t.key.toLowerCase() : "";
830
777
  }
831
778
  function ie(t) {
832
- const o = t.key.toLowerCase();
833
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "b";
779
+ const o = mt(t);
780
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "c";
834
781
  }
835
782
  function re(t) {
836
- const o = t.key.toLowerCase();
837
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "j";
783
+ const o = mt(t);
784
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "b";
838
785
  }
839
786
  function ae(t) {
787
+ const o = mt(t);
788
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "j";
789
+ }
790
+ function se(t) {
840
791
  M = t, I || (I = (o) => {
841
792
  const e = o.target, i = e == null ? void 0 : e.closest($);
842
- if (!i)
843
- return;
793
+ if (!i) return;
844
794
  p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
845
795
  const n = v.get(i);
846
796
  n && (tt(n, i), ct(i, n)), it(i, "toggleCitationsPanel", nt(i));
847
797
  }, document.addEventListener("focusin", I, !0)), B || (B = (o) => {
848
798
  const e = o.target, i = e == null ? void 0 : e.closest($);
849
- i && (p = i, kt(i));
799
+ i && (p = i, Tt(i));
850
800
  }, document.addEventListener("input", B, !0)), O || (O = (o) => {
851
- if (o.defaultPrevented)
852
- return;
801
+ if (o.defaultPrevented) return;
853
802
  const e = o.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), n = h(void 0, !1);
854
- if (!n || S(n))
855
- return;
803
+ if (!n || S(n)) return;
856
804
  const r = f.get(n) || M || t;
857
805
  if (f.set(n, r), p = n, o.key === "Escape" && nt(n)) {
858
806
  o.preventDefault(), U(n, !0);
859
807
  return;
860
808
  }
861
- if (!i && !Xt(o, n, r)) {
862
- if (oe(o)) {
863
- o.preventDefault(), o.stopPropagation(), zt(n);
809
+ if (!i && !Jt(o, n, r)) {
810
+ if (ie(o)) {
811
+ o.preventDefault(), o.stopPropagation(), It(n);
864
812
  return;
865
813
  }
866
- if (ie(o)) {
814
+ if (re(o)) {
867
815
  o.preventDefault(), o.stopPropagation(), y(n, r, !0), z(n);
868
816
  return;
869
817
  }
870
- re(o) && (o.preventDefault(), o.stopPropagation(), bt(n, r));
818
+ ae(o) && (o.preventDefault(), o.stopPropagation(), bt(n, r));
871
819
  }
872
820
  }, document.addEventListener("keydown", O, !0)), k || (k = () => {
873
821
  v.forEach((o, e) => {
874
822
  if (!e.isConnected || !o.isConnected) {
875
- At(e), o.remove(), v.delete(e), V.delete(e);
823
+ kt(e), o.remove(), v.delete(e), V.delete(e);
876
824
  return;
877
825
  }
878
826
  tt(o, e), ct(e, o);
879
827
  });
880
828
  }, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
881
829
  }
882
- function se() {
830
+ function ce() {
883
831
  I && (document.removeEventListener("focusin", I, !0), I = null), B && (document.removeEventListener("input", B, !0), B = null), O && (document.removeEventListener("keydown", O, !0), O = null), k && (window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k), k = null), v.forEach((t) => t.remove()), v.clear(), M = null, p = null;
884
832
  }
885
- function ce() {
886
- if (typeof document == "undefined" || document.getElementById(gt))
887
- return;
833
+ function le() {
834
+ if (typeof document == "undefined" || document.getElementById(pt)) return;
888
835
  const t = document.createElement("style");
889
- t.id = gt, t.textContent = `
836
+ t.id = pt, t.textContent = `
890
837
  .rte-toolbar-group-items.citations,
891
838
  .editora-toolbar-group-items.citations {
892
839
  display: flex;
@@ -1356,9 +1303,9 @@ function ce() {
1356
1303
  }
1357
1304
  `, document.head.appendChild(t);
1358
1305
  }
1359
- const le = (t = {}) => {
1306
+ const ue = (t = {}) => {
1360
1307
  const o = Z(t);
1361
- return ce(), {
1308
+ return le(), {
1362
1309
  name: "citations",
1363
1310
  toolbar: [
1364
1311
  {
@@ -1394,24 +1341,21 @@ const le = (t = {}) => {
1394
1341
  commands: {
1395
1342
  citations: (e, i) => {
1396
1343
  const n = h(i);
1397
- if (!n || S(n))
1398
- return !1;
1344
+ if (!n || S(n)) return !1;
1399
1345
  const r = f.get(n) || o;
1400
1346
  return f.set(n, r), T.set(n, N(n, r)), p = n, z(n), y(n, r, !1), !0;
1401
1347
  },
1402
1348
  toggleCitationsPanel: (e, i) => {
1403
1349
  const n = h(i);
1404
- if (!n || S(n))
1405
- return !1;
1350
+ if (!n || S(n)) return !1;
1406
1351
  const r = f.get(n) || o;
1407
1352
  f.set(n, r), p = n;
1408
- const a = zt(n, typeof e == "boolean" ? e : void 0);
1353
+ const a = It(n, typeof e == "boolean" ? e : void 0);
1409
1354
  return nt(n) && y(n, r, !1), a;
1410
1355
  },
1411
1356
  insertCitation: (e, i) => {
1412
1357
  const n = h(i);
1413
- if (!n || S(n) || !e || typeof e != "object")
1414
- return !1;
1358
+ if (!n || S(n) || !e || typeof e != "object") return !1;
1415
1359
  const r = f.get(n) || o;
1416
1360
  f.set(n, r), p = n;
1417
1361
  const a = et(n, e, r);
@@ -1419,30 +1363,26 @@ const le = (t = {}) => {
1419
1363
  },
1420
1364
  refreshCitations: (e, i) => {
1421
1365
  const n = h(i);
1422
- if (!n)
1423
- return !1;
1366
+ if (!n) return !1;
1424
1367
  const r = f.get(n) || o;
1425
1368
  return f.set(n, r), p = n, y(n, r, !0), z(n), !0;
1426
1369
  },
1427
1370
  setCitationStyle: (e, i) => {
1428
1371
  const n = h(i);
1429
- if (!n || !e)
1430
- return !1;
1372
+ if (!n || !e) return !1;
1431
1373
  const r = f.get(n) || o;
1432
- return f.set(n, r), p = n, Nt(n, e, r), !0;
1374
+ return f.set(n, r), p = n, zt(n, e, r), !0;
1433
1375
  },
1434
1376
  cycleCitationStyle: (e, i) => {
1435
1377
  const n = h(i);
1436
- if (!n)
1437
- return !1;
1378
+ if (!n) return !1;
1438
1379
  const r = f.get(n) || o;
1439
1380
  return f.set(n, r), p = n, bt(n, r), H(n), !0;
1440
1381
  },
1441
1382
  getCitationRecords: (e, i) => {
1442
1383
  const n = h(i);
1443
- if (!n)
1444
- return !1;
1445
- const r = f.get(n) || o, a = K(n, r);
1384
+ if (!n) return !1;
1385
+ const r = f.get(n) || o, a = j(n, r);
1446
1386
  if (typeof e == "function")
1447
1387
  try {
1448
1388
  e(a);
@@ -1460,8 +1400,7 @@ const le = (t = {}) => {
1460
1400
  },
1461
1401
  setCitationsOptions: (e, i) => {
1462
1402
  const n = h(i);
1463
- if (!n || !e || typeof e != "object")
1464
- return !1;
1403
+ if (!n || !e || typeof e != "object") return !1;
1465
1404
  const r = f.get(n) || o, a = Z({
1466
1405
  ...r,
1467
1406
  ...e,
@@ -1476,27 +1415,23 @@ const le = (t = {}) => {
1476
1415
  },
1477
1416
  locateCitation: (e, i) => {
1478
1417
  const n = h(i);
1479
- return !n || typeof e != "string" ? !1 : Zt(n, e);
1418
+ return !n || typeof e != "string" ? !1 : Qt(n, e);
1480
1419
  },
1481
1420
  deleteCitation: (e, i) => {
1482
1421
  const n = h(i);
1483
- if (!n || S(n))
1484
- return !1;
1422
+ if (!n || S(n)) return !1;
1485
1423
  const r = f.get(n) || o;
1486
- return f.set(n, r), typeof e == "string" && e.trim() ? Rt(n, e, r) : Jt(n, r);
1424
+ return f.set(n, r), typeof e == "string" && e.trim() ? Nt(n, e, r) : Zt(n, r);
1487
1425
  },
1488
1426
  insertRecentCitation: (e, i) => {
1489
1427
  const n = h(i);
1490
- if (!n || S(n))
1491
- return !1;
1428
+ if (!n || S(n)) return !1;
1492
1429
  const r = f.get(n) || o;
1493
1430
  f.set(n, r);
1494
- const a = K(n, r), s = rt(n, a, r);
1495
- if (s.length === 0)
1496
- return !1;
1497
- const d = typeof e == "string" && e.trim() ? Et(n, e, a, r) : s[0];
1498
- if (!d)
1499
- return !1;
1431
+ const a = j(n, r), s = rt(n, a, r);
1432
+ if (s.length === 0) return !1;
1433
+ const d = typeof e == "string" && e.trim() ? $t(n, e, a, r) : s[0];
1434
+ if (!d) return !1;
1500
1435
  const c = et(n, d, r);
1501
1436
  return c && z(n), c;
1502
1437
  }
@@ -1512,21 +1447,21 @@ const le = (t = {}) => {
1512
1447
  init: function(i) {
1513
1448
  Y += 1;
1514
1449
  const n = this && typeof this.__pluginConfig == "object" ? Z({ ...o, ...this.__pluginConfig }) : o;
1515
- ae(n);
1450
+ se(n);
1516
1451
  const r = h(
1517
1452
  i && i.editorElement ? { editorElement: i.editorElement } : void 0,
1518
1453
  !1
1519
1454
  );
1520
- r && (p = r, f.set(r, n), T.set(r, n.defaultStyle), it(r, "toggleCitationsPanel", !1), kt(r));
1455
+ r && (p = r, f.set(r, n), T.set(r, n.defaultStyle), it(r, "toggleCitationsPanel", !1), Tt(r));
1521
1456
  },
1522
1457
  destroy: () => {
1523
1458
  Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((e) => {
1524
1459
  window.clearTimeout(e);
1525
- }), q.clear(), se());
1460
+ }), q.clear(), ce());
1526
1461
  }
1527
1462
  };
1528
1463
  };
1529
1464
  export {
1530
- le as CitationsPlugin
1465
+ ue as CitationsPlugin
1531
1466
  };
1532
- //# sourceMappingURL=CitationsPlugin.native-169fb1e8.mjs.map
1467
+ //# sourceMappingURL=CitationsPlugin.native-DQgoCd1B.mjs.map