@editora/plugins 1.0.16 → 1.0.18

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 (109) hide show
  1. package/dist/CodePlugin.native-Bwf25lLX.js +460 -0
  2. package/dist/CodePlugin.native-Cpp4u3Jl.mjs +648 -0
  3. package/dist/a11y-checker.cjs.js +16 -16
  4. package/dist/a11y-checker.esm.js +79 -75
  5. package/dist/anchor.cjs.js +9 -9
  6. package/dist/anchor.esm.js +61 -60
  7. package/dist/anchoredPopover-Bg-ey7Yo.js +1 -0
  8. package/dist/anchoredPopover-D_JbjvdA.mjs +111 -0
  9. package/dist/approval-workflow.cjs.js +5 -5
  10. package/dist/approval-workflow.esm.js +105 -104
  11. package/dist/background-color.cjs.js +1 -1
  12. package/dist/background-color.esm.js +1 -1
  13. package/dist/blocks-library.cjs.js +6 -6
  14. package/dist/blocks-library.esm.js +226 -202
  15. package/dist/capitalization.cjs.js +1 -1
  16. package/dist/capitalization.esm.js +9 -4
  17. package/dist/checklist.cjs.js +1 -1
  18. package/dist/checklist.esm.js +154 -116
  19. package/dist/citations.cjs.js +43 -18
  20. package/dist/citations.esm.js +465 -446
  21. package/dist/clear-formatting.cjs.js +1 -1
  22. package/dist/clear-formatting.esm.js +21 -20
  23. package/dist/code-sample.cjs.js +85 -66
  24. package/dist/code-sample.esm.js +301 -190
  25. package/dist/code.cjs.js +1 -669
  26. package/dist/code.esm.js +2 -4560
  27. package/dist/collaboration.cjs.js +68 -0
  28. package/dist/collaboration.esm.js +7428 -0
  29. package/dist/comments.cjs.js +11 -11
  30. package/dist/comments.esm.js +284 -237
  31. package/dist/conditional-content.cjs.js +67 -60
  32. package/dist/conditional-content.esm.js +270 -220
  33. package/dist/data-binding.cjs.js +3 -3
  34. package/dist/data-binding.esm.js +28 -27
  35. package/dist/dialogHelpers-5d5BuOCW.mjs +39 -0
  36. package/dist/dialogHelpers-zU6zpMIA.js +12 -0
  37. package/dist/document-manager.cjs.js +1 -1
  38. package/dist/document-manager.esm.js +1 -1
  39. package/dist/{documentManager-Jf0RbSks.js → documentManager-BDz6tovy.js} +2 -2
  40. package/dist/{documentManager-CTqRftU8.mjs → documentManager-yjRBab4v.mjs} +3 -3
  41. package/dist/embed-iframe.cjs.js +37 -17
  42. package/dist/embed-iframe.esm.js +188 -143
  43. package/dist/emojis.cjs.js +13 -10
  44. package/dist/emojis.esm.js +288 -76
  45. package/dist/enterprise.cjs.js +1 -1
  46. package/dist/enterprise.esm.js +9 -7
  47. package/dist/escapeHtml-D2Zh82pD.js +1 -0
  48. package/dist/escapeHtml-DyksyvcZ.mjs +6 -0
  49. package/dist/font-family.cjs.js +1 -1
  50. package/dist/font-family.esm.js +48 -41
  51. package/dist/font-size.cjs.js +1 -1
  52. package/dist/font-size.esm.js +67 -60
  53. package/dist/format-painter.cjs.js +1 -1
  54. package/dist/format-painter.esm.js +2 -1
  55. package/dist/history.cjs.js +1 -1
  56. package/dist/history.esm.js +40 -36
  57. package/dist/historyHelpers-BEKwNOtA.mjs +14 -0
  58. package/dist/historyHelpers-Cu8Pk7m1.js +1 -0
  59. package/dist/index-Bm1eqYHh.mjs +194 -0
  60. package/dist/index-CoflqYuK.js +30 -0
  61. package/dist/index-CxhJLMPS.js +221 -0
  62. package/dist/{index-D3CycEFU.mjs → index-Di1ZqIDs.mjs} +6420 -6232
  63. package/dist/index.cjs.js +1 -1
  64. package/dist/{index.es-DQ78mYYo.mjs → index.es-B7pVaNEV.mjs} +1558 -1542
  65. package/dist/{index.es-CE_A4QSm.js → index.es-I9N4o4Iq.js} +5 -5
  66. package/dist/index.esm.js +17 -15
  67. package/dist/{jspdf.es.min-BoS80556.js → jspdf.es.min-B5Idu0Wl.js} +2 -2
  68. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-BCzHIwvz.mjs} +3 -2
  69. package/dist/link.cjs.js +17 -13
  70. package/dist/link.esm.js +138 -69
  71. package/dist/list.cjs.js +1 -1
  72. package/dist/list.esm.js +66 -33
  73. package/dist/math.cjs.js +22 -22
  74. package/dist/math.esm.js +221 -126
  75. package/dist/media-manager.cjs.js +12 -12
  76. package/dist/media-manager.esm.js +55 -50
  77. package/dist/mentions.cjs.js +2 -2
  78. package/dist/mentions.esm.js +17 -12
  79. package/dist/merge-tag.cjs.js +2 -2
  80. package/dist/merge-tag.esm.js +43 -42
  81. package/dist/plugins.css +1 -1
  82. package/dist/preview.cjs.js +3 -3
  83. package/dist/preview.esm.js +30 -27
  84. package/dist/{purify.es-T2a3nLiC.js → purify.es-DWpzYfqy.js} +1 -1
  85. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-Dewe88eZ.mjs} +2 -2
  86. package/dist/slash-commands.cjs.js +13 -7
  87. package/dist/slash-commands.esm.js +90 -79
  88. package/dist/smart-paste.cjs.js +5 -5
  89. package/dist/smart-paste.esm.js +85 -81
  90. package/dist/special-characters.cjs.js +6 -3
  91. package/dist/special-characters.esm.js +72 -25
  92. package/dist/spell-check.cjs.js +8 -8
  93. package/dist/spell-check.esm.js +10189 -295
  94. package/dist/table.cjs.js +166 -13
  95. package/dist/table.esm.js +543 -266
  96. package/dist/template.cjs.js +11 -11
  97. package/dist/template.esm.js +290 -264
  98. package/dist/text-color.cjs.js +1 -1
  99. package/dist/text-color.esm.js +1 -1
  100. package/dist/translation-workflow.cjs.js +4 -4
  101. package/dist/translation-workflow.esm.js +33 -31
  102. package/dist/version-diff.cjs.js +6 -6
  103. package/dist/version-diff.esm.js +40 -40
  104. package/package.json +10 -4
  105. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  106. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  107. package/dist/index-BFsKNTTj.mjs +0 -145
  108. package/dist/index-CvJk4DKa.js +0 -221
  109. package/dist/index-tqLTHcO6.js +0 -1
@@ -1,4 +1,4 @@
1
- const S = ".rte-content, .editora-content", pt = "rte-citations-styles", b = "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", b = "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,41 +19,41 @@ const S = ".rte-content, .editora-content", pt = "rte-citations-styles", b = "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, e) {
31
- const n = e(t);
32
- if (!n) return "";
33
- const i = n.match(/\d{4}/);
34
- return i ? i[0] : n;
35
- }
36
30
  function yt(t, e) {
37
- const n = e(t);
38
- return n ? /^https?:\/\//i.test(n) ? n : `https://${n}` : "";
31
+ const o = e(t);
32
+ if (!o) return "";
33
+ const i = o.match(/\d{4}/);
34
+ return i ? i[0] : o;
39
35
  }
40
- function F(t) {
36
+ function Ct(t, e) {
37
+ const o = e(t);
38
+ return o ? /^https?:\/\//i.test(o) ? o : `https://${o}` : "";
39
+ }
40
+ function _(t) {
41
41
  return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
42
42
  }
43
- function Ct(t, e) {
43
+ function wt(t, e) {
44
44
  return {
45
- id: F(e.normalizeText(t.id || "")),
45
+ id: _(e.normalizeText(t.id || "")),
46
46
  author: e.normalizeText(t.author || ""),
47
- year: xt(t.year || "", e.normalizeText) || void 0,
47
+ year: yt(t.year || "", e.normalizeText) || void 0,
48
48
  title: e.normalizeText(t.title || ""),
49
49
  source: e.normalizeText(t.source || "") || void 0,
50
- url: yt(t.url || "", e.normalizeText) || void 0,
50
+ url: Ct(t.url || "", e.normalizeText) || void 0,
51
51
  note: e.normalizeText(t.note || "") || void 0
52
52
  };
53
53
  }
54
- function Z(t = {}) {
55
- const e = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", n = {
56
- ...Ot,
54
+ function Q(t = {}) {
55
+ const e = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", o = {
56
+ ...Pt,
57
57
  ...t.labels || {}
58
58
  };
59
59
  return {
@@ -61,133 +61,125 @@ function Z(t = {}) {
61
61
  enableFootnoteSync: t.enableFootnoteSync !== !1,
62
62
  debounceMs: Math.max(80, Number(t.debounceMs ?? 220)),
63
63
  maxRecentCitations: Math.max(3, Math.min(30, Number(t.maxRecentCitations ?? 8))),
64
- labels: n,
65
- normalizeText: t.normalizeText || Dt,
64
+ labels: o,
65
+ normalizeText: t.normalizeText || Ht,
66
66
  generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
67
67
  };
68
68
  }
69
- function wt(t) {
69
+ function vt(t) {
70
70
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
71
71
  }
72
- function lt(t) {
72
+ function ut(t) {
73
73
  return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || t;
74
74
  }
75
- function X(t) {
75
+ function J(t) {
76
76
  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;
77
77
  }
78
- function Ht(t) {
79
- const e = lt(t);
80
- if (X(e)) return !0;
81
- const n = e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
82
- return X(n) ? !0 : X(document.documentElement) || X(document.body);
78
+ function Ft(t) {
79
+ const e = ut(t);
80
+ if (J(e)) return !0;
81
+ const o = e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
82
+ return J(o) ? !0 : J(document.documentElement) || J(document.body);
83
83
  }
84
- function tt(t, e) {
85
- t.classList.remove("rte-citations-theme-dark"), Ht(e) && t.classList.add("rte-citations-theme-dark");
84
+ function et(t, e) {
85
+ t.classList.remove("rte-citations-theme-dark"), Ft(e) && t.classList.add("rte-citations-theme-dark");
86
86
  }
87
87
  function h(t, e = !0) {
88
88
  if (t?.contentElement instanceof HTMLElement) return t.contentElement;
89
89
  if (t?.editorElement instanceof HTMLElement) {
90
- const o = t.editorElement;
91
- if (o.matches(S)) return o;
92
- const r = o.querySelector(S);
90
+ const n = t.editorElement;
91
+ if (n.matches(S)) return n;
92
+ const r = n.querySelector(S);
93
93
  if (r instanceof HTMLElement) return r;
94
94
  }
95
- const n = window.getSelection();
96
- if (n && n.rangeCount > 0) {
97
- const o = n.getRangeAt(0).startContainer, a = wt(o)?.closest(S);
95
+ const o = window.getSelection();
96
+ if (o && o.rangeCount > 0) {
97
+ const n = o.getRangeAt(0).startContainer, a = vt(n)?.closest(S);
98
98
  if (a) return a;
99
99
  }
100
100
  const i = document.activeElement;
101
101
  if (i) {
102
102
  if (i.matches(S)) return i;
103
- const o = i.closest(S);
104
- if (o) return o;
103
+ const n = i.closest(S);
104
+ if (n) return n;
105
105
  }
106
106
  return p && p.isConnected ? p : (p && !p.isConnected && (p = null), e ? document.querySelector(S) : null);
107
107
  }
108
108
  function $(t) {
109
109
  return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
110
110
  }
111
- function K(t) {
112
- const e = wt(t);
113
- return e ? !!(e.closest(W) || e.closest(G)) : !1;
111
+ function j(t) {
112
+ const e = vt(t);
113
+ return e ? !!(e.closest(G) || e.closest(V)) : !1;
114
114
  }
115
- function Ft(t, e) {
116
- if (at += 1, e.generateCitationId) {
117
- const n = e.generateCitationId({ editor: t, index: at }), i = F(e.normalizeText(n || ""));
115
+ function _t(t, e) {
116
+ if (st += 1, e.generateCitationId) {
117
+ const o = e.generateCitationId({ editor: t, index: st }), i = _(e.normalizeText(o || ""));
118
118
  if (i) return i;
119
119
  }
120
- return `cite-${Date.now().toString(36)}-${at.toString(36)}`;
120
+ return `cite-${Date.now().toString(36)}-${st.toString(36)}`;
121
121
  }
122
- function st(t) {
122
+ function ct(t) {
123
123
  return t.map((e) => (e || "").trim()).filter(Boolean).join(" ").trim();
124
124
  }
125
- function _t(t, e) {
126
- const n = t.author || "Unknown", i = t.year || "n.d.";
127
- return e === "mla" ? `(${n} ${i})` : e === "chicago" ? `(${n} ${i})` : `(${n}, ${i})`;
128
- }
129
- function ut(t, e) {
130
- const n = t.author || "Unknown", i = t.year || "n.d.", o = t.title || "Untitled", r = t.source || "", a = t.url || "";
131
- return st(e === "mla" ? [
132
- `${n}.`,
133
- `"${o}."`,
134
- r ? `${r},` : "",
125
+ function qt(t, e) {
126
+ const o = t.author || "Unknown", i = t.year || "n.d.";
127
+ return e === "mla" ? `(${o} ${i})` : e === "chicago" ? `(${o} ${i})` : `(${o}, ${i})`;
128
+ }
129
+ function N(t) {
130
+ const e = t.trim();
131
+ return !e || /[.!?]$/.test(e) ? e : `${e}.`;
132
+ }
133
+ function dt(t, e) {
134
+ const o = N(t.author || "Unknown"), i = t.year || "n.d.", n = t.title || "Untitled", r = (t.source || "").trim(), a = t.url || "";
135
+ return ct(e === "mla" ? [
136
+ o,
137
+ `"${N(n)}"`,
138
+ r ? `${r.replace(/[.,]$/, "")},` : "",
135
139
  `${i}.`,
136
140
  a
137
- ] : e === "chicago" ? [
138
- `${n}.`,
139
- `${o}.`,
140
- r ? `${r}.` : "",
141
- `(${i}).`,
142
- a
143
- ] : [
144
- `${n}.`,
145
- `(${i}).`,
146
- `${o}.`,
147
- r ? `${r}.` : "",
148
- a
149
- ]);
141
+ ] : e === "chicago" ? [o, N(n), N(r), `(${i}).`, a] : [o, `(${i}).`, N(n), N(r), a]);
150
142
  }
151
143
  function R(t) {
152
- return Array.from(t.querySelectorAll(ot)).filter(
153
- (e) => !e.closest(W) && !e.closest(G)
144
+ return Array.from(t.querySelectorAll(it)).filter(
145
+ (e) => !e.closest(G) && !e.closest(V)
154
146
  );
155
147
  }
156
- function vt(t, e) {
157
- const n = F(e.normalizeText(t.getAttribute("data-citation-id") || ""));
158
- if (!n) return null;
159
- const i = e.normalizeText(t.getAttribute("data-citation-author") || ""), o = e.normalizeText(t.getAttribute("data-citation-title") || "");
148
+ function Et(t, e) {
149
+ const o = _(e.normalizeText(t.getAttribute("data-citation-id") || ""));
150
+ if (!o) return null;
151
+ const i = e.normalizeText(t.getAttribute("data-citation-author") || ""), n = e.normalizeText(t.getAttribute("data-citation-title") || "");
160
152
  return {
161
- id: n,
153
+ id: o,
162
154
  author: i || "Unknown",
163
- year: xt(t.getAttribute("data-citation-year") || "", e.normalizeText) || void 0,
164
- title: o || "Untitled",
155
+ year: yt(t.getAttribute("data-citation-year") || "", e.normalizeText) || void 0,
156
+ title: n || "Untitled",
165
157
  source: e.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
166
- url: yt(t.getAttribute("data-citation-url") || "", e.normalizeText) || void 0,
158
+ url: Ct(t.getAttribute("data-citation-url") || "", e.normalizeText) || void 0,
167
159
  note: e.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
168
160
  };
169
161
  }
170
- function Et(t, e, n) {
171
- t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", e.id), t.setAttribute("data-citation-author", e.author || ""), t.setAttribute("data-citation-year", e.year || ""), t.setAttribute("data-citation-title", e.title || ""), t.setAttribute("data-citation-source", e.source || ""), t.setAttribute("data-citation-url", e.url || ""), t.setAttribute("data-citation-note", e.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", n), t.textContent = _t(e, n);
162
+ function St(t, e, o) {
163
+ t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", e.id), t.setAttribute("data-citation-author", e.author || ""), t.setAttribute("data-citation-year", e.year || ""), t.setAttribute("data-citation-title", e.title || ""), t.setAttribute("data-citation-source", e.source || ""), t.setAttribute("data-citation-url", e.url || ""), t.setAttribute("data-citation-note", e.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", o), t.textContent = qt(e, o);
172
164
  }
173
- function it(t, e, n) {
174
- const i = lt(t);
165
+ function rt(t, e, o) {
166
+ const i = ut(t);
175
167
  Array.from(
176
168
  i.querySelectorAll(
177
169
  `.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`
178
170
  )
179
171
  ).forEach((r) => {
180
- r.classList.toggle("active", n), r.setAttribute("data-active", n ? "true" : "false"), r.setAttribute("aria-pressed", n ? "true" : "false");
172
+ r.classList.toggle("active", o), r.setAttribute("data-active", o ? "true" : "false"), r.setAttribute("aria-pressed", o ? "true" : "false");
181
173
  });
182
174
  }
183
- function N(t, e) {
184
- const n = T.get(t);
185
- return n && L.includes(n) ? n : e?.defaultStyle || "apa";
175
+ function z(t, e) {
176
+ const o = T.get(t);
177
+ return o && L.includes(o) ? o : e?.defaultStyle || "apa";
186
178
  }
187
- function j(t, e) {
188
- const n = R(t), i = /* @__PURE__ */ new Map();
189
- return n.forEach((o) => {
190
- const r = vt(o, e);
179
+ function U(t, e) {
180
+ const o = R(t), i = /* @__PURE__ */ new Map();
181
+ return o.forEach((n) => {
182
+ const r = Et(n, e);
191
183
  if (!r) return;
192
184
  if (!i.has(r.id)) {
193
185
  i.set(r.id, r);
@@ -205,76 +197,76 @@ function j(t, e) {
205
197
  });
206
198
  }), Array.from(i.values());
207
199
  }
208
- function qt(t, e, n) {
209
- const i = Ct(e, n);
200
+ function Kt(t, e, o) {
201
+ const i = wt(e, o);
210
202
  if (!i.id || !i.author || !i.title) return;
211
- const r = (D.get(t) || []).filter((a) => a.id !== i.id);
212
- D.set(t, [i, ...r].slice(0, n.maxRecentCitations));
203
+ const r = (H.get(t) || []).filter((a) => a.id !== i.id);
204
+ H.set(t, [i, ...r].slice(0, o.maxRecentCitations));
213
205
  }
214
- function rt(t, e, n) {
215
- const i = D.get(t) || [], o = /* @__PURE__ */ new Map();
216
- e.slice(Math.max(0, e.length - n.maxRecentCitations)).reverse().forEach((a) => {
217
- a.id && o.set(a.id, a);
206
+ function at(t, e, o) {
207
+ const i = H.get(t) || [], n = /* @__PURE__ */ new Map();
208
+ e.slice(Math.max(0, e.length - o.maxRecentCitations)).reverse().forEach((a) => {
209
+ a.id && n.set(a.id, a);
218
210
  }), i.forEach((a) => {
219
- !a.id || o.has(a.id) || o.set(a.id, a);
211
+ !a.id || n.has(a.id) || n.set(a.id, a);
220
212
  });
221
- const r = Array.from(o.values()).slice(0, n.maxRecentCitations);
222
- return D.set(t, r), r;
213
+ const r = Array.from(n.values()).slice(0, o.maxRecentCitations);
214
+ return H.set(t, r), r;
223
215
  }
224
- function St(t, e, n, i) {
225
- const o = F(i.normalizeText(e || ""));
226
- return o && rt(t, n, i).find((a) => a.id === o) || null;
216
+ function $t(t, e, o, i) {
217
+ const n = _(i.normalizeText(e || ""));
218
+ return n && at(t, o, i).find((a) => a.id === n) || null;
227
219
  }
228
- function Kt(t, e, n) {
229
- const i = F(n.normalizeText(e || ""));
220
+ function jt(t, e, o) {
221
+ const i = _(o.normalizeText(e || ""));
230
222
  if (!i) return !1;
231
- const o = D.get(t) || [], r = o.filter((a) => a.id !== i);
232
- return r.length === o.length ? !1 : (D.set(t, r), !0);
223
+ const n = H.get(t) || [], r = n.filter((a) => a.id !== i);
224
+ return r.length === n.length ? !1 : (H.set(t, r), !0);
233
225
  }
234
- function $t(t, e, n) {
226
+ function At(t, e, o) {
235
227
  const i = document.createElement("section");
236
- i.className = t, i.setAttribute("data-type", e), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", n), e === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : e === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
237
- const o = document.createElement("h3");
238
- o.className = "rte-citation-section-title", o.textContent = n;
228
+ i.className = t, i.setAttribute("data-type", e), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", o), e === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : e === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
229
+ const n = document.createElement("h3");
230
+ n.className = "rte-citation-section-title", n.textContent = o;
239
231
  const r = document.createElement("ol");
240
- return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(o), i.appendChild(r), i;
241
- }
242
- function jt(t, e) {
243
- let n = t.querySelector(W);
244
- n || (n = $t("rte-citation-bibliography", "citation-bibliography", e.labels.bibliographyTitle), t.appendChild(n));
245
- const i = n.querySelector(".rte-citation-section-title");
246
- return i && (i.textContent = e.labels.bibliographyTitle), n.setAttribute("aria-label", e.labels.bibliographyTitle), n;
232
+ return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(n), i.appendChild(r), i;
247
233
  }
248
234
  function Ut(t, e) {
249
- let n = t.querySelector(G);
250
- n || (n = $t("rte-citation-footnotes", "citation-footnotes", e.labels.footnotesTitle), t.appendChild(n));
251
- const i = n.querySelector(".rte-citation-section-title");
252
- return i && (i.textContent = e.labels.footnotesTitle), n.setAttribute("aria-label", e.labels.footnotesTitle), n;
253
- }
254
- function At(t, e) {
235
+ let o = t.querySelector(G);
236
+ o || (o = At("rte-citation-bibliography", "citation-bibliography", e.labels.bibliographyTitle), t.appendChild(o));
237
+ const i = o.querySelector(".rte-citation-section-title");
238
+ return i && (i.textContent = e.labels.bibliographyTitle), o.setAttribute("aria-label", e.labels.bibliographyTitle), o;
239
+ }
240
+ function Wt(t, e) {
241
+ let o = t.querySelector(V);
242
+ o || (o = At("rte-citation-footnotes", "citation-footnotes", e.labels.footnotesTitle), t.appendChild(o));
243
+ const i = o.querySelector(".rte-citation-section-title");
244
+ return i && (i.textContent = e.labels.footnotesTitle), o.setAttribute("aria-label", e.labels.footnotesTitle), o;
245
+ }
246
+ function kt(t, e) {
255
247
  t.querySelector(e)?.remove();
256
248
  }
257
- function Wt(t, e, n, i) {
249
+ function Gt(t, e, o, i) {
258
250
  if (e.length === 0) {
259
- At(t, W);
251
+ kt(t, G);
260
252
  return;
261
253
  }
262
- const r = jt(t, n).querySelector(".rte-citation-list");
254
+ const r = Ut(t, o).querySelector(".rte-citation-list");
263
255
  if (!r) return;
264
256
  const a = document.createDocumentFragment();
265
257
  e.forEach((s, u) => {
266
258
  const c = document.createElement("li");
267
- 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(u + 1)), c.textContent = ut(s, i), a.appendChild(c);
259
+ 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(u + 1)), c.textContent = dt(s, i), a.appendChild(c);
268
260
  }), r.innerHTML = "", r.appendChild(a);
269
261
  }
270
- function Gt(t, e, n, i) {
271
- if (!n.enableFootnoteSync || e.length === 0) {
272
- At(t, G), R(t).forEach((l) => {
262
+ function Vt(t, e, o, i) {
263
+ if (!o.enableFootnoteSync || e.length === 0) {
264
+ kt(t, V), R(t).forEach((l) => {
273
265
  l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
274
266
  });
275
267
  return;
276
268
  }
277
- const r = Ut(t, n).querySelector(".rte-citation-list");
269
+ const r = Wt(t, o).querySelector(".rte-citation-list");
278
270
  if (!r) return;
279
271
  const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
280
272
  e.forEach((l, d) => {
@@ -299,40 +291,40 @@ function Gt(t, e, n, i) {
299
291
  w.className = "rte-citation-footnote-number", w.textContent = `${d + 1}. `;
300
292
  const A = document.createElement("span");
301
293
  A.className = "rte-citation-footnote-text";
302
- const Bt = l.note ? `${l.note}. ` : "";
303
- A.textContent = `${Bt}${ut(l, i)}`, m.appendChild(w), m.appendChild(A);
304
- const mt = a.get(l.id);
305
- if (mt) {
306
- const _ = document.createElement("a");
307
- _.className = "rte-citation-backref", _.href = `#${mt}`, _.setAttribute("aria-label", `Back to citation ${d + 1}`), _.textContent = "Back", m.appendChild(_);
294
+ const Ot = l.note ? `${l.note}. ` : "";
295
+ A.textContent = `${Ot}${dt(l, i)}`, m.appendChild(w), m.appendChild(A);
296
+ const pt = a.get(l.id);
297
+ if (pt) {
298
+ const q = document.createElement("a");
299
+ q.className = "rte-citation-backref", q.href = `#${pt}`, q.setAttribute("aria-label", `Back to citation ${d + 1}`), q.textContent = "Back", m.appendChild(q);
308
300
  }
309
301
  c.appendChild(m);
310
302
  }), r.innerHTML = "", r.appendChild(c);
311
303
  }
312
- function Vt(t, e, n, i) {
313
- const o = ut(e, n);
314
- t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${o}`);
304
+ function Yt(t, e, o, i) {
305
+ const n = dt(e, o);
306
+ t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${n}`);
315
307
  }
316
- function Yt(t, e, n) {
308
+ function Xt(t, e, o) {
317
309
  const i = R(t);
318
- let o = `${e}:${n ? "1" : "0"}:${i.length}`;
310
+ let n = `${e}:${o ? "1" : "0"}:${i.length}`;
319
311
  return i.forEach((r) => {
320
- 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") || ""}`;
321
- }), o;
312
+ 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") || ""}`;
313
+ }), n;
322
314
  }
323
- function H(t) {
315
+ function F(t) {
324
316
  const e = v.get(t);
325
317
  if (!e) return;
326
- const n = f.get(t) || M;
327
- if (!n) return;
328
- const i = N(t, n), o = j(t, n), r = rt(t, o, n), a = e.querySelector(".rte-citations-status"), s = e.querySelector('[data-action="cycle-style"]'), u = e.querySelector(".rte-citations-recent-list");
318
+ const o = f.get(t) || M;
319
+ if (!o) return;
320
+ const i = z(t, o), n = U(t, o), r = at(t, n, o), a = e.querySelector(".rte-citations-status"), s = e.querySelector('[data-action="cycle-style"]'), u = e.querySelector(".rte-citations-recent-list");
329
321
  if (a) {
330
- const c = o.length;
331
- a.textContent = `${n.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${n.enableFootnoteSync ? "On" : "Off"}`;
322
+ const c = n.length;
323
+ a.textContent = `${o.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${o.enableFootnoteSync ? "On" : "Off"}`;
332
324
  }
333
- if (s && (s.textContent = `${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), u) {
325
+ if (s && (s.textContent = `${o.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${o.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), u) {
334
326
  if (r.length === 0) {
335
- u.innerHTML = `<li class="rte-citations-empty">${g(n.labels.noCitationsText)}</li>`;
327
+ u.innerHTML = `<li class="rte-citations-empty">${g(o.labels.noCitationsText)}</li>`;
336
328
  return;
337
329
  }
338
330
  u.innerHTML = r.map(
@@ -355,34 +347,34 @@ function H(t) {
355
347
  data-action="delete-by-id"
356
348
  data-citation-id="${g(c.id)}"
357
349
  aria-label="Delete citation: ${g(c.title)}"
358
- >${g(n.labels.deleteRecentText)}</button>
350
+ >${g(o.labels.deleteRecentText)}</button>
359
351
  </div>
360
352
  </li>
361
353
  `
362
354
  ).join("");
363
355
  }
364
356
  }
365
- function y(t, e, n = !1) {
366
- const i = N(t, e), o = Yt(t, i, e.enableFootnoteSync);
367
- if (!n && ht.get(t) === o)
368
- return j(t, e);
357
+ function y(t, e, o = !1) {
358
+ const i = z(t, e), n = Xt(t, i, e.enableFootnoteSync);
359
+ if (!o && xt.get(t) === n)
360
+ return U(t, e);
369
361
  const r = R(t), a = /* @__PURE__ */ new Map();
370
362
  r.forEach((c) => {
371
- const l = vt(c, e);
363
+ const l = Et(c, e);
372
364
  l && (a.has(l.id) || a.set(l.id, l));
373
365
  });
374
366
  const s = Array.from(a.values());
375
- rt(t, s, e);
367
+ at(t, s, e);
376
368
  const u = /* @__PURE__ */ new Map();
377
369
  return s.forEach((c, l) => {
378
370
  u.set(c.id, l + 1);
379
371
  }), r.forEach((c) => {
380
372
  const l = c.getAttribute("data-citation-id") || "", d = a.get(l);
381
373
  if (!d) return;
382
- Et(c, d, i);
374
+ St(c, d, i);
383
375
  const m = u.get(d.id) || 1;
384
- Vt(c, d, i, Math.max(1, m));
385
- }), Wt(t, s, e, i), Gt(t, s, e, i), ht.set(t, o), H(t), t.dispatchEvent(
376
+ Yt(c, d, i, Math.max(1, m));
377
+ }), Gt(t, s, e, i), Vt(t, s, e, i), xt.set(t, n), F(t), t.dispatchEvent(
386
378
  new CustomEvent("editora:citations-refreshed", {
387
379
  bubbles: !0,
388
380
  detail: {
@@ -393,157 +385,157 @@ function y(t, e, n = !1) {
393
385
  })
394
386
  ), s;
395
387
  }
396
- function kt(t) {
397
- const e = Q.get(t);
398
- typeof e == "number" && (window.clearTimeout(e), q.delete(e), Q.delete(t));
399
- }
400
388
  function Tt(t) {
389
+ const e = tt.get(t);
390
+ typeof e == "number" && (window.clearTimeout(e), K.delete(e), tt.delete(t));
391
+ }
392
+ function Mt(t) {
401
393
  const e = f.get(t) || M;
402
394
  if (!e) return;
403
- kt(t);
404
- const n = window.setTimeout(() => {
405
- q.delete(n), Q.delete(t), y(t, e, !1);
395
+ Tt(t);
396
+ const o = window.setTimeout(() => {
397
+ K.delete(o), tt.delete(t), y(t, e, !1);
406
398
  }, e.debounceMs);
407
- q.add(n), Q.set(t, n);
399
+ K.add(o), tt.set(t, o);
408
400
  }
409
- function Xt(t) {
401
+ function Jt(t) {
410
402
  const e = window.getSelection();
411
403
  if (!e) throw new Error("Selection unavailable");
412
404
  if (e.rangeCount > 0) {
413
405
  const a = e.getRangeAt(0);
414
- if (t.contains(a.commonAncestorContainer) && !K(a.commonAncestorContainer))
406
+ if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
415
407
  return a.cloneRange();
416
408
  }
417
- const n = document.createRange(), i = t.querySelector(W), o = t.querySelector(G), r = i || o;
418
- return r ? (n.setStartBefore(r), n.collapse(!0), n) : (n.selectNodeContents(t), n.collapse(!1), n);
409
+ const o = document.createRange(), i = t.querySelector(G), n = t.querySelector(V), r = i || n;
410
+ return r ? (o.setStartBefore(r), o.collapse(!0), o) : (o.selectNodeContents(t), o.collapse(!1), o);
419
411
  }
420
- function dt(t) {
412
+ function ft(t) {
421
413
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
422
414
  }
423
- function ft(t, e) {
415
+ function bt(t, e) {
424
416
  if (e === t.innerHTML) return;
425
- const n = window.execEditorCommand || window.executeEditorCommand;
426
- if (typeof n == "function")
417
+ const o = window.execEditorCommand || window.executeEditorCommand;
418
+ if (typeof o == "function")
427
419
  try {
428
- n("recordDomTransaction", t, e, t.innerHTML);
420
+ o("recordDomTransaction", t, e, t.innerHTML);
429
421
  } catch {
430
422
  }
431
423
  }
432
- function Mt(t, e) {
433
- const n = window.getSelection();
434
- if (!n) return;
424
+ function Lt(t, e) {
425
+ const o = window.getSelection();
426
+ if (!o) return;
435
427
  const i = document.createRange();
436
428
  if (t.nodeType === Node.TEXT_NODE) {
437
- const o = t, r = Math.max(0, Math.min(e, o.length));
438
- i.setStart(o, r);
429
+ const n = t, r = Math.max(0, Math.min(e, n.length));
430
+ i.setStart(n, r);
439
431
  } else {
440
- const o = t.childNodes.length, r = Math.max(0, Math.min(e, o));
432
+ const n = t.childNodes.length, r = Math.max(0, Math.min(e, n));
441
433
  i.setStart(t, r);
442
434
  }
443
- i.collapse(!0), n.removeAllRanges(), n.addRange(i);
435
+ i.collapse(!0), o.removeAllRanges(), o.addRange(i);
444
436
  }
445
- function Lt(t) {
437
+ function Rt(t) {
446
438
  if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
447
439
  return null;
448
440
  const e = t.startContainer.childNodes[t.startOffset];
449
- return !(e instanceof HTMLElement) || !e.matches(ot) ? null : e;
441
+ return !(e instanceof HTMLElement) || !e.matches(it) ? null : e;
450
442
  }
451
- function J(t, e, n) {
452
- const { startContainer: i, startOffset: o } = t;
443
+ function Z(t, e, o) {
444
+ const { startContainer: i, startOffset: n } = t;
453
445
  if (i.nodeType === Node.ELEMENT_NODE) {
454
446
  const a = i;
455
- if (n === "previous") {
456
- if (o > 0) return a.childNodes[o - 1] || null;
457
- } else if (o < a.childNodes.length)
458
- return a.childNodes[o] || null;
447
+ if (o === "previous") {
448
+ if (n > 0) return a.childNodes[n - 1] || null;
449
+ } else if (n < a.childNodes.length)
450
+ return a.childNodes[n] || null;
459
451
  }
460
- if (i.nodeType === Node.TEXT_NODE && (n === "previous" && o < i.data.length || n === "next" && o > 0))
452
+ if (i.nodeType === Node.TEXT_NODE && (o === "previous" && n < i.data.length || o === "next" && n > 0))
461
453
  return null;
462
454
  let r = i;
463
455
  for (; r && r !== e; ) {
464
- const a = n === "previous" ? r.previousSibling : r.nextSibling;
456
+ const a = o === "previous" ? r.previousSibling : r.nextSibling;
465
457
  if (a) return a;
466
458
  r = r.parentNode;
467
459
  }
468
460
  return null;
469
461
  }
470
- function Rt(t, e, n) {
462
+ function zt(t, e, o) {
471
463
  if (!t.collapsed) return null;
472
- const i = (a) => a instanceof HTMLElement && a.matches(ot) ? a : null, { startContainer: o, startOffset: r } = t;
473
- if (o.nodeType === Node.ELEMENT_NODE) {
474
- const a = o;
475
- return n === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : n === "Delete" ? i(a.childNodes[r] || null) : null;
464
+ const i = (a) => a instanceof HTMLElement && a.matches(it) ? a : null, { startContainer: n, startOffset: r } = t;
465
+ if (n.nodeType === Node.ELEMENT_NODE) {
466
+ const a = n;
467
+ return o === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : o === "Delete" ? i(a.childNodes[r] || null) : null;
476
468
  }
477
- if (o.nodeType === Node.TEXT_NODE) {
478
- const a = o;
479
- if (n === "Backspace" && r === 0) {
469
+ if (n.nodeType === Node.TEXT_NODE) {
470
+ const a = n;
471
+ if (o === "Backspace" && r === 0) {
480
472
  const s = i(a.previousSibling);
481
- return s || i(J(t, e, "previous"));
473
+ return s || i(Z(t, e, "previous"));
482
474
  }
483
- if (n === "Delete" && r === a.data.length) {
475
+ if (o === "Delete" && r === a.data.length) {
484
476
  const s = i(a.nextSibling);
485
- return s || i(J(t, e, "next"));
477
+ return s || i(Z(t, e, "next"));
486
478
  }
487
479
  }
488
- return i(n === "Backspace" ? J(t, e, "previous") : J(t, e, "next"));
480
+ return i(o === "Backspace" ? Z(t, e, "previous") : Z(t, e, "next"));
489
481
  }
490
- function P(t, e, n) {
482
+ function D(t, e, o) {
491
483
  const i = t.closest(S);
492
- if (!i || K(t)) return !1;
493
- const o = t.parentNode;
494
- if (!o) return !1;
495
- const r = i.innerHTML, a = Array.from(o.childNodes).indexOf(t);
484
+ if (!i || j(t)) return !1;
485
+ const n = t.parentNode;
486
+ if (!n) return !1;
487
+ const r = i.innerHTML, a = Array.from(n.childNodes).indexOf(t);
496
488
  if (a < 0) return !1;
497
489
  const s = t.nextSibling;
498
- return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Mt(o, a), y(i, n, !0), ft(i, r), dt(i), e === "Delete" && i.focus({ preventScroll: !0 }), !0;
490
+ return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Lt(n, a), y(i, o, !0), bt(i, r), ft(i), e === "Delete" && i.focus({ preventScroll: !0 }), !0;
499
491
  }
500
- function Jt(t, e, n) {
492
+ function Zt(t, e, o) {
501
493
  if (t.key !== "Backspace" && t.key !== "Delete") return !1;
502
- const i = t.key, o = t.target;
503
- if (o?.matches(ot) && e.contains(o) && !K(o))
504
- return t.preventDefault(), t.stopPropagation(), P(o, i, n);
494
+ const i = t.key, n = t.target;
495
+ if (n?.matches(it) && e.contains(n) && !j(n))
496
+ return t.preventDefault(), t.stopPropagation(), D(n, i, o);
505
497
  const r = window.getSelection();
506
498
  if (!r || r.rangeCount === 0) return !1;
507
499
  const a = r.getRangeAt(0);
508
- if (!e.contains(a.commonAncestorContainer) || K(a.commonAncestorContainer)) return !1;
509
- const s = Lt(a);
500
+ if (!e.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer)) return !1;
501
+ const s = Rt(a);
510
502
  if (s)
511
- return t.preventDefault(), t.stopPropagation(), P(s, i, n);
512
- const u = Rt(a, e, i);
513
- return u ? (t.preventDefault(), t.stopPropagation(), P(u, i, n)) : !1;
503
+ return t.preventDefault(), t.stopPropagation(), D(s, i, o);
504
+ const u = zt(a, e, i);
505
+ return u ? (t.preventDefault(), t.stopPropagation(), D(u, i, o)) : !1;
514
506
  }
515
- function Nt(t, e, n) {
516
- const i = F(n.normalizeText(e || ""));
507
+ function Nt(t, e, o) {
508
+ const i = _(o.normalizeText(e || ""));
517
509
  if (!i) return !1;
518
- const o = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
519
- if (o.length === 0) return !1;
520
- if (o.length === 1)
521
- return P(o[0], "Delete", n);
510
+ const n = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
511
+ if (n.length === 0) return !1;
512
+ if (n.length === 1)
513
+ return D(n[0], "Delete", o);
522
514
  const r = t.innerHTML;
523
- return o.forEach((a) => {
515
+ return n.forEach((a) => {
524
516
  const s = a.nextSibling;
525
517
  s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
526
- }), Mt(t, t.childNodes.length), y(t, n, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
527
- }
528
- function Zt(t, e) {
529
- const n = window.getSelection();
530
- if (!n || n.rangeCount === 0) return !1;
531
- const i = n.getRangeAt(0);
532
- if (!t.contains(i.commonAncestorContainer) || K(i.commonAncestorContainer)) return !1;
533
- const o = Lt(i);
534
- if (o)
535
- return P(o, "Delete", e);
536
- const r = Rt(i, t, "Backspace");
537
- return r ? P(r, "Backspace", e) : !1;
538
- }
539
- function et(t, e, n) {
540
- const i = Ct(e, n);
518
+ }), Lt(t, t.childNodes.length), y(t, o, !0), bt(t, r), ft(t), t.focus({ preventScroll: !0 }), !0;
519
+ }
520
+ function Qt(t, e) {
521
+ const o = window.getSelection();
522
+ if (!o || o.rangeCount === 0) return !1;
523
+ const i = o.getRangeAt(0);
524
+ if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer)) return !1;
525
+ const n = Rt(i);
526
+ if (n)
527
+ return D(n, "Delete", e);
528
+ const r = zt(i, t, "Backspace");
529
+ return r ? D(r, "Backspace", e) : !1;
530
+ }
531
+ function nt(t, e, o) {
532
+ const i = wt(e, o);
541
533
  if (!i.author || !i.title) return !1;
542
- i.id || (i.id = Ft(t, n));
543
- const o = t.innerHTML;
534
+ i.id || (i.id = _t(t, o));
535
+ const n = t.innerHTML;
544
536
  let r;
545
537
  try {
546
- r = Xt(t);
538
+ r = Jt(t);
547
539
  } catch {
548
540
  return !1;
549
541
  }
@@ -551,7 +543,7 @@ function et(t, e, n) {
551
543
  if (!a) return !1;
552
544
  r.collapsed || r.deleteContents();
553
545
  const s = document.createElement("span");
554
- Et(s, i, N(t, n));
546
+ St(s, i, z(t, o));
555
547
  try {
556
548
  r.insertNode(s);
557
549
  } catch {
@@ -565,80 +557,82 @@ function et(t, e, n) {
565
557
  c.setStart(u.parentNode, Math.max(0, l));
566
558
  } else
567
559
  c.setStartAfter(s);
568
- return c.collapse(!0), a.removeAllRanges(), a.addRange(c), qt(t, i, n), y(t, n, !0), ft(t, o), dt(t), !0;
560
+ return c.collapse(!0), a.removeAllRanges(), a.addRange(c), Kt(t, i, o), y(t, o, !0), bt(t, n), ft(t), !0;
569
561
  }
570
- function Qt(t, e) {
562
+ function te(t, e) {
571
563
  if (!e) return !1;
572
- const n = R(t).find((r) => r.getAttribute("data-citation-id") === e) || null;
573
- if (!n) return !1;
574
- n.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), n.focus({ preventScroll: !0 });
564
+ const o = R(t).find((r) => r.getAttribute("data-citation-id") === e) || null;
565
+ if (!o) return !1;
566
+ o.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), o.focus({ preventScroll: !0 });
575
567
  const i = window.getSelection();
576
568
  if (!i) return !0;
577
- const o = document.createRange();
578
- return o.selectNode(n), i.removeAllRanges(), i.addRange(o), !0;
569
+ const n = document.createRange();
570
+ return n.selectNode(o), i.removeAllRanges(), i.addRange(n), !0;
579
571
  }
580
- function nt(t) {
581
- return V.get(t) === !0;
572
+ function ot(t) {
573
+ return Y.get(t) === !0;
582
574
  }
583
- function U(t, e = !1) {
584
- const n = v.get(t);
585
- n && (n.classList.remove("show"), V.set(t, !1), it(t, "toggleCitationsPanel", !1), e && t.focus({ preventScroll: !0 }));
575
+ function W(t, e = !1) {
576
+ const o = v.get(t);
577
+ o && (o.classList.remove("show"), Y.set(t, !1), rt(t, "toggleCitationsPanel", !1), e && t.focus({ preventScroll: !0 }));
586
578
  }
587
- function te(t) {
588
- v.forEach((e, n) => {
589
- n !== t && U(n, !1);
579
+ function ee(t) {
580
+ v.forEach((e, o) => {
581
+ o !== t && W(o, !1);
590
582
  });
591
583
  }
592
- function ct(t, e) {
584
+ function lt(t, e) {
593
585
  if (!e.classList.contains("show")) return;
594
- const i = lt(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));
595
- e.style.width = `${o}px`, e.style.left = `${a}px`, e.style.top = `${s}px`, e.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
586
+ const i = ut(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));
587
+ e.style.width = `${n}px`, e.style.left = `${a}px`, e.style.top = `${s}px`, e.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
596
588
  }
597
589
  function C(t, e) {
598
590
  return t.querySelector(`[data-field="${e}"]`);
599
591
  }
600
- function ee(t) {
601
- const e = C(t, "author")?.value || "", n = C(t, "year")?.value || "", i = C(t, "title")?.value || "", o = C(t, "source")?.value || "", r = C(t, "url")?.value || "", a = C(t, "note")?.value || "";
592
+ function ne(t) {
593
+ const e = C(t, "author")?.value || "", o = C(t, "year")?.value || "", i = C(t, "title")?.value || "", n = C(t, "source")?.value || "", r = C(t, "url")?.value || "", a = C(t, "note")?.value || "";
602
594
  return {
603
595
  author: e,
604
- year: n,
596
+ year: o,
605
597
  title: i,
606
- source: o,
598
+ source: n,
607
599
  url: r,
608
600
  note: a
609
601
  };
610
602
  }
611
- function E(t, e) {
612
- const n = t.querySelector(".rte-citations-live");
613
- n && (n.textContent = e);
603
+ function E(t, e, o = !1) {
604
+ const i = t.querySelector(".rte-citations-live");
605
+ i && (i.textContent = e);
606
+ const n = t.querySelector(".rte-citations-status");
607
+ n && (n.textContent = e, n.classList.toggle("rte-citations-status-error", o));
614
608
  }
615
- function ne(t, e, n) {
609
+ function oe(t, e, o) {
616
610
  const i = C(e, "style");
617
- i && (i.value = N(t, n));
611
+ i && (i.value = z(t, o));
618
612
  }
619
- function zt(t, e, n) {
620
- const i = L.includes(e) ? e : n.defaultStyle;
621
- return T.set(t, i), y(t, n, !0), i;
613
+ function It(t, e, o) {
614
+ const i = L.includes(e) ? e : o.defaultStyle;
615
+ return T.set(t, i), y(t, o, !0), i;
622
616
  }
623
- function bt(t, e) {
624
- const n = N(t, e), i = L.indexOf(n), o = L[(i + 1) % L.length];
625
- return T.set(t, o), y(t, e, !0), o;
617
+ function gt(t, e) {
618
+ const o = z(t, e), i = L.indexOf(o), n = L[(i + 1) % L.length];
619
+ return T.set(t, n), y(t, e, !0), n;
626
620
  }
627
- function oe(t) {
621
+ function ie(t) {
628
622
  const e = v.get(t);
629
623
  if (e) return e;
630
- const n = f.get(t) || M || Z(), i = `rte-citations-panel-${Pt++}`, o = document.createElement("section");
631
- o.className = b, o.id = i, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", n.labels.panelAriaLabel), o.setAttribute("tabindex", "-1"), o.innerHTML = `
624
+ const o = f.get(t) || M || Q(), i = `rte-citations-panel-${Dt++}`, n = document.createElement("section");
625
+ n.className = b, n.id = i, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", o.labels.panelAriaLabel), n.setAttribute("tabindex", "-1"), n.innerHTML = `
632
626
  <header class="rte-citations-header">
633
- <h2 class="rte-citations-title">${g(n.labels.panelTitle)}</h2>
634
- <button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(n.labels.closeText)}">✕</button>
627
+ <h2 class="rte-citations-title">${g(o.labels.panelTitle)}</h2>
628
+ <button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(o.labels.closeText)}">✕</button>
635
629
  </header>
636
630
  <div class="rte-citations-body">
637
631
  <p class="rte-citations-status" aria-live="polite"></p>
638
632
 
639
633
  <div class="rte-citations-grid">
640
634
  <label class="rte-citations-label">
641
- ${g(n.labels.styleLabel)}
635
+ ${g(o.labels.styleLabel)}
642
636
  <select data-field="style" class="rte-citations-field">
643
637
  <option value="apa">APA</option>
644
638
  <option value="mla">MLA</option>
@@ -646,105 +640,106 @@ function oe(t) {
646
640
  </select>
647
641
  </label>
648
642
  <label class="rte-citations-label">
649
- ${g(n.labels.authorLabel)}
643
+ ${g(o.labels.authorLabel)}
650
644
  <input type="text" data-field="author" class="rte-citations-field" autocomplete="off" />
651
645
  </label>
652
646
  <label class="rte-citations-label">
653
- ${g(n.labels.yearLabel)}
647
+ ${g(o.labels.yearLabel)}
654
648
  <input type="text" data-field="year" class="rte-citations-field" inputmode="numeric" autocomplete="off" />
655
649
  </label>
656
650
  <label class="rte-citations-label">
657
- ${g(n.labels.titleLabel)}
651
+ ${g(o.labels.titleLabel)}
658
652
  <input type="text" data-field="title" class="rte-citations-field" autocomplete="off" />
659
653
  </label>
660
654
  <label class="rte-citations-label">
661
- ${g(n.labels.sourceLabel)}
655
+ ${g(o.labels.sourceLabel)}
662
656
  <input type="text" data-field="source" class="rte-citations-field" autocomplete="off" />
663
657
  </label>
664
658
  <label class="rte-citations-label">
665
- ${g(n.labels.urlLabel)}
659
+ ${g(o.labels.urlLabel)}
666
660
  <input type="url" data-field="url" class="rte-citations-field" autocomplete="off" />
667
661
  </label>
668
662
  <label class="rte-citations-label rte-citations-label-note">
669
- ${g(n.labels.noteLabel)}
663
+ ${g(o.labels.noteLabel)}
670
664
  <textarea data-field="note" class="rte-citations-field" rows="2"></textarea>
671
665
  </label>
672
666
  </div>
673
667
 
674
668
  <div class="rte-citations-controls" role="toolbar" aria-label="Citation actions">
675
- <button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(n.labels.insertText)}</button>
676
- <button type="button" class="rte-citations-btn" data-action="refresh">${g(n.labels.refreshText)}</button>
669
+ <button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(o.labels.insertText)}</button>
670
+ <button type="button" class="rte-citations-btn" data-action="refresh">${g(o.labels.refreshText)}</button>
677
671
  <button type="button" class="rte-citations-btn" data-action="cycle-style"></button>
678
672
  </div>
679
673
 
680
- <section class="rte-citations-recent" aria-label="${g(n.labels.recentHeading)}">
681
- <h3 class="rte-citations-recent-heading">${g(n.labels.recentHeading)}</h3>
674
+ <section class="rte-citations-recent" aria-label="${g(o.labels.recentHeading)}">
675
+ <h3 class="rte-citations-recent-heading">${g(o.labels.recentHeading)}</h3>
682
676
  <ul class="rte-citations-recent-list" role="list"></ul>
683
677
  </section>
684
678
 
679
+ <p class="rte-citations-status" aria-hidden="true"></p>
685
680
  <p class="rte-citations-shortcut">Shortcut: Ctrl/Cmd + Alt + Shift + C</p>
686
681
  <span class="rte-citations-live" aria-live="polite"></span>
687
682
  </div>
688
- `, o.addEventListener("click", (a) => {
683
+ `, n.addEventListener("click", (a) => {
689
684
  const s = a.target;
690
685
  if (!s) return;
691
686
  const u = s.closest("[data-action]");
692
687
  if (!u) return;
693
- const c = u.getAttribute("data-action") || "", l = f.get(t) || M || n;
688
+ const c = u.getAttribute("data-action") || "", l = f.get(t) || M || o;
694
689
  if (f.set(t, l), c === "close") {
695
- U(t, !0);
690
+ W(t, !0);
696
691
  return;
697
692
  }
698
693
  if (c === "insert") {
699
694
  if ($(t)) return;
700
- const d = ee(o);
695
+ const d = ne(n);
701
696
  if (!l.normalizeText(d.author) || !l.normalizeText(d.title)) {
702
- E(o, l.labels.invalidMessage);
697
+ E(n, l.labels.invalidMessage, !0);
703
698
  return;
704
699
  }
705
- if (!et(t, d, l)) {
706
- E(o, l.labels.invalidMessage);
700
+ if (!nt(t, d, l)) {
701
+ E(n, l.labels.invalidMessage, !0);
707
702
  return;
708
703
  }
709
- E(o, "Citation inserted.");
710
- const w = C(o, "title"), A = C(o, "note");
704
+ E(n, "Citation inserted.");
705
+ const w = C(n, "title"), A = C(n, "note");
711
706
  w && (w.value = ""), A && (A.value = "");
712
707
  return;
713
708
  }
714
709
  if (c === "refresh") {
715
710
  const d = y(t, l, !0);
716
- E(o, `Refreshed ${d.length} citation${d.length === 1 ? "" : "s"}.`);
711
+ E(n, `Refreshed ${d.length} citation${d.length === 1 ? "" : "s"}.`);
717
712
  return;
718
713
  }
719
714
  if (c === "cycle-style") {
720
- const d = bt(t, l);
721
- ne(t, o, l), E(o, `Style changed to ${d.toUpperCase()}.`);
715
+ const d = gt(t, l);
716
+ oe(t, n, l), E(n, `Style changed to ${d.toUpperCase()}.`);
722
717
  return;
723
718
  }
724
719
  if (c === "insert-from-recent") {
725
720
  if ($(t)) return;
726
- const d = u.getAttribute("data-citation-id") || "", m = St(t, d, j(t, l), l);
721
+ const d = u.getAttribute("data-citation-id") || "", m = $t(t, d, U(t, l), l);
727
722
  if (!m) return;
728
- et(t, m, l), E(o, `Inserted citation: ${m.title}.`);
723
+ nt(t, m, l), E(n, `Inserted citation: ${m.title}.`);
729
724
  return;
730
725
  }
731
726
  if (c === "delete-by-id") {
732
727
  if ($(t)) return;
733
728
  const d = u.getAttribute("data-citation-id") || "";
734
729
  if (Nt(t, d, l)) {
735
- E(o, "Citation deleted.");
730
+ E(n, "Citation deleted.");
736
731
  return;
737
732
  }
738
- Kt(t, d, l) && (H(t), E(o, "Removed from recent citations."));
733
+ jt(t, d, l) && (F(t), E(n, "Removed from recent citations."));
739
734
  }
740
- }), o.addEventListener("keydown", (a) => {
735
+ }), n.addEventListener("keydown", (a) => {
741
736
  if (a.key === "Escape") {
742
- a.preventDefault(), U(t, !0);
737
+ a.preventDefault(), W(t, !0);
743
738
  return;
744
739
  }
745
740
  const s = a.target;
746
741
  if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp") return;
747
- const u = Array.from(o.querySelectorAll(".rte-citations-recent-btn"));
742
+ const u = Array.from(n.querySelectorAll(".rte-citations-recent-btn"));
748
743
  if (u.length === 0) return;
749
744
  const c = u.indexOf(s);
750
745
  if (c < 0) return;
@@ -752,82 +747,82 @@ function oe(t) {
752
747
  const l = a.key === "ArrowDown" ? 1 : -1, d = (c + l + u.length) % u.length;
753
748
  u[d].focus();
754
749
  });
755
- const r = C(o, "style");
750
+ const r = C(n, "style");
756
751
  return r?.addEventListener("change", () => {
757
- const a = f.get(t) || M || n, s = r.value;
758
- zt(t, s, a), E(o, `Style changed to ${s.toUpperCase()}.`);
759
- }), tt(o, t), document.body.appendChild(o), v.set(t, o), V.set(t, !1), H(t), o;
752
+ const a = f.get(t) || M || o, s = r.value;
753
+ It(t, s, a), E(n, `Style changed to ${s.toUpperCase()}.`);
754
+ }), et(n, t), document.body.appendChild(n), v.set(t, n), Y.set(t, !1), F(t), n;
760
755
  }
761
- function z(t) {
762
- const e = oe(t);
763
- te(t), e.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(e, t), ct(t, e), H(t), C(e, "author")?.focus();
756
+ function I(t) {
757
+ const e = ie(t);
758
+ ee(t), e.classList.add("show"), Y.set(t, !0), rt(t, "toggleCitationsPanel", !0), et(e, t), lt(t, e), F(t), C(e, "author")?.focus();
764
759
  }
765
- function It(t, e) {
766
- const n = nt(t);
767
- return (typeof e == "boolean" ? e : !n) ? z(t) : U(t, !1), !0;
760
+ function Bt(t, e) {
761
+ const o = ot(t);
762
+ return (typeof e == "boolean" ? e : !o) ? I(t) : W(t, !1), !0;
768
763
  }
769
- function gt(t) {
764
+ function mt(t) {
770
765
  return typeof t.key == "string" ? t.key.toLowerCase() : "";
771
766
  }
772
- function ie(t) {
773
- const e = gt(t);
767
+ function re(t) {
768
+ const e = mt(t);
774
769
  return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "c";
775
770
  }
776
- function re(t) {
777
- const e = gt(t);
771
+ function ae(t) {
772
+ const e = mt(t);
778
773
  return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "b";
779
774
  }
780
- function ae(t) {
781
- const e = gt(t);
775
+ function se(t) {
776
+ const e = mt(t);
782
777
  return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "j";
783
778
  }
784
- function se(t) {
785
- M = t, I || (I = (e) => {
779
+ function ce(t) {
780
+ M = t, B || (B = (e) => {
786
781
  const i = e.target?.closest(S);
787
782
  if (!i) return;
788
783
  p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
789
- const o = v.get(i);
790
- o && (tt(o, i), ct(i, o)), it(i, "toggleCitationsPanel", nt(i));
791
- }, document.addEventListener("focusin", I, !0)), B || (B = (e) => {
784
+ const n = v.get(i);
785
+ n && (et(n, i), lt(i, n)), rt(i, "toggleCitationsPanel", ot(i));
786
+ }, document.addEventListener("focusin", B, !0)), O || (O = (e) => {
792
787
  const i = e.target?.closest(S);
793
- i && (p = i, Tt(i));
794
- }, document.addEventListener("input", B, !0)), O || (O = (e) => {
788
+ i && (p = i, Mt(i));
789
+ }, document.addEventListener("input", O, !0)), P || (P = (e) => {
795
790
  if (e.defaultPrevented) return;
796
- const i = !!e.target?.closest(`.${b} input, .${b} textarea, .${b} select`), o = h(void 0, !1);
797
- if (!o || $(o)) return;
798
- const r = f.get(o) || M || t;
799
- if (f.set(o, r), p = o, e.key === "Escape" && nt(o)) {
800
- e.preventDefault(), U(o, !0);
791
+ const i = !!e.target?.closest(`.${b} input, .${b} textarea, .${b} select`), n = h(void 0, !1);
792
+ if (!n || $(n)) return;
793
+ const r = f.get(n) || M || t;
794
+ if (f.set(n, r), p = n, e.key === "Escape" && ot(n)) {
795
+ e.preventDefault(), W(n, !0);
801
796
  return;
802
797
  }
803
- if (!i && !Jt(e, o, r)) {
804
- if (ie(e)) {
805
- e.preventDefault(), e.stopPropagation(), It(o);
798
+ if (!i && !Zt(e, n, r)) {
799
+ if (re(e)) {
800
+ e.preventDefault(), e.stopPropagation(), Bt(n);
806
801
  return;
807
802
  }
808
- if (re(e)) {
809
- e.preventDefault(), e.stopPropagation(), y(o, r, !0), z(o);
803
+ if (ae(e)) {
804
+ e.preventDefault(), e.stopPropagation(), y(n, r, !0), I(n);
810
805
  return;
811
806
  }
812
- ae(e) && (e.preventDefault(), e.stopPropagation(), bt(o, r));
807
+ se(e) && (e.preventDefault(), e.stopPropagation(), gt(n, r));
813
808
  }
814
- }, document.addEventListener("keydown", O, !0)), k || (k = () => {
815
- v.forEach((e, n) => {
816
- if (!n.isConnected || !e.isConnected) {
817
- kt(n), e.remove(), v.delete(n), V.delete(n);
809
+ }, document.addEventListener("keydown", P, !0)), k || (k = () => {
810
+ v.forEach((e, o) => {
811
+ if (!o.isConnected || !e.isConnected) {
812
+ Tt(o), e.remove(), v.delete(o), Y.delete(o);
818
813
  return;
819
814
  }
820
- tt(e, n), ct(n, e);
815
+ et(e, o), lt(o, e);
821
816
  });
822
817
  }, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
823
818
  }
824
- function ce() {
825
- 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;
826
- }
827
819
  function le() {
828
- if (typeof document > "u" || document.getElementById(pt)) return;
820
+ 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;
821
+ }
822
+ function ue() {
823
+ if (typeof document > "u" || document.getElementById(ht)) return;
829
824
  const t = document.createElement("style");
830
- t.id = pt, t.textContent = `
825
+ t.id = ht, t.textContent = `
831
826
  .rte-toolbar-group-items.citations,
832
827
  .editora-toolbar-group-items.citations {
833
828
  display: flex;
@@ -1193,6 +1188,30 @@ function le() {
1193
1188
  color: #94a3b8;
1194
1189
  }
1195
1190
 
1191
+ .rte-citations-status {
1192
+ margin: 0;
1193
+ min-height: 16px;
1194
+ font-size: 12px;
1195
+ font-weight: 600;
1196
+ color: #166534;
1197
+ }
1198
+
1199
+ .rte-citations-status:empty {
1200
+ display: none;
1201
+ }
1202
+
1203
+ .rte-citations-status.rte-citations-status-error {
1204
+ color: #b91c1c;
1205
+ }
1206
+
1207
+ .${b}.rte-citations-theme-dark .rte-citations-status {
1208
+ color: #86efac;
1209
+ }
1210
+
1211
+ .${b}.rte-citations-theme-dark .rte-citations-status.rte-citations-status-error {
1212
+ color: #fca5a5;
1213
+ }
1214
+
1196
1215
  .rte-citations-live {
1197
1216
  position: absolute;
1198
1217
  width: 1px;
@@ -1297,9 +1316,9 @@ function le() {
1297
1316
  }
1298
1317
  `, document.head.appendChild(t);
1299
1318
  }
1300
- const ue = (t = {}) => {
1301
- const e = Z(t);
1302
- return le(), {
1319
+ const de = (t = {}) => {
1320
+ const e = Q(t);
1321
+ return ue(), {
1303
1322
  name: "citations",
1304
1323
  toolbar: [
1305
1324
  {
@@ -1333,101 +1352,101 @@ const ue = (t = {}) => {
1333
1352
  }
1334
1353
  ],
1335
1354
  commands: {
1336
- citations: (n, i) => {
1337
- const o = h(i);
1338
- if (!o || $(o)) return !1;
1339
- const r = f.get(o) || e;
1340
- return f.set(o, r), T.set(o, N(o, r)), p = o, z(o), y(o, r, !1), !0;
1355
+ citations: (o, i) => {
1356
+ const n = h(i);
1357
+ if (!n || $(n)) return !1;
1358
+ const r = f.get(n) || e;
1359
+ return f.set(n, r), T.set(n, z(n, r)), p = n, I(n), y(n, r, !1), !0;
1341
1360
  },
1342
- toggleCitationsPanel: (n, i) => {
1343
- const o = h(i);
1344
- if (!o || $(o)) return !1;
1345
- const r = f.get(o) || e;
1346
- f.set(o, r), p = o;
1347
- const a = It(o, typeof n == "boolean" ? n : void 0);
1348
- return nt(o) && y(o, r, !1), a;
1361
+ toggleCitationsPanel: (o, i) => {
1362
+ const n = h(i);
1363
+ if (!n || $(n)) return !1;
1364
+ const r = f.get(n) || e;
1365
+ f.set(n, r), p = n;
1366
+ const a = Bt(n, typeof o == "boolean" ? o : void 0);
1367
+ return ot(n) && y(n, r, !1), a;
1349
1368
  },
1350
- insertCitation: (n, i) => {
1351
- const o = h(i);
1352
- if (!o || $(o) || !n || typeof n != "object") return !1;
1353
- const r = f.get(o) || e;
1354
- f.set(o, r), p = o;
1355
- const a = et(o, n, r);
1356
- return a && z(o), a;
1369
+ insertCitation: (o, i) => {
1370
+ const n = h(i);
1371
+ if (!n || $(n) || !o || typeof o != "object") return !1;
1372
+ const r = f.get(n) || e;
1373
+ f.set(n, r), p = n;
1374
+ const a = nt(n, o, r);
1375
+ return a && I(n), a;
1357
1376
  },
1358
- refreshCitations: (n, i) => {
1359
- const o = h(i);
1360
- if (!o) return !1;
1361
- const r = f.get(o) || e;
1362
- return f.set(o, r), p = o, y(o, r, !0), z(o), !0;
1377
+ refreshCitations: (o, i) => {
1378
+ const n = h(i);
1379
+ if (!n) return !1;
1380
+ const r = f.get(n) || e;
1381
+ return f.set(n, r), p = n, y(n, r, !0), I(n), !0;
1363
1382
  },
1364
- setCitationStyle: (n, i) => {
1365
- const o = h(i);
1366
- if (!o || !n) return !1;
1367
- const r = f.get(o) || e;
1368
- return f.set(o, r), p = o, zt(o, n, r), !0;
1383
+ setCitationStyle: (o, i) => {
1384
+ const n = h(i);
1385
+ if (!n || !o) return !1;
1386
+ const r = f.get(n) || e;
1387
+ return f.set(n, r), p = n, It(n, o, r), !0;
1369
1388
  },
1370
- cycleCitationStyle: (n, i) => {
1371
- const o = h(i);
1372
- if (!o) return !1;
1373
- const r = f.get(o) || e;
1374
- return f.set(o, r), p = o, bt(o, r), H(o), !0;
1389
+ cycleCitationStyle: (o, i) => {
1390
+ const n = h(i);
1391
+ if (!n) return !1;
1392
+ const r = f.get(n) || e;
1393
+ return f.set(n, r), p = n, gt(n, r), F(n), !0;
1375
1394
  },
1376
- getCitationRecords: (n, i) => {
1377
- const o = h(i);
1378
- if (!o) return !1;
1379
- const r = f.get(o) || e, a = j(o, r);
1380
- if (typeof n == "function")
1395
+ getCitationRecords: (o, i) => {
1396
+ const n = h(i);
1397
+ if (!n) return !1;
1398
+ const r = f.get(n) || e, a = U(n, r);
1399
+ if (typeof o == "function")
1381
1400
  try {
1382
- n(a);
1401
+ o(a);
1383
1402
  } catch {
1384
1403
  }
1385
- return o.__citationRecords = a, o.dispatchEvent(
1404
+ return n.__citationRecords = a, n.dispatchEvent(
1386
1405
  new CustomEvent("editora:citations-data", {
1387
1406
  bubbles: !0,
1388
1407
  detail: {
1389
1408
  records: a,
1390
- style: N(o, r)
1409
+ style: z(n, r)
1391
1410
  }
1392
1411
  })
1393
1412
  ), !0;
1394
1413
  },
1395
- setCitationsOptions: (n, i) => {
1396
- const o = h(i);
1397
- if (!o || !n || typeof n != "object") return !1;
1398
- const r = f.get(o) || e, a = Z({
1414
+ setCitationsOptions: (o, i) => {
1415
+ const n = h(i);
1416
+ if (!n || !o || typeof o != "object") return !1;
1417
+ const r = f.get(n) || e, a = Q({
1399
1418
  ...r,
1400
- ...n,
1419
+ ...o,
1401
1420
  labels: {
1402
1421
  ...r.labels,
1403
- ...n.labels || {}
1422
+ ...o.labels || {}
1404
1423
  },
1405
- normalizeText: n.normalizeText || r.normalizeText,
1406
- generateCitationId: n.generateCitationId || r.generateCitationId
1424
+ normalizeText: o.normalizeText || r.normalizeText,
1425
+ generateCitationId: o.generateCitationId || r.generateCitationId
1407
1426
  });
1408
- return f.set(o, a), n.defaultStyle && L.includes(n.defaultStyle) && T.set(o, n.defaultStyle), y(o, a, !0), H(o), !0;
1427
+ return f.set(n, a), o.defaultStyle && L.includes(o.defaultStyle) && T.set(n, o.defaultStyle), y(n, a, !0), F(n), !0;
1409
1428
  },
1410
- locateCitation: (n, i) => {
1411
- const o = h(i);
1412
- return !o || typeof n != "string" ? !1 : Qt(o, n);
1429
+ locateCitation: (o, i) => {
1430
+ const n = h(i);
1431
+ return !n || typeof o != "string" ? !1 : te(n, o);
1413
1432
  },
1414
- deleteCitation: (n, i) => {
1415
- const o = h(i);
1416
- if (!o || $(o)) return !1;
1417
- const r = f.get(o) || e;
1418
- return f.set(o, r), typeof n == "string" && n.trim() ? Nt(o, n, r) : Zt(o, r);
1433
+ deleteCitation: (o, i) => {
1434
+ const n = h(i);
1435
+ if (!n || $(n)) return !1;
1436
+ const r = f.get(n) || e;
1437
+ return f.set(n, r), typeof o == "string" && o.trim() ? Nt(n, o, r) : Qt(n, r);
1419
1438
  },
1420
- insertRecentCitation: (n, i) => {
1421
- const o = h(i);
1422
- if (!o || $(o)) return !1;
1423
- const r = f.get(o) || e;
1424
- f.set(o, r);
1425
- const a = j(o, r), s = rt(o, a, r);
1439
+ insertRecentCitation: (o, i) => {
1440
+ const n = h(i);
1441
+ if (!n || $(n)) return !1;
1442
+ const r = f.get(n) || e;
1443
+ f.set(n, r);
1444
+ const a = U(n, r), s = at(n, a, r);
1426
1445
  if (s.length === 0) return !1;
1427
- const u = typeof n == "string" && n.trim() ? St(o, n, a, r) : s[0];
1446
+ const u = typeof o == "string" && o.trim() ? $t(n, o, a, r) : s[0];
1428
1447
  if (!u) return !1;
1429
- const c = et(o, u, r);
1430
- return c && z(o), c;
1448
+ const c = nt(n, u, r);
1449
+ return c && I(n), c;
1431
1450
  }
1432
1451
  },
1433
1452
  keymap: {
@@ -1439,22 +1458,22 @@ const ue = (t = {}) => {
1439
1458
  "Mod-Alt-Shift-J": "cycleCitationStyle"
1440
1459
  },
1441
1460
  init: function(i) {
1442
- Y += 1;
1443
- const o = this && typeof this.__pluginConfig == "object" ? Z({ ...e, ...this.__pluginConfig }) : e;
1444
- se(o);
1461
+ X += 1;
1462
+ const n = this && typeof this.__pluginConfig == "object" ? Q({ ...e, ...this.__pluginConfig }) : e;
1463
+ ce(n);
1445
1464
  const r = h(
1446
1465
  i && i.editorElement ? { editorElement: i.editorElement } : void 0,
1447
1466
  !1
1448
1467
  );
1449
- r && (p = r, f.set(r, o), T.set(r, o.defaultStyle), it(r, "toggleCitationsPanel", !1), Tt(r));
1468
+ r && (p = r, f.set(r, n), T.set(r, n.defaultStyle), rt(r, "toggleCitationsPanel", !1), Mt(r));
1450
1469
  },
1451
1470
  destroy: () => {
1452
- Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((n) => {
1453
- window.clearTimeout(n);
1454
- }), q.clear(), ce());
1471
+ X = Math.max(0, X - 1), !(X > 0) && (K.forEach((o) => {
1472
+ window.clearTimeout(o);
1473
+ }), K.clear(), le());
1455
1474
  }
1456
1475
  };
1457
1476
  };
1458
1477
  export {
1459
- ue as CitationsPlugin
1478
+ de as CitationsPlugin
1460
1479
  };