@editora/core 1.0.15 → 1.0.16

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 (68) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/editora.min.js +26 -24
  44. package/dist/editora.umd.js +26 -24
  45. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  46. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  47. package/dist/index-B1_vtXRz.mjs +3910 -0
  48. package/dist/index-C6BoNR2t.js +12 -0
  49. package/dist/index.cjs.js +3 -3
  50. package/dist/index.esm.js +17 -14
  51. package/dist/plugin-loader.js +53 -52
  52. package/dist/webcomponent-core.js +2039 -473
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +96 -66
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +2208 -641
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1564 -1198
  60. package/index.d.ts +32 -0
  61. package/package.json +10 -3
  62. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  63. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  64. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  65. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  66. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  67. package/dist/index-BLm1MtzH.js +0 -10
  68. package/dist/index-Cd9jEuZP.mjs +0 -2341
@@ -1,4 +1,4 @@
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 = {
1
+ const S = ".rte-content, .editora-content", ht = "rte-citations-styles", m = "rte-citations-panel", it = ".rte-citation-ref[data-citation-id]", G = '.rte-citation-bibliography[data-type="citation-bibliography"]', V = '.rte-citation-footnotes[data-type="citation-footnotes"]', x = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', L = ["apa", "mla", "chicago"], Pt = {
2
2
  panelTitle: "Citations",
3
3
  panelAriaLabel: "Citations panel",
4
4
  styleLabel: "Citation style",
@@ -19,176 +19,168 @@ const $ = ".rte-content, .editora-content", pt = "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(), 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;
22
+ }, f = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), xt = /* @__PURE__ */ new WeakMap(), H = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new Set();
23
+ let B = null, O = null, P = null, k = null, X = 0, Dt = 0, st = 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 Dt(t) {
27
+ function Ht(t) {
28
28
  return t.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
29
29
  }
30
- function xt(t, o) {
31
- const e = o(t);
30
+ function yt(t, n) {
31
+ const e = n(t);
32
32
  if (!e) return "";
33
33
  const i = e.match(/\d{4}/);
34
34
  return i ? i[0] : e;
35
35
  }
36
- function yt(t, o) {
37
- const e = o(t);
36
+ function Ct(t, n) {
37
+ const e = n(t);
38
38
  return e ? /^https?:\/\//i.test(e) ? e : `https://${e}` : "";
39
39
  }
40
- function F(t) {
40
+ function _(t) {
41
41
  return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
42
42
  }
43
- function Ct(t, o) {
43
+ function wt(t, n) {
44
44
  return {
45
- id: F(o.normalizeText(t.id || "")),
46
- author: o.normalizeText(t.author || ""),
47
- year: xt(t.year || "", o.normalizeText) || void 0,
48
- title: o.normalizeText(t.title || ""),
49
- source: o.normalizeText(t.source || "") || void 0,
50
- url: yt(t.url || "", o.normalizeText) || void 0,
51
- note: o.normalizeText(t.note || "") || void 0
45
+ id: _(n.normalizeText(t.id || "")),
46
+ author: n.normalizeText(t.author || ""),
47
+ year: yt(t.year || "", n.normalizeText) || void 0,
48
+ title: n.normalizeText(t.title || ""),
49
+ source: n.normalizeText(t.source || "") || void 0,
50
+ url: Ct(t.url || "", n.normalizeText) || void 0,
51
+ note: n.normalizeText(t.note || "") || void 0
52
52
  };
53
53
  }
54
- function Z(t = {}) {
55
- var i, n;
56
- const o = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", e = {
57
- ...Ot,
54
+ function Q(t = {}) {
55
+ var i, o;
56
+ const n = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", e = {
57
+ ...Pt,
58
58
  ...t.labels || {}
59
59
  };
60
60
  return {
61
- defaultStyle: o,
61
+ defaultStyle: n,
62
62
  enableFootnoteSync: t.enableFootnoteSync !== !1,
63
63
  debounceMs: Math.max(80, Number((i = t.debounceMs) != null ? i : 220)),
64
- maxRecentCitations: Math.max(3, Math.min(30, Number((n = t.maxRecentCitations) != null ? n : 8))),
64
+ maxRecentCitations: Math.max(3, Math.min(30, Number((o = t.maxRecentCitations) != null ? o : 8))),
65
65
  labels: e,
66
- normalizeText: t.normalizeText || Dt,
66
+ normalizeText: t.normalizeText || Ht,
67
67
  generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
68
68
  };
69
69
  }
70
- function wt(t) {
70
+ function vt(t) {
71
71
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
72
72
  }
73
- function lt(t) {
73
+ function ut(t) {
74
74
  return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || t;
75
75
  }
76
- function X(t) {
76
+ function J(t) {
77
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;
78
78
  }
79
- function Ht(t) {
80
- const o = lt(t);
81
- if (X(o)) return !0;
82
- const e = o.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
83
- return X(e) ? !0 : X(document.documentElement) || X(document.body);
79
+ function Ft(t) {
80
+ const n = ut(t);
81
+ if (J(n)) return !0;
82
+ const e = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
83
+ return J(e) ? !0 : J(document.documentElement) || J(document.body);
84
84
  }
85
- function tt(t, o) {
86
- t.classList.remove("rte-citations-theme-dark"), Ht(o) && t.classList.add("rte-citations-theme-dark");
85
+ function et(t, n) {
86
+ t.classList.remove("rte-citations-theme-dark"), Ft(n) && t.classList.add("rte-citations-theme-dark");
87
87
  }
88
- function h(t, o = !0) {
88
+ function h(t, n = !0) {
89
89
  if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
90
90
  if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
91
- const n = t.editorElement;
92
- if (n.matches($)) return n;
93
- const r = n.querySelector($);
91
+ const o = t.editorElement;
92
+ if (o.matches(S)) return o;
93
+ const r = o.querySelector(S);
94
94
  if (r instanceof HTMLElement) return r;
95
95
  }
96
96
  const e = window.getSelection();
97
97
  if (e && e.rangeCount > 0) {
98
- const n = e.getRangeAt(0).startContainer, r = wt(n), a = r == null ? void 0 : r.closest($);
98
+ const o = e.getRangeAt(0).startContainer, r = vt(o), a = r == null ? void 0 : r.closest(S);
99
99
  if (a) return a;
100
100
  }
101
101
  const i = document.activeElement;
102
102
  if (i) {
103
- if (i.matches($)) return i;
104
- const n = i.closest($);
105
- if (n) return n;
103
+ if (i.matches(S)) return i;
104
+ const o = i.closest(S);
105
+ if (o) return o;
106
106
  }
107
- return p && p.isConnected ? p : (p && !p.isConnected && (p = null), o ? document.querySelector($) : null);
107
+ return p && p.isConnected ? p : (p && !p.isConnected && (p = null), n ? document.querySelector(S) : null);
108
108
  }
109
- function S(t) {
109
+ function $(t) {
110
110
  return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
111
111
  }
112
- function K(t) {
113
- const o = wt(t);
114
- return o ? !!(o.closest(W) || o.closest(G)) : !1;
112
+ function j(t) {
113
+ const n = vt(t);
114
+ return n ? !!(n.closest(G) || n.closest(V)) : !1;
115
115
  }
116
- function Ft(t, o) {
117
- if (at += 1, o.generateCitationId) {
118
- const e = o.generateCitationId({ editor: t, index: at }), i = F(o.normalizeText(e || ""));
116
+ function _t(t, n) {
117
+ if (st += 1, n.generateCitationId) {
118
+ const e = n.generateCitationId({ editor: t, index: st }), i = _(n.normalizeText(e || ""));
119
119
  if (i) return i;
120
120
  }
121
- return `cite-${Date.now().toString(36)}-${at.toString(36)}`;
121
+ return `cite-${Date.now().toString(36)}-${st.toString(36)}`;
122
122
  }
123
- function st(t) {
124
- return t.map((o) => (o || "").trim()).filter(Boolean).join(" ").trim();
123
+ function ct(t) {
124
+ return t.map((n) => (n || "").trim()).filter(Boolean).join(" ").trim();
125
125
  }
126
- function _t(t, o) {
126
+ function qt(t, n) {
127
127
  const e = t.author || "Unknown", i = t.year || "n.d.";
128
- return o === "mla" ? `(${e} ${i})` : o === "chicago" ? `(${e} ${i})` : `(${e}, ${i})`;
129
- }
130
- function ut(t, o) {
131
- const e = t.author || "Unknown", i = t.year || "n.d.", n = t.title || "Untitled", r = t.source || "", a = t.url || "";
132
- return st(o === "mla" ? [
133
- `${e}.`,
134
- `"${n}."`,
135
- r ? `${r},` : "",
128
+ return n === "mla" ? `(${e} ${i})` : n === "chicago" ? `(${e} ${i})` : `(${e}, ${i})`;
129
+ }
130
+ function N(t) {
131
+ const n = t.trim();
132
+ return !n || /[.!?]$/.test(n) ? n : `${n}.`;
133
+ }
134
+ function dt(t, n) {
135
+ const e = N(t.author || "Unknown"), i = t.year || "n.d.", o = t.title || "Untitled", r = (t.source || "").trim(), a = t.url || "";
136
+ return ct(n === "mla" ? [
137
+ e,
138
+ `"${N(o)}"`,
139
+ r ? `${r.replace(/[.,]$/, "")},` : "",
136
140
  `${i}.`,
137
141
  a
138
- ] : o === "chicago" ? [
139
- `${e}.`,
140
- `${n}.`,
141
- r ? `${r}.` : "",
142
- `(${i}).`,
143
- a
144
- ] : [
145
- `${e}.`,
146
- `(${i}).`,
147
- `${n}.`,
148
- r ? `${r}.` : "",
149
- a
150
- ]);
142
+ ] : n === "chicago" ? [e, N(o), N(r), `(${i}).`, a] : [e, `(${i}).`, N(o), N(r), a]);
151
143
  }
152
144
  function R(t) {
153
- return Array.from(t.querySelectorAll(ot)).filter(
154
- (o) => !o.closest(W) && !o.closest(G)
145
+ return Array.from(t.querySelectorAll(it)).filter(
146
+ (n) => !n.closest(G) && !n.closest(V)
155
147
  );
156
148
  }
157
- function vt(t, o) {
158
- const e = F(o.normalizeText(t.getAttribute("data-citation-id") || ""));
149
+ function Et(t, n) {
150
+ const e = _(n.normalizeText(t.getAttribute("data-citation-id") || ""));
159
151
  if (!e) return null;
160
- const i = o.normalizeText(t.getAttribute("data-citation-author") || ""), n = o.normalizeText(t.getAttribute("data-citation-title") || "");
152
+ const i = n.normalizeText(t.getAttribute("data-citation-author") || ""), o = n.normalizeText(t.getAttribute("data-citation-title") || "");
161
153
  return {
162
154
  id: e,
163
155
  author: i || "Unknown",
164
- year: xt(t.getAttribute("data-citation-year") || "", o.normalizeText) || void 0,
165
- title: n || "Untitled",
166
- source: o.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
167
- url: yt(t.getAttribute("data-citation-url") || "", o.normalizeText) || void 0,
168
- note: o.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
156
+ year: yt(t.getAttribute("data-citation-year") || "", n.normalizeText) || void 0,
157
+ title: o || "Untitled",
158
+ source: n.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
159
+ url: Ct(t.getAttribute("data-citation-url") || "", n.normalizeText) || void 0,
160
+ note: n.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
169
161
  };
170
162
  }
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);
163
+ function St(t, n, e) {
164
+ t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", n.id), t.setAttribute("data-citation-author", n.author || ""), t.setAttribute("data-citation-year", n.year || ""), t.setAttribute("data-citation-title", n.title || ""), t.setAttribute("data-citation-source", n.source || ""), t.setAttribute("data-citation-url", n.url || ""), t.setAttribute("data-citation-note", n.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", e), t.textContent = qt(n, e);
173
165
  }
174
- function it(t, o, e) {
175
- const i = lt(t);
166
+ function rt(t, n, e) {
167
+ const i = ut(t);
176
168
  Array.from(
177
169
  i.querySelectorAll(
178
- `.rte-toolbar-button[data-command="${o}"], .editora-toolbar-button[data-command="${o}"]`
170
+ `.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
179
171
  )
180
172
  ).forEach((r) => {
181
173
  r.classList.toggle("active", e), r.setAttribute("data-active", e ? "true" : "false"), r.setAttribute("aria-pressed", e ? "true" : "false");
182
174
  });
183
175
  }
184
- function N(t, o) {
176
+ function z(t, n) {
185
177
  const e = T.get(t);
186
- return e && L.includes(e) ? e : (o == null ? void 0 : o.defaultStyle) || "apa";
178
+ return e && L.includes(e) ? e : (n == null ? void 0 : n.defaultStyle) || "apa";
187
179
  }
188
- function j(t, o) {
180
+ function U(t, n) {
189
181
  const e = R(t), i = /* @__PURE__ */ new Map();
190
- return e.forEach((n) => {
191
- const r = vt(n, o);
182
+ return e.forEach((o) => {
183
+ const r = Et(o, n);
192
184
  if (!r) return;
193
185
  if (!i.has(r.id)) {
194
186
  i.set(r.id, r);
@@ -206,80 +198,80 @@ function j(t, o) {
206
198
  });
207
199
  }), Array.from(i.values());
208
200
  }
209
- function qt(t, o, e) {
210
- const i = Ct(o, e);
201
+ function Kt(t, n, e) {
202
+ const i = wt(n, e);
211
203
  if (!i.id || !i.author || !i.title) return;
212
- const r = (D.get(t) || []).filter((a) => a.id !== i.id);
213
- D.set(t, [i, ...r].slice(0, e.maxRecentCitations));
204
+ const r = (H.get(t) || []).filter((a) => a.id !== i.id);
205
+ H.set(t, [i, ...r].slice(0, e.maxRecentCitations));
214
206
  }
215
- function rt(t, o, e) {
216
- const i = D.get(t) || [], n = /* @__PURE__ */ new Map();
217
- o.slice(Math.max(0, o.length - e.maxRecentCitations)).reverse().forEach((a) => {
218
- a.id && n.set(a.id, a);
207
+ function at(t, n, e) {
208
+ const i = H.get(t) || [], o = /* @__PURE__ */ new Map();
209
+ n.slice(Math.max(0, n.length - e.maxRecentCitations)).reverse().forEach((a) => {
210
+ a.id && o.set(a.id, a);
219
211
  }), i.forEach((a) => {
220
- !a.id || n.has(a.id) || n.set(a.id, a);
212
+ !a.id || o.has(a.id) || o.set(a.id, a);
221
213
  });
222
- const r = Array.from(n.values()).slice(0, e.maxRecentCitations);
223
- return D.set(t, r), r;
214
+ const r = Array.from(o.values()).slice(0, e.maxRecentCitations);
215
+ return H.set(t, r), r;
224
216
  }
225
- function $t(t, o, e, i) {
226
- const n = F(i.normalizeText(o || ""));
227
- return n && rt(t, e, i).find((a) => a.id === n) || null;
217
+ function $t(t, n, e, i) {
218
+ const o = _(i.normalizeText(n || ""));
219
+ return o && at(t, e, i).find((a) => a.id === o) || null;
228
220
  }
229
- function Kt(t, o, e) {
230
- const i = F(e.normalizeText(o || ""));
221
+ function jt(t, n, e) {
222
+ const i = _(e.normalizeText(n || ""));
231
223
  if (!i) return !1;
232
- const n = D.get(t) || [], r = n.filter((a) => a.id !== i);
233
- return r.length === n.length ? !1 : (D.set(t, r), !0);
224
+ const o = H.get(t) || [], r = o.filter((a) => a.id !== i);
225
+ return r.length === o.length ? !1 : (H.set(t, r), !0);
234
226
  }
235
- function St(t, o, e) {
227
+ function At(t, n, e) {
236
228
  const i = document.createElement("section");
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");
238
- const n = document.createElement("h3");
239
- n.className = "rte-citation-section-title", n.textContent = e;
229
+ i.className = t, i.setAttribute("data-type", n), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", e), n === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : n === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
230
+ const o = document.createElement("h3");
231
+ o.className = "rte-citation-section-title", o.textContent = e;
240
232
  const r = document.createElement("ol");
241
- return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(n), i.appendChild(r), i;
233
+ return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(o), i.appendChild(r), i;
242
234
  }
243
- function jt(t, o) {
244
- let e = t.querySelector(W);
245
- e || (e = St("rte-citation-bibliography", "citation-bibliography", o.labels.bibliographyTitle), t.appendChild(e));
235
+ function Ut(t, n) {
236
+ let e = t.querySelector(G);
237
+ e || (e = At("rte-citation-bibliography", "citation-bibliography", n.labels.bibliographyTitle), t.appendChild(e));
246
238
  const i = e.querySelector(".rte-citation-section-title");
247
- return i && (i.textContent = o.labels.bibliographyTitle), e.setAttribute("aria-label", o.labels.bibliographyTitle), e;
239
+ return i && (i.textContent = n.labels.bibliographyTitle), e.setAttribute("aria-label", n.labels.bibliographyTitle), e;
248
240
  }
249
- function Ut(t, o) {
250
- let e = t.querySelector(G);
251
- e || (e = St("rte-citation-footnotes", "citation-footnotes", o.labels.footnotesTitle), t.appendChild(e));
241
+ function Wt(t, n) {
242
+ let e = t.querySelector(V);
243
+ e || (e = At("rte-citation-footnotes", "citation-footnotes", n.labels.footnotesTitle), t.appendChild(e));
252
244
  const i = e.querySelector(".rte-citation-section-title");
253
- return i && (i.textContent = o.labels.footnotesTitle), e.setAttribute("aria-label", o.labels.footnotesTitle), e;
245
+ return i && (i.textContent = n.labels.footnotesTitle), e.setAttribute("aria-label", n.labels.footnotesTitle), e;
254
246
  }
255
- function At(t, o) {
256
- const e = t.querySelector(o);
247
+ function kt(t, n) {
248
+ const e = t.querySelector(n);
257
249
  e == null || e.remove();
258
250
  }
259
- function Wt(t, o, e, i) {
260
- if (o.length === 0) {
261
- At(t, W);
251
+ function Gt(t, n, e, i) {
252
+ if (n.length === 0) {
253
+ kt(t, G);
262
254
  return;
263
255
  }
264
- const r = jt(t, e).querySelector(".rte-citation-list");
256
+ const r = Ut(t, e).querySelector(".rte-citation-list");
265
257
  if (!r) return;
266
258
  const a = document.createDocumentFragment();
267
- o.forEach((s, d) => {
259
+ n.forEach((s, d) => {
268
260
  const c = document.createElement("li");
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);
261
+ 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 = dt(s, i), a.appendChild(c);
270
262
  }), r.innerHTML = "", r.appendChild(a);
271
263
  }
272
- function Gt(t, o, e, i) {
273
- if (!e.enableFootnoteSync || o.length === 0) {
274
- At(t, G), R(t).forEach((l) => {
264
+ function Vt(t, n, e, i) {
265
+ if (!e.enableFootnoteSync || n.length === 0) {
266
+ kt(t, V), R(t).forEach((l) => {
275
267
  l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
276
268
  });
277
269
  return;
278
270
  }
279
- const r = Ut(t, e).querySelector(".rte-citation-list");
271
+ const r = Wt(t, e).querySelector(".rte-citation-list");
280
272
  if (!r) return;
281
273
  const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
282
- o.forEach((l, u) => {
274
+ n.forEach((l, u) => {
283
275
  s.set(l.id, u + 1);
284
276
  });
285
277
  const d = /* @__PURE__ */ new Map();
@@ -294,42 +286,42 @@ function Gt(t, o, e, i) {
294
286
  l.setAttribute("data-footnote-number", String(A)), l.setAttribute("data-footnote-target", `rte-citation-note-${u}`), a.has(u) || a.set(u, w);
295
287
  });
296
288
  const c = document.createDocumentFragment();
297
- o.forEach((l, u) => {
289
+ n.forEach((l, u) => {
298
290
  const b = document.createElement("li");
299
291
  b.className = "rte-citation-item rte-citation-footnote-item", b.id = `rte-citation-note-${l.id}`, b.setAttribute("data-citation-id", l.id);
300
292
  const w = document.createElement("span");
301
293
  w.className = "rte-citation-footnote-number", w.textContent = `${u + 1}. `;
302
294
  const A = document.createElement("span");
303
295
  A.className = "rte-citation-footnote-text";
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) {
308
- const _ = document.createElement("a");
309
- _.className = "rte-citation-backref", _.href = `#${gt}`, _.setAttribute("aria-label", `Back to citation ${u + 1}`), _.textContent = "Back", b.appendChild(_);
296
+ const Ot = l.note ? `${l.note}. ` : "";
297
+ A.textContent = `${Ot}${dt(l, i)}`, b.appendChild(w), b.appendChild(A);
298
+ const pt = a.get(l.id);
299
+ if (pt) {
300
+ const q = document.createElement("a");
301
+ q.className = "rte-citation-backref", q.href = `#${pt}`, q.setAttribute("aria-label", `Back to citation ${u + 1}`), q.textContent = "Back", b.appendChild(q);
310
302
  }
311
303
  c.appendChild(b);
312
304
  }), r.innerHTML = "", r.appendChild(c);
313
305
  }
314
- function Vt(t, o, e, i) {
315
- const n = ut(o, e);
316
- t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${n}`);
306
+ function Yt(t, n, e, i) {
307
+ const o = dt(n, e);
308
+ t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${o}`);
317
309
  }
318
- function Yt(t, o, e) {
310
+ function Xt(t, n, e) {
319
311
  const i = R(t);
320
- let n = `${o}:${e ? "1" : "0"}:${i.length}`;
312
+ let o = `${n}:${e ? "1" : "0"}:${i.length}`;
321
313
  return i.forEach((r) => {
322
- n += `|${r.getAttribute("data-citation-id") || ""}`, n += `|${r.getAttribute("data-citation-author") || ""}`, n += `|${r.getAttribute("data-citation-year") || ""}`, n += `|${r.getAttribute("data-citation-title") || ""}`, n += `|${r.getAttribute("data-citation-source") || ""}`, n += `|${r.getAttribute("data-citation-url") || ""}`, n += `|${r.getAttribute("data-citation-note") || ""}`;
323
- }), n;
314
+ o += `|${r.getAttribute("data-citation-id") || ""}`, o += `|${r.getAttribute("data-citation-author") || ""}`, o += `|${r.getAttribute("data-citation-year") || ""}`, o += `|${r.getAttribute("data-citation-title") || ""}`, o += `|${r.getAttribute("data-citation-source") || ""}`, o += `|${r.getAttribute("data-citation-url") || ""}`, o += `|${r.getAttribute("data-citation-note") || ""}`;
315
+ }), o;
324
316
  }
325
- function H(t) {
326
- const o = v.get(t);
327
- if (!o) return;
317
+ function F(t) {
318
+ const n = v.get(t);
319
+ if (!n) return;
328
320
  const e = f.get(t) || M;
329
321
  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");
322
+ const i = z(t, e), o = U(t, e), r = at(t, o, e), a = n.querySelector(".rte-citations-status"), s = n.querySelector('[data-action="cycle-style"]'), d = n.querySelector(".rte-citations-recent-list");
331
323
  if (a) {
332
- const c = n.length;
324
+ const c = o.length;
333
325
  a.textContent = `${e.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${e.enableFootnoteSync ? "On" : "Off"}`;
334
326
  }
335
327
  if (s && (s.textContent = `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), d) {
@@ -364,189 +356,189 @@ function H(t) {
364
356
  ).join("");
365
357
  }
366
358
  }
367
- function y(t, o, e = !1) {
368
- const i = N(t, o), n = Yt(t, i, o.enableFootnoteSync);
369
- if (!e && ht.get(t) === n)
370
- return j(t, o);
359
+ function y(t, n, e = !1) {
360
+ const i = z(t, n), o = Xt(t, i, n.enableFootnoteSync);
361
+ if (!e && xt.get(t) === o)
362
+ return U(t, n);
371
363
  const r = R(t), a = /* @__PURE__ */ new Map();
372
364
  r.forEach((c) => {
373
- const l = vt(c, o);
365
+ const l = Et(c, n);
374
366
  l && (a.has(l.id) || a.set(l.id, l));
375
367
  });
376
368
  const s = Array.from(a.values());
377
- rt(t, s, o);
369
+ at(t, s, n);
378
370
  const d = /* @__PURE__ */ new Map();
379
371
  return s.forEach((c, l) => {
380
372
  d.set(c.id, l + 1);
381
373
  }), r.forEach((c) => {
382
374
  const l = c.getAttribute("data-citation-id") || "", u = a.get(l);
383
375
  if (!u) return;
384
- Et(c, u, i);
376
+ St(c, u, i);
385
377
  const b = d.get(u.id) || 1;
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(
378
+ Yt(c, u, i, Math.max(1, b));
379
+ }), Gt(t, s, n, i), Vt(t, s, n, i), xt.set(t, o), F(t), t.dispatchEvent(
388
380
  new CustomEvent("editora:citations-refreshed", {
389
381
  bubbles: !0,
390
382
  detail: {
391
383
  citations: s,
392
384
  style: i,
393
- footnoteSync: o.enableFootnoteSync
385
+ footnoteSync: n.enableFootnoteSync
394
386
  }
395
387
  })
396
388
  ), s;
397
389
  }
398
- function kt(t) {
399
- const o = Q.get(t);
400
- typeof o == "number" && (window.clearTimeout(o), q.delete(o), Q.delete(t));
401
- }
402
390
  function Tt(t) {
403
- const o = f.get(t) || M;
404
- if (!o) return;
405
- kt(t);
391
+ const n = tt.get(t);
392
+ typeof n == "number" && (window.clearTimeout(n), K.delete(n), tt.delete(t));
393
+ }
394
+ function Mt(t) {
395
+ const n = f.get(t) || M;
396
+ if (!n) return;
397
+ Tt(t);
406
398
  const e = window.setTimeout(() => {
407
- q.delete(e), Q.delete(t), y(t, o, !1);
408
- }, o.debounceMs);
409
- q.add(e), Q.set(t, e);
410
- }
411
- function Xt(t) {
412
- const o = window.getSelection();
413
- if (!o) throw new Error("Selection unavailable");
414
- if (o.rangeCount > 0) {
415
- const a = o.getRangeAt(0);
416
- if (t.contains(a.commonAncestorContainer) && !K(a.commonAncestorContainer))
399
+ K.delete(e), tt.delete(t), y(t, n, !1);
400
+ }, n.debounceMs);
401
+ K.add(e), tt.set(t, e);
402
+ }
403
+ function Jt(t) {
404
+ const n = window.getSelection();
405
+ if (!n) throw new Error("Selection unavailable");
406
+ if (n.rangeCount > 0) {
407
+ const a = n.getRangeAt(0);
408
+ if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
417
409
  return a.cloneRange();
418
410
  }
419
- const e = document.createRange(), i = t.querySelector(W), n = t.querySelector(G), r = i || n;
411
+ const e = document.createRange(), i = t.querySelector(G), o = t.querySelector(V), r = i || o;
420
412
  return r ? (e.setStartBefore(r), e.collapse(!0), e) : (e.selectNodeContents(t), e.collapse(!1), e);
421
413
  }
422
- function dt(t) {
414
+ function ft(t) {
423
415
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
424
416
  }
425
- function ft(t, o) {
426
- if (o === t.innerHTML) return;
417
+ function bt(t, n) {
418
+ if (n === t.innerHTML) return;
427
419
  const e = window.execEditorCommand || window.executeEditorCommand;
428
420
  if (typeof e == "function")
429
421
  try {
430
- e("recordDomTransaction", t, o, t.innerHTML);
422
+ e("recordDomTransaction", t, n, t.innerHTML);
431
423
  } catch (i) {
432
424
  }
433
425
  }
434
- function Mt(t, o) {
426
+ function Lt(t, n) {
435
427
  const e = window.getSelection();
436
428
  if (!e) return;
437
429
  const i = document.createRange();
438
430
  if (t.nodeType === Node.TEXT_NODE) {
439
- const n = t, r = Math.max(0, Math.min(o, n.length));
440
- i.setStart(n, r);
431
+ const o = t, r = Math.max(0, Math.min(n, o.length));
432
+ i.setStart(o, r);
441
433
  } else {
442
- const n = t.childNodes.length, r = Math.max(0, Math.min(o, n));
434
+ const o = t.childNodes.length, r = Math.max(0, Math.min(n, o));
443
435
  i.setStart(t, r);
444
436
  }
445
437
  i.collapse(!0), e.removeAllRanges(), e.addRange(i);
446
438
  }
447
- function Lt(t) {
439
+ function Rt(t) {
448
440
  if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
449
441
  return null;
450
- const o = t.startContainer.childNodes[t.startOffset];
451
- return !(o instanceof HTMLElement) || !o.matches(ot) ? null : o;
442
+ const n = t.startContainer.childNodes[t.startOffset];
443
+ return !(n instanceof HTMLElement) || !n.matches(it) ? null : n;
452
444
  }
453
- function J(t, o, e) {
454
- const { startContainer: i, startOffset: n } = t;
445
+ function Z(t, n, e) {
446
+ const { startContainer: i, startOffset: o } = t;
455
447
  if (i.nodeType === Node.ELEMENT_NODE) {
456
448
  const a = i;
457
449
  if (e === "previous") {
458
- if (n > 0) return a.childNodes[n - 1] || null;
459
- } else if (n < a.childNodes.length)
460
- return a.childNodes[n] || null;
450
+ if (o > 0) return a.childNodes[o - 1] || null;
451
+ } else if (o < a.childNodes.length)
452
+ return a.childNodes[o] || null;
461
453
  }
462
- if (i.nodeType === Node.TEXT_NODE && (e === "previous" && n < i.data.length || e === "next" && n > 0))
454
+ if (i.nodeType === Node.TEXT_NODE && (e === "previous" && o < i.data.length || e === "next" && o > 0))
463
455
  return null;
464
456
  let r = i;
465
- for (; r && r !== o; ) {
457
+ for (; r && r !== n; ) {
466
458
  const a = e === "previous" ? r.previousSibling : r.nextSibling;
467
459
  if (a) return a;
468
460
  r = r.parentNode;
469
461
  }
470
462
  return null;
471
463
  }
472
- function Rt(t, o, e) {
464
+ function zt(t, n, e) {
473
465
  if (!t.collapsed) return null;
474
- const i = (a) => a instanceof HTMLElement && a.matches(ot) ? a : null, { startContainer: n, startOffset: r } = t;
475
- if (n.nodeType === Node.ELEMENT_NODE) {
476
- const a = n;
466
+ const i = (a) => a instanceof HTMLElement && a.matches(it) ? a : null, { startContainer: o, startOffset: r } = t;
467
+ if (o.nodeType === Node.ELEMENT_NODE) {
468
+ const a = o;
477
469
  return e === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : e === "Delete" ? i(a.childNodes[r] || null) : null;
478
470
  }
479
- if (n.nodeType === Node.TEXT_NODE) {
480
- const a = n;
471
+ if (o.nodeType === Node.TEXT_NODE) {
472
+ const a = o;
481
473
  if (e === "Backspace" && r === 0) {
482
474
  const s = i(a.previousSibling);
483
- return s || i(J(t, o, "previous"));
475
+ return s || i(Z(t, n, "previous"));
484
476
  }
485
477
  if (e === "Delete" && r === a.data.length) {
486
478
  const s = i(a.nextSibling);
487
- return s || i(J(t, o, "next"));
479
+ return s || i(Z(t, n, "next"));
488
480
  }
489
481
  }
490
- return i(e === "Backspace" ? J(t, o, "previous") : J(t, o, "next"));
482
+ return i(e === "Backspace" ? Z(t, n, "previous") : Z(t, n, "next"));
491
483
  }
492
- function P(t, o, e) {
493
- const i = t.closest($);
494
- if (!i || K(t)) return !1;
495
- const n = t.parentNode;
496
- if (!n) return !1;
497
- const r = i.innerHTML, a = Array.from(n.childNodes).indexOf(t);
484
+ function D(t, n, e) {
485
+ const i = t.closest(S);
486
+ if (!i || j(t)) return !1;
487
+ const o = t.parentNode;
488
+ if (!o) return !1;
489
+ const r = i.innerHTML, a = Array.from(o.childNodes).indexOf(t);
498
490
  if (a < 0) return !1;
499
491
  const s = t.nextSibling;
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;
492
+ return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Lt(o, a), y(i, e, !0), bt(i, r), ft(i), n === "Delete" && i.focus({ preventScroll: !0 }), !0;
501
493
  }
502
- function Jt(t, o, e) {
494
+ function Zt(t, n, e) {
503
495
  if (t.key !== "Backspace" && t.key !== "Delete") return !1;
504
- const i = t.key, n = t.target;
505
- if (n != null && n.matches(ot) && o.contains(n) && !K(n))
506
- return t.preventDefault(), t.stopPropagation(), P(n, i, e);
496
+ const i = t.key, o = t.target;
497
+ if (o != null && o.matches(it) && n.contains(o) && !j(o))
498
+ return t.preventDefault(), t.stopPropagation(), D(o, i, e);
507
499
  const r = window.getSelection();
508
500
  if (!r || r.rangeCount === 0) return !1;
509
501
  const a = r.getRangeAt(0);
510
- if (!o.contains(a.commonAncestorContainer) || K(a.commonAncestorContainer)) return !1;
511
- const s = Lt(a);
502
+ if (!n.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer)) return !1;
503
+ const s = Rt(a);
512
504
  if (s)
513
- return t.preventDefault(), t.stopPropagation(), P(s, i, e);
514
- const d = Rt(a, o, i);
515
- return d ? (t.preventDefault(), t.stopPropagation(), P(d, i, e)) : !1;
505
+ return t.preventDefault(), t.stopPropagation(), D(s, i, e);
506
+ const d = zt(a, n, i);
507
+ return d ? (t.preventDefault(), t.stopPropagation(), D(d, i, e)) : !1;
516
508
  }
517
- function Nt(t, o, e) {
518
- const i = F(e.normalizeText(o || ""));
509
+ function Nt(t, n, e) {
510
+ const i = _(e.normalizeText(n || ""));
519
511
  if (!i) return !1;
520
- const n = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
521
- if (n.length === 0) return !1;
522
- if (n.length === 1)
523
- return P(n[0], "Delete", e);
512
+ const o = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
513
+ if (o.length === 0) return !1;
514
+ if (o.length === 1)
515
+ return D(o[0], "Delete", e);
524
516
  const r = t.innerHTML;
525
- return n.forEach((a) => {
517
+ return o.forEach((a) => {
526
518
  const s = a.nextSibling;
527
519
  s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
528
- }), Mt(t, t.childNodes.length), y(t, e, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
520
+ }), Lt(t, t.childNodes.length), y(t, e, !0), bt(t, r), ft(t), t.focus({ preventScroll: !0 }), !0;
529
521
  }
530
- function Zt(t, o) {
522
+ function Qt(t, n) {
531
523
  const e = window.getSelection();
532
524
  if (!e || e.rangeCount === 0) return !1;
533
525
  const i = e.getRangeAt(0);
534
- if (!t.contains(i.commonAncestorContainer) || K(i.commonAncestorContainer)) return !1;
535
- const n = Lt(i);
536
- if (n)
537
- return P(n, "Delete", o);
538
- const r = Rt(i, t, "Backspace");
539
- return r ? P(r, "Backspace", o) : !1;
540
- }
541
- function et(t, o, e) {
526
+ if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer)) return !1;
527
+ const o = Rt(i);
528
+ if (o)
529
+ return D(o, "Delete", n);
530
+ const r = zt(i, t, "Backspace");
531
+ return r ? D(r, "Backspace", n) : !1;
532
+ }
533
+ function nt(t, n, e) {
542
534
  var l, u;
543
- const i = Ct(o, e);
535
+ const i = wt(n, e);
544
536
  if (!i.author || !i.title) return !1;
545
- i.id || (i.id = Ft(t, e));
546
- const n = t.innerHTML;
537
+ i.id || (i.id = _t(t, e));
538
+ const o = t.innerHTML;
547
539
  let r;
548
540
  try {
549
- r = Xt(t);
541
+ r = Jt(t);
550
542
  } catch (b) {
551
543
  return !1;
552
544
  }
@@ -554,7 +546,7 @@ function et(t, o, e) {
554
546
  if (!a) return !1;
555
547
  r.collapsed || r.deleteContents();
556
548
  const s = document.createElement("span");
557
- Et(s, i, N(t, e));
549
+ St(s, i, z(t, e));
558
550
  try {
559
551
  r.insertNode(s);
560
552
  } catch (b) {
@@ -568,71 +560,73 @@ function et(t, o, e) {
568
560
  c.setStart(d.parentNode, Math.max(0, b));
569
561
  } else
570
562
  c.setStartAfter(s);
571
- return c.collapse(!0), a.removeAllRanges(), a.addRange(c), qt(t, i, e), y(t, e, !0), ft(t, n), dt(t), !0;
563
+ return c.collapse(!0), a.removeAllRanges(), a.addRange(c), Kt(t, i, e), y(t, e, !0), bt(t, o), ft(t), !0;
572
564
  }
573
- function Qt(t, o) {
574
- if (!o) return !1;
575
- const e = R(t).find((r) => r.getAttribute("data-citation-id") === o) || null;
565
+ function te(t, n) {
566
+ if (!n) return !1;
567
+ const e = R(t).find((r) => r.getAttribute("data-citation-id") === n) || null;
576
568
  if (!e) return !1;
577
569
  e.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 });
578
570
  const i = window.getSelection();
579
571
  if (!i) return !0;
580
- const n = document.createRange();
581
- return n.selectNode(e), i.removeAllRanges(), i.addRange(n), !0;
572
+ const o = document.createRange();
573
+ return o.selectNode(e), i.removeAllRanges(), i.addRange(o), !0;
582
574
  }
583
- function nt(t) {
584
- return V.get(t) === !0;
575
+ function ot(t) {
576
+ return Y.get(t) === !0;
585
577
  }
586
- function U(t, o = !1) {
578
+ function W(t, n = !1) {
587
579
  const e = v.get(t);
588
- e && (e.classList.remove("show"), V.set(t, !1), it(t, "toggleCitationsPanel", !1), o && t.focus({ preventScroll: !0 }));
580
+ e && (e.classList.remove("show"), Y.set(t, !1), rt(t, "toggleCitationsPanel", !1), n && t.focus({ preventScroll: !0 }));
589
581
  }
590
- function te(t) {
591
- v.forEach((o, e) => {
592
- e !== t && U(e, !1);
582
+ function ee(t) {
583
+ v.forEach((n, e) => {
584
+ e !== t && W(e, !1);
593
585
  });
594
586
  }
595
- function ct(t, o) {
596
- if (!o.classList.contains("show")) return;
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));
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`;
587
+ function lt(t, n) {
588
+ if (!n.classList.contains("show")) return;
589
+ const i = ut(t).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 380), r = Math.max(10, window.innerWidth - o - 10), a = Math.min(Math.max(10, i.right - o), r), s = Math.max(10, Math.min(window.innerHeight - 10 - 260, i.top + 10));
590
+ n.style.width = `${o}px`, n.style.left = `${a}px`, n.style.top = `${s}px`, n.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
599
591
  }
600
- function C(t, o) {
601
- return t.querySelector(`[data-field="${o}"]`);
592
+ function C(t, n) {
593
+ return t.querySelector(`[data-field="${n}"]`);
602
594
  }
603
- function ee(t) {
595
+ function ne(t) {
604
596
  var s, d, c, l, u, b;
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) || "";
597
+ const n = ((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) || "", o = ((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) || "";
606
598
  return {
607
- author: o,
599
+ author: n,
608
600
  year: e,
609
601
  title: i,
610
- source: n,
602
+ source: o,
611
603
  url: r,
612
604
  note: a
613
605
  };
614
606
  }
615
- function E(t, o) {
616
- const e = t.querySelector(".rte-citations-live");
617
- e && (e.textContent = o);
607
+ function E(t, n, e = !1) {
608
+ const i = t.querySelector(".rte-citations-live");
609
+ i && (i.textContent = n);
610
+ const o = t.querySelector(".rte-citations-status");
611
+ o && (o.textContent = n, o.classList.toggle("rte-citations-status-error", e));
618
612
  }
619
- function ne(t, o, e) {
620
- const i = C(o, "style");
621
- i && (i.value = N(t, e));
613
+ function oe(t, n, e) {
614
+ const i = C(n, "style");
615
+ i && (i.value = z(t, e));
622
616
  }
623
- function zt(t, o, e) {
624
- const i = L.includes(o) ? o : e.defaultStyle;
617
+ function It(t, n, e) {
618
+ const i = L.includes(n) ? n : e.defaultStyle;
625
619
  return T.set(t, i), y(t, e, !0), i;
626
620
  }
627
- function bt(t, o) {
628
- const e = N(t, o), i = L.indexOf(e), n = L[(i + 1) % L.length];
629
- return T.set(t, n), y(t, o, !0), n;
621
+ function mt(t, n) {
622
+ const e = z(t, n), i = L.indexOf(e), o = L[(i + 1) % L.length];
623
+ return T.set(t, o), y(t, n, !0), o;
630
624
  }
631
- function oe(t) {
632
- const o = v.get(t);
633
- if (o) return o;
634
- const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Pt++}`, n = document.createElement("section");
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 = `
625
+ function ie(t) {
626
+ const n = v.get(t);
627
+ if (n) return n;
628
+ const e = f.get(t) || M || Q(), i = `rte-citations-panel-${Dt++}`, o = document.createElement("section");
629
+ o.className = m, o.id = i, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", e.labels.panelAriaLabel), o.setAttribute("tabindex", "-1"), o.innerHTML = `
636
630
  <header class="rte-citations-header">
637
631
  <h2 class="rte-citations-title">${g(e.labels.panelTitle)}</h2>
638
632
  <button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(e.labels.closeText)}">✕</button>
@@ -686,69 +680,70 @@ function oe(t) {
686
680
  <ul class="rte-citations-recent-list" role="list"></ul>
687
681
  </section>
688
682
 
683
+ <p class="rte-citations-status" aria-hidden="true"></p>
689
684
  <p class="rte-citations-shortcut">Shortcut: Ctrl/Cmd + Alt + Shift + C</p>
690
685
  <span class="rte-citations-live" aria-live="polite"></span>
691
686
  </div>
692
- `, n.addEventListener("click", (a) => {
687
+ `, o.addEventListener("click", (a) => {
693
688
  const s = a.target;
694
689
  if (!s) return;
695
690
  const d = s.closest("[data-action]");
696
691
  if (!d) return;
697
692
  const c = d.getAttribute("data-action") || "", l = f.get(t) || M || e;
698
693
  if (f.set(t, l), c === "close") {
699
- U(t, !0);
694
+ W(t, !0);
700
695
  return;
701
696
  }
702
697
  if (c === "insert") {
703
- if (S(t)) return;
704
- const u = ee(n);
698
+ if ($(t)) return;
699
+ const u = ne(o);
705
700
  if (!l.normalizeText(u.author) || !l.normalizeText(u.title)) {
706
- E(n, l.labels.invalidMessage);
701
+ E(o, l.labels.invalidMessage, !0);
707
702
  return;
708
703
  }
709
- if (!et(t, u, l)) {
710
- E(n, l.labels.invalidMessage);
704
+ if (!nt(t, u, l)) {
705
+ E(o, l.labels.invalidMessage, !0);
711
706
  return;
712
707
  }
713
- E(n, "Citation inserted.");
714
- const w = C(n, "title"), A = C(n, "note");
708
+ E(o, "Citation inserted.");
709
+ const w = C(o, "title"), A = C(o, "note");
715
710
  w && (w.value = ""), A && (A.value = "");
716
711
  return;
717
712
  }
718
713
  if (c === "refresh") {
719
714
  const u = y(t, l, !0);
720
- E(n, `Refreshed ${u.length} citation${u.length === 1 ? "" : "s"}.`);
715
+ E(o, `Refreshed ${u.length} citation${u.length === 1 ? "" : "s"}.`);
721
716
  return;
722
717
  }
723
718
  if (c === "cycle-style") {
724
- const u = bt(t, l);
725
- ne(t, n, l), E(n, `Style changed to ${u.toUpperCase()}.`);
719
+ const u = mt(t, l);
720
+ oe(t, o, l), E(o, `Style changed to ${u.toUpperCase()}.`);
726
721
  return;
727
722
  }
728
723
  if (c === "insert-from-recent") {
729
- if (S(t)) return;
730
- const u = d.getAttribute("data-citation-id") || "", b = $t(t, u, j(t, l), l);
724
+ if ($(t)) return;
725
+ const u = d.getAttribute("data-citation-id") || "", b = $t(t, u, U(t, l), l);
731
726
  if (!b) return;
732
- et(t, b, l), E(n, `Inserted citation: ${b.title}.`);
727
+ nt(t, b, l), E(o, `Inserted citation: ${b.title}.`);
733
728
  return;
734
729
  }
735
730
  if (c === "delete-by-id") {
736
- if (S(t)) return;
731
+ if ($(t)) return;
737
732
  const u = d.getAttribute("data-citation-id") || "";
738
733
  if (Nt(t, u, l)) {
739
- E(n, "Citation deleted.");
734
+ E(o, "Citation deleted.");
740
735
  return;
741
736
  }
742
- Kt(t, u, l) && (H(t), E(n, "Removed from recent citations."));
737
+ jt(t, u, l) && (F(t), E(o, "Removed from recent citations."));
743
738
  }
744
- }), n.addEventListener("keydown", (a) => {
739
+ }), o.addEventListener("keydown", (a) => {
745
740
  if (a.key === "Escape") {
746
- a.preventDefault(), U(t, !0);
741
+ a.preventDefault(), W(t, !0);
747
742
  return;
748
743
  }
749
744
  const s = a.target;
750
745
  if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp") return;
751
- const d = Array.from(n.querySelectorAll(".rte-citations-recent-btn"));
746
+ const d = Array.from(o.querySelectorAll(".rte-citations-recent-btn"));
752
747
  if (d.length === 0) return;
753
748
  const c = d.indexOf(s);
754
749
  if (c < 0) return;
@@ -756,84 +751,84 @@ function oe(t) {
756
751
  const l = a.key === "ArrowDown" ? 1 : -1, u = (c + l + d.length) % d.length;
757
752
  d[u].focus();
758
753
  });
759
- const r = C(n, "style");
754
+ const r = C(o, "style");
760
755
  return r == null || r.addEventListener("change", () => {
761
756
  const a = f.get(t) || M || e, s = r.value;
762
- zt(t, s, a), E(n, `Style changed to ${s.toUpperCase()}.`);
763
- }), tt(n, t), document.body.appendChild(n), v.set(t, n), V.set(t, !1), H(t), n;
757
+ It(t, s, a), E(o, `Style changed to ${s.toUpperCase()}.`);
758
+ }), et(o, t), document.body.appendChild(o), v.set(t, o), Y.set(t, !1), F(t), o;
764
759
  }
765
- function z(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);
768
- const e = C(o, "author");
760
+ function I(t) {
761
+ const n = ie(t);
762
+ ee(t), n.classList.add("show"), Y.set(t, !0), rt(t, "toggleCitationsPanel", !0), et(n, t), lt(t, n), F(t);
763
+ const e = C(n, "author");
769
764
  e == null || e.focus();
770
765
  }
771
- function It(t, o) {
772
- const e = nt(t);
773
- return (typeof o == "boolean" ? o : !e) ? z(t) : U(t, !1), !0;
766
+ function Bt(t, n) {
767
+ const e = ot(t);
768
+ return (typeof n == "boolean" ? n : !e) ? I(t) : W(t, !1), !0;
774
769
  }
775
- function mt(t) {
770
+ function gt(t) {
776
771
  return typeof t.key == "string" ? t.key.toLowerCase() : "";
777
772
  }
778
- function ie(t) {
779
- const o = mt(t);
780
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "c";
781
- }
782
773
  function re(t) {
783
- const o = mt(t);
784
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "b";
774
+ const n = gt(t);
775
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "c";
785
776
  }
786
777
  function ae(t) {
787
- const o = mt(t);
788
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "j";
778
+ const n = gt(t);
779
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "b";
789
780
  }
790
781
  function se(t) {
791
- M = t, I || (I = (o) => {
792
- const e = o.target, i = e == null ? void 0 : e.closest($);
782
+ const n = gt(t);
783
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "j";
784
+ }
785
+ function ce(t) {
786
+ M = t, B || (B = (n) => {
787
+ const e = n.target, i = e == null ? void 0 : e.closest(S);
793
788
  if (!i) return;
794
789
  p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
795
- const n = v.get(i);
796
- n && (tt(n, i), ct(i, n)), it(i, "toggleCitationsPanel", nt(i));
797
- }, document.addEventListener("focusin", I, !0)), B || (B = (o) => {
798
- const e = o.target, i = e == null ? void 0 : e.closest($);
799
- i && (p = i, Tt(i));
800
- }, document.addEventListener("input", B, !0)), O || (O = (o) => {
801
- if (o.defaultPrevented) return;
802
- const e = o.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), n = h(void 0, !1);
803
- if (!n || S(n)) return;
804
- const r = f.get(n) || M || t;
805
- if (f.set(n, r), p = n, o.key === "Escape" && nt(n)) {
806
- o.preventDefault(), U(n, !0);
790
+ const o = v.get(i);
791
+ o && (et(o, i), lt(i, o)), rt(i, "toggleCitationsPanel", ot(i));
792
+ }, document.addEventListener("focusin", B, !0)), O || (O = (n) => {
793
+ const e = n.target, i = e == null ? void 0 : e.closest(S);
794
+ i && (p = i, Mt(i));
795
+ }, document.addEventListener("input", O, !0)), P || (P = (n) => {
796
+ if (n.defaultPrevented) return;
797
+ const e = n.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), o = h(void 0, !1);
798
+ if (!o || $(o)) return;
799
+ const r = f.get(o) || M || t;
800
+ if (f.set(o, r), p = o, n.key === "Escape" && ot(o)) {
801
+ n.preventDefault(), W(o, !0);
807
802
  return;
808
803
  }
809
- if (!i && !Jt(o, n, r)) {
810
- if (ie(o)) {
811
- o.preventDefault(), o.stopPropagation(), It(n);
804
+ if (!i && !Zt(n, o, r)) {
805
+ if (re(n)) {
806
+ n.preventDefault(), n.stopPropagation(), Bt(o);
812
807
  return;
813
808
  }
814
- if (re(o)) {
815
- o.preventDefault(), o.stopPropagation(), y(n, r, !0), z(n);
809
+ if (ae(n)) {
810
+ n.preventDefault(), n.stopPropagation(), y(o, r, !0), I(o);
816
811
  return;
817
812
  }
818
- ae(o) && (o.preventDefault(), o.stopPropagation(), bt(n, r));
813
+ se(n) && (n.preventDefault(), n.stopPropagation(), mt(o, r));
819
814
  }
820
- }, document.addEventListener("keydown", O, !0)), k || (k = () => {
821
- v.forEach((o, e) => {
822
- if (!e.isConnected || !o.isConnected) {
823
- kt(e), o.remove(), v.delete(e), V.delete(e);
815
+ }, document.addEventListener("keydown", P, !0)), k || (k = () => {
816
+ v.forEach((n, e) => {
817
+ if (!e.isConnected || !n.isConnected) {
818
+ Tt(e), n.remove(), v.delete(e), Y.delete(e);
824
819
  return;
825
820
  }
826
- tt(o, e), ct(e, o);
821
+ et(n, e), lt(e, n);
827
822
  });
828
823
  }, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
829
824
  }
830
- function ce() {
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;
832
- }
833
825
  function le() {
834
- if (typeof document == "undefined" || document.getElementById(pt)) return;
826
+ B && (document.removeEventListener("focusin", B, !0), B = null), O && (document.removeEventListener("input", O, !0), O = null), P && (document.removeEventListener("keydown", P, !0), P = null), k && (window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k), k = null), v.forEach((t) => t.remove()), v.clear(), M = null, p = null;
827
+ }
828
+ function ue() {
829
+ if (typeof document == "undefined" || document.getElementById(ht)) return;
835
830
  const t = document.createElement("style");
836
- t.id = pt, t.textContent = `
831
+ t.id = ht, t.textContent = `
837
832
  .rte-toolbar-group-items.citations,
838
833
  .editora-toolbar-group-items.citations {
839
834
  display: flex;
@@ -1199,6 +1194,30 @@ function le() {
1199
1194
  color: #94a3b8;
1200
1195
  }
1201
1196
 
1197
+ .rte-citations-status {
1198
+ margin: 0;
1199
+ min-height: 16px;
1200
+ font-size: 12px;
1201
+ font-weight: 600;
1202
+ color: #166534;
1203
+ }
1204
+
1205
+ .rte-citations-status:empty {
1206
+ display: none;
1207
+ }
1208
+
1209
+ .rte-citations-status.rte-citations-status-error {
1210
+ color: #b91c1c;
1211
+ }
1212
+
1213
+ .${m}.rte-citations-theme-dark .rte-citations-status {
1214
+ color: #86efac;
1215
+ }
1216
+
1217
+ .${m}.rte-citations-theme-dark .rte-citations-status.rte-citations-status-error {
1218
+ color: #fca5a5;
1219
+ }
1220
+
1202
1221
  .rte-citations-live {
1203
1222
  position: absolute;
1204
1223
  width: 1px;
@@ -1303,9 +1322,9 @@ function le() {
1303
1322
  }
1304
1323
  `, document.head.appendChild(t);
1305
1324
  }
1306
- const ue = (t = {}) => {
1307
- const o = Z(t);
1308
- return le(), {
1325
+ const de = (t = {}) => {
1326
+ const n = Q(t);
1327
+ return ue(), {
1309
1328
  name: "citations",
1310
1329
  toolbar: [
1311
1330
  {
@@ -1340,68 +1359,68 @@ const ue = (t = {}) => {
1340
1359
  ],
1341
1360
  commands: {
1342
1361
  citations: (e, i) => {
1343
- const n = h(i);
1344
- if (!n || S(n)) return !1;
1345
- const r = f.get(n) || o;
1346
- return f.set(n, r), T.set(n, N(n, r)), p = n, z(n), y(n, r, !1), !0;
1362
+ const o = h(i);
1363
+ if (!o || $(o)) return !1;
1364
+ const r = f.get(o) || n;
1365
+ return f.set(o, r), T.set(o, z(o, r)), p = o, I(o), y(o, r, !1), !0;
1347
1366
  },
1348
1367
  toggleCitationsPanel: (e, i) => {
1349
- const n = h(i);
1350
- if (!n || S(n)) return !1;
1351
- const r = f.get(n) || o;
1352
- f.set(n, r), p = n;
1353
- const a = It(n, typeof e == "boolean" ? e : void 0);
1354
- return nt(n) && y(n, r, !1), a;
1368
+ const o = h(i);
1369
+ if (!o || $(o)) return !1;
1370
+ const r = f.get(o) || n;
1371
+ f.set(o, r), p = o;
1372
+ const a = Bt(o, typeof e == "boolean" ? e : void 0);
1373
+ return ot(o) && y(o, r, !1), a;
1355
1374
  },
1356
1375
  insertCitation: (e, i) => {
1357
- const n = h(i);
1358
- if (!n || S(n) || !e || typeof e != "object") return !1;
1359
- const r = f.get(n) || o;
1360
- f.set(n, r), p = n;
1361
- const a = et(n, e, r);
1362
- return a && z(n), a;
1376
+ const o = h(i);
1377
+ if (!o || $(o) || !e || typeof e != "object") return !1;
1378
+ const r = f.get(o) || n;
1379
+ f.set(o, r), p = o;
1380
+ const a = nt(o, e, r);
1381
+ return a && I(o), a;
1363
1382
  },
1364
1383
  refreshCitations: (e, i) => {
1365
- const n = h(i);
1366
- if (!n) return !1;
1367
- const r = f.get(n) || o;
1368
- return f.set(n, r), p = n, y(n, r, !0), z(n), !0;
1384
+ const o = h(i);
1385
+ if (!o) return !1;
1386
+ const r = f.get(o) || n;
1387
+ return f.set(o, r), p = o, y(o, r, !0), I(o), !0;
1369
1388
  },
1370
1389
  setCitationStyle: (e, i) => {
1371
- const n = h(i);
1372
- if (!n || !e) return !1;
1373
- const r = f.get(n) || o;
1374
- return f.set(n, r), p = n, zt(n, e, r), !0;
1390
+ const o = h(i);
1391
+ if (!o || !e) return !1;
1392
+ const r = f.get(o) || n;
1393
+ return f.set(o, r), p = o, It(o, e, r), !0;
1375
1394
  },
1376
1395
  cycleCitationStyle: (e, i) => {
1377
- const n = h(i);
1378
- if (!n) return !1;
1379
- const r = f.get(n) || o;
1380
- return f.set(n, r), p = n, bt(n, r), H(n), !0;
1396
+ const o = h(i);
1397
+ if (!o) return !1;
1398
+ const r = f.get(o) || n;
1399
+ return f.set(o, r), p = o, mt(o, r), F(o), !0;
1381
1400
  },
1382
1401
  getCitationRecords: (e, i) => {
1383
- const n = h(i);
1384
- if (!n) return !1;
1385
- const r = f.get(n) || o, a = j(n, r);
1402
+ const o = h(i);
1403
+ if (!o) return !1;
1404
+ const r = f.get(o) || n, a = U(o, r);
1386
1405
  if (typeof e == "function")
1387
1406
  try {
1388
1407
  e(a);
1389
1408
  } catch (s) {
1390
1409
  }
1391
- return n.__citationRecords = a, n.dispatchEvent(
1410
+ return o.__citationRecords = a, o.dispatchEvent(
1392
1411
  new CustomEvent("editora:citations-data", {
1393
1412
  bubbles: !0,
1394
1413
  detail: {
1395
1414
  records: a,
1396
- style: N(n, r)
1415
+ style: z(o, r)
1397
1416
  }
1398
1417
  })
1399
1418
  ), !0;
1400
1419
  },
1401
1420
  setCitationsOptions: (e, i) => {
1402
- const n = h(i);
1403
- if (!n || !e || typeof e != "object") return !1;
1404
- const r = f.get(n) || o, a = Z({
1421
+ const o = h(i);
1422
+ if (!o || !e || typeof e != "object") return !1;
1423
+ const r = f.get(o) || n, a = Q({
1405
1424
  ...r,
1406
1425
  ...e,
1407
1426
  labels: {
@@ -1411,29 +1430,29 @@ const ue = (t = {}) => {
1411
1430
  normalizeText: e.normalizeText || r.normalizeText,
1412
1431
  generateCitationId: e.generateCitationId || r.generateCitationId
1413
1432
  });
1414
- return f.set(n, a), e.defaultStyle && L.includes(e.defaultStyle) && T.set(n, e.defaultStyle), y(n, a, !0), H(n), !0;
1433
+ return f.set(o, a), e.defaultStyle && L.includes(e.defaultStyle) && T.set(o, e.defaultStyle), y(o, a, !0), F(o), !0;
1415
1434
  },
1416
1435
  locateCitation: (e, i) => {
1417
- const n = h(i);
1418
- return !n || typeof e != "string" ? !1 : Qt(n, e);
1436
+ const o = h(i);
1437
+ return !o || typeof e != "string" ? !1 : te(o, e);
1419
1438
  },
1420
1439
  deleteCitation: (e, i) => {
1421
- const n = h(i);
1422
- if (!n || S(n)) return !1;
1423
- const r = f.get(n) || o;
1424
- return f.set(n, r), typeof e == "string" && e.trim() ? Nt(n, e, r) : Zt(n, r);
1440
+ const o = h(i);
1441
+ if (!o || $(o)) return !1;
1442
+ const r = f.get(o) || n;
1443
+ return f.set(o, r), typeof e == "string" && e.trim() ? Nt(o, e, r) : Qt(o, r);
1425
1444
  },
1426
1445
  insertRecentCitation: (e, i) => {
1427
- const n = h(i);
1428
- if (!n || S(n)) return !1;
1429
- const r = f.get(n) || o;
1430
- f.set(n, r);
1431
- const a = j(n, r), s = rt(n, a, r);
1446
+ const o = h(i);
1447
+ if (!o || $(o)) return !1;
1448
+ const r = f.get(o) || n;
1449
+ f.set(o, r);
1450
+ const a = U(o, r), s = at(o, a, r);
1432
1451
  if (s.length === 0) return !1;
1433
- const d = typeof e == "string" && e.trim() ? $t(n, e, a, r) : s[0];
1452
+ const d = typeof e == "string" && e.trim() ? $t(o, e, a, r) : s[0];
1434
1453
  if (!d) return !1;
1435
- const c = et(n, d, r);
1436
- return c && z(n), c;
1454
+ const c = nt(o, d, r);
1455
+ return c && I(o), c;
1437
1456
  }
1438
1457
  },
1439
1458
  keymap: {
@@ -1445,23 +1464,23 @@ const ue = (t = {}) => {
1445
1464
  "Mod-Alt-Shift-J": "cycleCitationStyle"
1446
1465
  },
1447
1466
  init: function(i) {
1448
- Y += 1;
1449
- const n = this && typeof this.__pluginConfig == "object" ? Z({ ...o, ...this.__pluginConfig }) : o;
1450
- se(n);
1467
+ X += 1;
1468
+ const o = this && typeof this.__pluginConfig == "object" ? Q({ ...n, ...this.__pluginConfig }) : n;
1469
+ ce(o);
1451
1470
  const r = h(
1452
1471
  i && i.editorElement ? { editorElement: i.editorElement } : void 0,
1453
1472
  !1
1454
1473
  );
1455
- r && (p = r, f.set(r, n), T.set(r, n.defaultStyle), it(r, "toggleCitationsPanel", !1), Tt(r));
1474
+ r && (p = r, f.set(r, o), T.set(r, o.defaultStyle), rt(r, "toggleCitationsPanel", !1), Mt(r));
1456
1475
  },
1457
1476
  destroy: () => {
1458
- Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((e) => {
1477
+ X = Math.max(0, X - 1), !(X > 0) && (K.forEach((e) => {
1459
1478
  window.clearTimeout(e);
1460
- }), q.clear(), ce());
1479
+ }), K.clear(), le());
1461
1480
  }
1462
1481
  };
1463
1482
  };
1464
1483
  export {
1465
- ue as CitationsPlugin
1484
+ de as CitationsPlugin
1466
1485
  };
1467
- //# sourceMappingURL=CitationsPlugin.native-DQgoCd1B.mjs.map
1486
+ //# sourceMappingURL=CitationsPlugin.native-C_7wWQ-k.mjs.map