@editora/plugins 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +5 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +249 -208
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +245 -178
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +512 -439
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +432 -371
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +159 -105
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +368 -328
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +308 -240
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +56 -54
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +128 -125
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +286 -238
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +49 -33
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +463 -393
  94. package/dist/preview.esm.js +10 -5
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +20 -17
  97. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  98. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  99. package/dist/slash-commands.cjs.js +3 -3
  100. package/dist/slash-commands.esm.js +212 -176
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +336 -280
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +69 -61
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +123 -97
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +19 -14
  109. package/dist/style.css +1 -0
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +225 -191
  112. package/dist/template.cjs.js +11 -11
  113. package/dist/template.esm.js +153 -124
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +27 -21
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +87 -70
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +162 -100
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +678 -602
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +157 -128
  124. package/package.json +13 -7
  125. package/LICENSE +0 -21
  126. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  127. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  128. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  129. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  130. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  131. package/dist/documentManager-Jf0RbSks.js +0 -17
  132. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  133. package/dist/index-CvJk4DKa.js +0 -221
  134. package/dist/index-D3CycEFU.mjs +0 -16543
  135. package/dist/index-tqLTHcO6.js +0 -1
  136. package/dist/index.es-CE_A4QSm.js +0 -5
  137. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  138. package/dist/jspdf.es.min-BoS80556.js +0 -77
  139. package/dist/plugins.css +0 -1
  140. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -1,4 +1,4 @@
1
- const y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", se = "__editoraCommandEditorRoot", le = "rte-smart-paste-styles", u = "rte-smart-paste-panel", h = "smart-paste", S = "smartPaste", E = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Ee = typeof NodeFilter < "u" ? NodeFilter.SHOW_COMMENT : 128, ie = "__editoraSmartPasteHandled", ke = /* @__PURE__ */ new Set([
1
+ const v = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", se = "__editoraCommandEditorRoot", le = "rte-smart-paste-styles", u = "rte-smart-paste-panel", x = "smart-paste", E = "smartPaste", k = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', Ee = typeof NodeFilter < "u" ? NodeFilter.SHOW_COMMENT : 128, ie = "__editoraSmartPasteHandled", ke = /* @__PURE__ */ new Set([
2
2
  "script",
3
3
  "style",
4
4
  "meta",
@@ -15,7 +15,7 @@ const y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
15
15
  "textarea",
16
16
  "select",
17
17
  "option"
18
- ]), Ce = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th", "colgroup", "col"]), Te = /* @__PURE__ */ new Set(["span", "font"]), Ae = /^(https?:|mailto:|tel:|#|\/)/i, Pe = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, we = /* @__PURE__ */ new Set([
18
+ ]), Ce = /* @__PURE__ */ new Set(["table", "thead", "tbody", "tfoot", "tr", "td", "th", "colgroup", "col"]), Te = /* @__PURE__ */ new Set(["span", "font"]), Ae = /^(https?:|mailto:|tel:|#|\/)/i, Pe = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, Le = /* @__PURE__ */ new Set([
19
19
  "color",
20
20
  "background-color",
21
21
  "font-weight",
@@ -47,7 +47,7 @@ const y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
47
47
  "border-width",
48
48
  "border-style",
49
49
  "list-style-type"
50
- ]), Le = {
50
+ ]), we = {
51
51
  panelTitle: "Smart Paste",
52
52
  panelAriaLabel: "Smart paste panel",
53
53
  enabledText: "Smart paste is enabled",
@@ -87,8 +87,8 @@ const y = ".rte-content, .editora-content", ee = "[data-editora-editor], .rte-ed
87
87
  keepDataAttributes: !1,
88
88
  preserveTables: !1
89
89
  }
90
- }, d = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new Map(), q = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new Set();
91
- let I = 0, $e = 0, $ = null, m = null, A = null, P = null, T = null, w = null;
90
+ }, d = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), h = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Set();
91
+ let W = 0, $e = 0, O = null, b = null, L = null, w = null, A = null, $ = null;
92
92
  function X(e) {
93
93
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
94
94
  }
@@ -96,27 +96,27 @@ function Me(e) {
96
96
  return e.replace(/\u00A0/g, " ").replace(/\r\n?/g, `
97
97
  `);
98
98
  }
99
- function _(e) {
99
+ function H(e) {
100
100
  return e === "balanced" || e === "plain" ? e : "fidelity";
101
101
  }
102
102
  function Z(e, t) {
103
103
  return {
104
- keepStyles: e?.keepStyles ?? t.keepStyles,
105
- keepClasses: e?.keepClasses ?? t.keepClasses,
106
- keepDataAttributes: e?.keepDataAttributes ?? t.keepDataAttributes,
107
- preserveTables: e?.preserveTables ?? t.preserveTables
104
+ keepStyles: (e == null ? void 0 : e.keepStyles) ?? t.keepStyles,
105
+ keepClasses: (e == null ? void 0 : e.keepClasses) ?? t.keepClasses,
106
+ keepDataAttributes: (e == null ? void 0 : e.keepDataAttributes) ?? t.keepDataAttributes,
107
+ preserveTables: (e == null ? void 0 : e.preserveTables) ?? t.preserveTables
108
108
  };
109
109
  }
110
- function K(e = {}) {
110
+ function V(e = {}) {
111
111
  const t = e.profileOptions || {};
112
112
  return {
113
113
  enabled: e.enabled !== !1,
114
- defaultProfile: _(e.defaultProfile),
114
+ defaultProfile: H(e.defaultProfile),
115
115
  maxHtmlLength: Math.max(8e3, Math.min(8e5, Number(e.maxHtmlLength ?? 22e4))),
116
116
  removeComments: e.removeComments !== !1,
117
117
  normalizeWhitespace: e.normalizeWhitespace !== !1,
118
118
  labels: {
119
- ...Le,
119
+ ...we,
120
120
  ...e.labels || {}
121
121
  },
122
122
  normalizeText: e.normalizeText || Me,
@@ -146,34 +146,40 @@ function ce(e) {
146
146
  function te(e) {
147
147
  return e.closest(ee) || e;
148
148
  }
149
- function H(e) {
150
- if (!e) return null;
151
- if (e.matches(y)) return e;
152
- const t = e.querySelector(y);
149
+ function D(e) {
150
+ if (!e)
151
+ return null;
152
+ if (e.matches(v))
153
+ return e;
154
+ const t = e.querySelector(v);
153
155
  return t instanceof HTMLElement ? t : null;
154
156
  }
155
157
  function Oe() {
156
- if (typeof window > "u") return null;
158
+ if (typeof window > "u")
159
+ return null;
157
160
  const e = window[se];
158
- if (!(e instanceof HTMLElement)) return null;
161
+ if (!(e instanceof HTMLElement))
162
+ return null;
159
163
  window[se] = null;
160
- const t = H(e);
161
- if (t) return t;
164
+ const t = D(e);
165
+ if (t)
166
+ return t;
162
167
  const a = e.closest(ee);
163
168
  if (a) {
164
- const n = H(a);
165
- if (n) return n;
169
+ const n = D(a);
170
+ if (n)
171
+ return n;
166
172
  }
167
- const r = e.closest(y);
173
+ const r = e.closest(v);
168
174
  return r instanceof HTMLElement ? r : null;
169
175
  }
170
176
  function Re(e) {
171
177
  const t = e.closest("[data-editora-editor]");
172
- if (t && H(t) === e)
178
+ if (t && D(t) === e)
173
179
  return t;
174
180
  let a = e;
175
181
  for (; a; ) {
176
- if (a.matches(ee) && (a === e || H(a) === e))
182
+ if (a.matches(ee) && (a === e || D(a) === e))
177
183
  return a;
178
184
  a = a.parentElement;
179
185
  }
@@ -182,41 +188,50 @@ function Re(e) {
182
188
  function pe(e) {
183
189
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
184
190
  }
185
- function C(e, t = !0, a = !0) {
186
- if (V(), e?.contentElement instanceof HTMLElement) return e.contentElement;
187
- if (e?.editorElement instanceof HTMLElement) {
188
- const s = H(e.editorElement);
189
- if (s) return s;
191
+ function T(e, t = !0, a = !0) {
192
+ if (j(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
193
+ return e.contentElement;
194
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
195
+ const s = D(e.editorElement);
196
+ if (s)
197
+ return s;
190
198
  }
191
199
  const r = Oe();
192
- if (r) return r;
200
+ if (r)
201
+ return r;
193
202
  const n = window.getSelection();
194
203
  if (n && n.rangeCount > 0) {
195
- const l = pe(n.getRangeAt(0).startContainer)?.closest(y);
196
- if (l) return l;
204
+ const s = pe(n.getRangeAt(0).startContainer), l = s == null ? void 0 : s.closest(v);
205
+ if (l)
206
+ return l;
197
207
  }
198
208
  const o = document.activeElement;
199
209
  if (o) {
200
- if (o.matches(y)) return o;
201
- const s = o.closest(y);
202
- if (s) return s;
210
+ if (o.matches(v))
211
+ return o;
212
+ const s = o.closest(v);
213
+ if (s)
214
+ return s;
203
215
  }
204
216
  if (a) {
205
- if (m && m.isConnected) return m;
206
- m && !m.isConnected && (m = null);
217
+ if (b && b.isConnected)
218
+ return b;
219
+ b && !b.isConnected && (b = null);
207
220
  }
208
- return t ? document.querySelector(y) : null;
221
+ return t ? document.querySelector(v) : null;
209
222
  }
210
223
  function ze(e) {
211
224
  const t = e.target;
212
225
  if (t) {
213
- const r = t.closest(y);
214
- if (r) return r;
226
+ const r = t.closest(v);
227
+ if (r)
228
+ return r;
215
229
  }
216
230
  const a = window.getSelection();
217
231
  if (a && a.rangeCount > 0) {
218
- const n = pe(a.getRangeAt(0).startContainer)?.closest(y);
219
- if (n) return n;
232
+ const r = pe(a.getRangeAt(0).startContainer), n = r == null ? void 0 : r.closest(v);
233
+ if (n)
234
+ return n;
220
235
  }
221
236
  return null;
222
237
  }
@@ -225,17 +240,18 @@ function B(e) {
225
240
  }
226
241
  function _e(e) {
227
242
  const t = te(e);
228
- if (B(t)) return !0;
243
+ if (B(t))
244
+ return !0;
229
245
  const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
230
246
  return B(a) ? !0 : B(document.documentElement) || B(document.body);
231
247
  }
232
- function F(e, t) {
248
+ function G(e, t) {
233
249
  e.classList.remove("rte-smart-paste-theme-dark"), _e(t) && e.classList.add("rte-smart-paste-theme-dark");
234
250
  }
235
251
  function de(e) {
236
252
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
237
253
  }
238
- function D(e, t, a) {
254
+ function N(e, t, a) {
239
255
  const r = Re(e);
240
256
  Array.from(
241
257
  r.querySelectorAll(
@@ -245,45 +261,48 @@ function D(e, t, a) {
245
261
  o.classList.toggle("active", a), o.setAttribute("data-active", a ? "true" : "false"), o.setAttribute("aria-pressed", a ? "true" : "false");
246
262
  });
247
263
  }
248
- function p(e, t) {
264
+ function m(e, t) {
249
265
  d.has(e) || d.set(e, t);
250
- let a = L.get(e);
266
+ let a = M.get(e);
251
267
  return a || (a = {
252
268
  enabled: t.enabled,
253
269
  profile: t.defaultProfile,
254
270
  lastReport: null
255
- }, L.set(e, a)), Qe(e), z.add(e), a;
271
+ }, M.set(e, a)), Qe(e), _.add(e), a;
256
272
  }
257
273
  function me(e) {
258
- const t = j.get(e);
259
- t && (e.removeEventListener("paste", t, !0), j.delete(e));
274
+ const t = F.get(e);
275
+ t && (e.removeEventListener("paste", t, !0), F.delete(e));
260
276
  }
261
277
  function be(e) {
262
- me(e), g.get(e)?.remove(), g.delete(e), q.delete(e), d.delete(e), L.delete(e), z.delete(e), m === e && (m = null);
278
+ var t;
279
+ me(e), (t = h.get(e)) == null || t.remove(), h.delete(e), I.delete(e), d.delete(e), M.delete(e), _.delete(e), b === e && (b = null);
263
280
  }
264
- function V() {
265
- Array.from(z).forEach((t) => {
281
+ function j() {
282
+ Array.from(_).forEach((t) => {
266
283
  t.isConnected || be(t);
267
284
  });
268
285
  }
269
286
  function He(e) {
270
- for (let t = 0; t < e.length; t += 1) {
271
- const a = e[t];
272
- if (!(a.type !== "childList" || a.removedNodes.length === 0))
273
- for (let r = 0; r < a.removedNodes.length; r += 1) {
274
- const n = a.removedNodes[r];
275
- if (n.nodeType !== Node.ELEMENT_NODE) continue;
276
- const o = n;
277
- if (o.matches?.(y) || o.matches?.(`.${u}`) || o.querySelector?.(y) || o.querySelector?.(`.${u}`))
287
+ var t, a, r, n;
288
+ for (let o = 0; o < e.length; o += 1) {
289
+ const s = e[o];
290
+ if (!(s.type !== "childList" || s.removedNodes.length === 0))
291
+ for (let l = 0; l < s.removedNodes.length; l += 1) {
292
+ const c = s.removedNodes[l];
293
+ if (c.nodeType !== Node.ELEMENT_NODE)
294
+ continue;
295
+ const i = c;
296
+ if ((t = i.matches) != null && t.call(i, v) || (a = i.matches) != null && a.call(i, `.${u}`) || (r = i.querySelector) != null && r.call(i, v) || (n = i.querySelector) != null && n.call(i, `.${u}`))
278
297
  return !0;
279
298
  }
280
299
  }
281
300
  return !1;
282
301
  }
283
302
  function re(e) {
284
- return q.get(e) === !0;
303
+ return I.get(e) === !0;
285
304
  }
286
- function O(e, t) {
305
+ function R(e, t) {
287
306
  const a = e.querySelector(".rte-smart-paste-live");
288
307
  a && (a.textContent = t);
289
308
  }
@@ -307,8 +326,9 @@ function qe(e, t) {
307
326
  function Ie(e) {
308
327
  return e.split(/\s+/).map((a) => a.trim()).filter(Boolean).filter((a) => !/^mso/i.test(a)).filter((a) => !/^docs-/i.test(a)).filter((a) => !/^c\d+$/i.test(a)).join(" ");
309
328
  }
310
- function Be(e) {
311
- if (!e) return { value: "", changed: !1 };
329
+ function We(e) {
330
+ if (!e)
331
+ return { value: "", changed: !1 };
312
332
  const t = e.split(";"), a = [];
313
333
  let r = !1;
314
334
  return t.forEach((n) => {
@@ -322,7 +342,7 @@ function Be(e) {
322
342
  r = !0;
323
343
  return;
324
344
  }
325
- if (!we.has(s)) {
345
+ if (!Le.has(s)) {
326
346
  r = !0;
327
347
  return;
328
348
  }
@@ -348,7 +368,7 @@ function fe(e) {
348
368
  t.removeChild(e);
349
369
  }
350
370
  }
351
- function We(e, t, a, r) {
371
+ function Be(e, t, a, r) {
352
372
  const n = e.tagName.toLowerCase();
353
373
  if (ke.has(n)) {
354
374
  r.removedElements += 1, e.remove();
@@ -360,7 +380,7 @@ function We(e, t, a, r) {
360
380
  return;
361
381
  }
362
382
  if (Array.from(e.attributes).forEach((s) => {
363
- const l = s.name.toLowerCase(), i = s.value;
383
+ const l = s.name.toLowerCase(), c = s.value;
364
384
  if (l.startsWith("on")) {
365
385
  e.removeAttribute(s.name), r.removedAttributes += 1;
366
386
  return;
@@ -370,12 +390,12 @@ function We(e, t, a, r) {
370
390
  e.removeAttribute(s.name), r.removedAttributes += 1;
371
391
  return;
372
392
  }
373
- const c = Be(i);
374
- if (!c.value) {
375
- e.removeAttribute(s.name), r.removedAttributes += 1, c.changed && (r.normalizedStyles += 1);
393
+ const i = We(c);
394
+ if (!i.value) {
395
+ e.removeAttribute(s.name), r.removedAttributes += 1, i.changed && (r.normalizedStyles += 1);
376
396
  return;
377
397
  }
378
- (c.changed || c.value !== i) && (e.setAttribute("style", c.value), r.normalizedStyles += 1);
398
+ (i.changed || i.value !== c) && (e.setAttribute("style", i.value), r.normalizedStyles += 1);
379
399
  return;
380
400
  }
381
401
  if (l === "class") {
@@ -383,12 +403,12 @@ function We(e, t, a, r) {
383
403
  e.removeAttribute(s.name), r.removedAttributes += 1;
384
404
  return;
385
405
  }
386
- const c = Ie(i);
387
- if (!c) {
406
+ const i = Ie(c);
407
+ if (!i) {
388
408
  e.removeAttribute(s.name), r.removedAttributes += 1;
389
409
  return;
390
410
  }
391
- c !== i && (e.setAttribute("class", c), r.removedAttributes += 1);
411
+ i !== c && (e.setAttribute("class", i), r.removedAttributes += 1);
392
412
  return;
393
413
  }
394
414
  if (l.startsWith("data-") && !t.keepDataAttributes) {
@@ -404,12 +424,12 @@ function We(e, t, a, r) {
404
424
  return;
405
425
  }
406
426
  if (l === "href" || l === "src" || l === "xlink:href") {
407
- const c = ue(i);
408
- if (!c) {
427
+ const i = ue(c);
428
+ if (!i) {
409
429
  e.removeAttribute(s.name), r.removedAttributes += 1;
410
430
  return;
411
431
  }
412
- c !== i && e.setAttribute(s.name, c);
432
+ i !== c && e.setAttribute(s.name, i);
413
433
  }
414
434
  }), n === "a") {
415
435
  if (!e.getAttribute("href")) {
@@ -445,35 +465,37 @@ function Ke(e, t, a, r, n) {
445
465
  };
446
466
  if (r.removeComments)
447
467
  try {
448
- const f = document.createTreeWalker(o.content, Ee, null), b = [];
449
- let k = f.nextNode();
450
- for (; k; )
451
- b.push(k), k = f.nextNode();
452
- b.forEach((v) => {
453
- v.remove(), s.removedComments += 1;
468
+ const f = document.createTreeWalker(o.content, Ee, null), p = [];
469
+ let y = f.nextNode();
470
+ for (; y; )
471
+ p.push(y), y = f.nextNode();
472
+ p.forEach((g) => {
473
+ g.remove(), s.removedComments += 1;
454
474
  });
455
475
  } catch {
456
476
  }
457
477
  Array.from(o.content.querySelectorAll("*")).forEach((f) => {
458
- f.isConnected && We(f, t, a, s);
478
+ f.isConnected && Be(f, t, a, s);
459
479
  });
460
- let i = o.innerHTML;
461
- r.normalizeWhitespace && n !== "fidelity" ? i = i.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (i = i.trim());
462
- const c = (o.content.textContent || "").trim().length;
480
+ let c = o.innerHTML;
481
+ r.normalizeWhitespace && n !== "fidelity" ? c = c.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (c = c.trim());
482
+ const i = (o.content.textContent || "").trim().length;
463
483
  return {
464
- html: i,
465
- textLength: c,
484
+ html: c,
485
+ textLength: i,
466
486
  counters: s
467
487
  };
468
488
  }
469
489
  function ge(e) {
470
490
  const t = window.getSelection();
471
- if (!t || t.rangeCount === 0) return null;
491
+ if (!t || t.rangeCount === 0)
492
+ return null;
472
493
  const a = t.getRangeAt(0);
473
494
  return e.contains(a.commonAncestorContainer) ? a : null;
474
495
  }
475
496
  function he(e, t) {
476
- if (!e.isConnected) return;
497
+ if (!e.isConnected)
498
+ return;
477
499
  const a = window.getSelection();
478
500
  a && (a.removeAllRanges(), a.addRange(t));
479
501
  }
@@ -485,7 +507,8 @@ function Ve(e, t) {
485
507
  } catch {
486
508
  }
487
509
  const a = ge(e);
488
- if (!a) return !1;
510
+ if (!a)
511
+ return !1;
489
512
  a.deleteContents();
490
513
  const r = document.createElement("template");
491
514
  r.innerHTML = t;
@@ -504,7 +527,8 @@ function je(e, t) {
504
527
  } catch {
505
528
  }
506
529
  const a = ge(e);
507
- if (!a) return !1;
530
+ if (!a)
531
+ return !1;
508
532
  a.deleteContents();
509
533
  const r = document.createTextNode(t);
510
534
  a.insertNode(r);
@@ -512,7 +536,8 @@ function je(e, t) {
512
536
  return n.setStart(r, r.length), n.collapse(!0), he(e, n), !0;
513
537
  }
514
538
  function Fe(e, t) {
515
- if (t === e.innerHTML) return;
539
+ if (t === e.innerHTML)
540
+ return;
516
541
  const a = window.execEditorCommand || window.executeEditorCommand;
517
542
  if (typeof a == "function")
518
543
  try {
@@ -523,7 +548,7 @@ function Fe(e, t) {
523
548
  function Ge(e) {
524
549
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
525
550
  }
526
- function W(e, t, a, r, n, o) {
551
+ function K(e, t, a, r, n, o) {
527
552
  return {
528
553
  source: e,
529
554
  profile: t,
@@ -540,16 +565,16 @@ function W(e, t, a, r, n, o) {
540
565
  function Ue(e, t, a, r) {
541
566
  const n = qe(e, t);
542
567
  if (a === "plain") {
543
- const l = t || e.replace(/<[^>]*>/g, " "), i = J(l, r);
568
+ const l = t || e.replace(/<[^>]*>/g, " "), c = J(l, r);
544
569
  return {
545
570
  mode: "text",
546
- value: i,
547
- report: W(
571
+ value: c,
572
+ report: K(
548
573
  n,
549
574
  a,
550
575
  e.length,
551
576
  0,
552
- i.length,
577
+ c.length,
553
578
  {
554
579
  removedElements: 0,
555
580
  removedAttributes: 0,
@@ -564,7 +589,7 @@ function Ue(e, t, a, r) {
564
589
  return {
565
590
  mode: "text",
566
591
  value: l,
567
- report: W(
592
+ report: K(
568
593
  n,
569
594
  a,
570
595
  e.length,
@@ -585,13 +610,13 @@ function Ue(e, t, a, r) {
585
610
  return {
586
611
  mode: "text",
587
612
  value: l,
588
- report: W(n, a, e.length, 0, l.length, s.counters)
613
+ report: K(n, a, e.length, 0, l.length, s.counters)
589
614
  };
590
615
  }
591
616
  return {
592
617
  mode: "html",
593
618
  value: s.html,
594
- report: W(
619
+ report: K(
595
620
  n,
596
621
  a,
597
622
  e.length,
@@ -601,7 +626,7 @@ function Ue(e, t, a, r) {
601
626
  )
602
627
  };
603
628
  }
604
- function G(e, t) {
629
+ function U(e, t) {
605
630
  return e === "balanced" ? t.balancedText : e === "plain" ? t.plainText : t.fidelityText;
606
631
  }
607
632
  function ae(e) {
@@ -624,64 +649,67 @@ function Ye(e, t) {
624
649
  s && (s.textContent = t.labels.profileLabel);
625
650
  const l = e.querySelector('.rte-smart-paste-profile[role="group"]');
626
651
  l && l.setAttribute("aria-label", t.labels.profileLabel);
627
- const i = e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');
628
- i && (i.textContent = t.labels.fidelityText);
629
- const c = e.querySelector('[data-action="set-profile"][data-profile="balanced"]');
630
- c && (c.textContent = t.labels.balancedText);
652
+ const c = e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');
653
+ c && (c.textContent = t.labels.fidelityText);
654
+ const i = e.querySelector('[data-action="set-profile"][data-profile="balanced"]');
655
+ i && (i.textContent = t.labels.balancedText);
631
656
  const f = e.querySelector('[data-action="set-profile"][data-profile="plain"]');
632
657
  f && (f.textContent = t.labels.plainText);
633
- const b = e.querySelector(".rte-smart-paste-report-title");
634
- b && (b.textContent = t.labels.lastPasteHeading);
635
- const k = e.querySelector(".rte-smart-paste-empty");
636
- k && (k.textContent = t.labels.lastPasteEmptyText);
637
- const v = e.querySelector('[data-key="source-label"]');
638
- v && (v.textContent = t.labels.lastPasteSourceLabel);
639
- const U = e.querySelector('[data-key="profile-label"]');
640
- U && (U.textContent = t.labels.lastPasteProfileLabel);
641
- const M = e.querySelector('[data-key="removed-label"]');
642
- M && (M.textContent = t.labels.lastPasteRemovedLabel);
658
+ const p = e.querySelector(".rte-smart-paste-report-title");
659
+ p && (p.textContent = t.labels.lastPasteHeading);
660
+ const y = e.querySelector(".rte-smart-paste-empty");
661
+ y && (y.textContent = t.labels.lastPasteEmptyText);
662
+ const g = e.querySelector('[data-key="source-label"]');
663
+ g && (g.textContent = t.labels.lastPasteSourceLabel);
664
+ const P = e.querySelector('[data-key="profile-label"]');
665
+ P && (P.textContent = t.labels.lastPasteProfileLabel);
666
+ const C = e.querySelector('[data-key="removed-label"]');
667
+ C && (C.textContent = t.labels.lastPasteRemovedLabel);
643
668
  const oe = e.querySelector('[data-key="chars-label"]');
644
669
  oe && (oe.textContent = t.labels.lastPasteCharsLabel);
645
670
  const ne = e.querySelector(".rte-smart-paste-shortcut");
646
671
  ne && (ne.textContent = t.labels.shortcutText);
647
672
  }
648
- function x(e) {
649
- const t = g.get(e), a = d.get(e) || $, r = L.get(e);
650
- if (!t || !a || !r) return;
673
+ function S(e) {
674
+ const t = h.get(e), a = d.get(e) || O, r = M.get(e);
675
+ if (!t || !a || !r)
676
+ return;
651
677
  Ye(t, a);
652
678
  const n = t.querySelector(".rte-smart-paste-status");
653
679
  n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
654
680
  const o = t.querySelector('[data-action="toggle-enabled"]');
655
681
  o && (o.setAttribute("data-enabled", r.enabled ? "true" : "false"), o.textContent = r.enabled ? a.labels.toggleOnText : a.labels.toggleOffText, o.setAttribute("aria-pressed", r.enabled ? "true" : "false")), Array.from(
656
682
  t.querySelectorAll('[data-action="set-profile"][data-profile]')
657
- ).forEach((v) => {
658
- const M = _(v.getAttribute("data-profile")) === r.profile;
659
- v.classList.toggle("active", M), v.setAttribute("aria-pressed", M ? "true" : "false");
683
+ ).forEach((g) => {
684
+ const C = H(g.getAttribute("data-profile")) === r.profile;
685
+ g.classList.toggle("active", C), g.setAttribute("aria-pressed", C ? "true" : "false");
660
686
  });
661
- const l = t.querySelector(".rte-smart-paste-empty"), i = t.querySelector(".rte-smart-paste-report"), c = t.querySelector('[data-key="source-value"]'), f = t.querySelector('[data-key="profile-value"]'), b = t.querySelector('[data-key="removed-value"]'), k = t.querySelector('[data-key="chars-value"]');
687
+ const l = t.querySelector(".rte-smart-paste-empty"), c = t.querySelector(".rte-smart-paste-report"), i = t.querySelector('[data-key="source-value"]'), f = t.querySelector('[data-key="profile-value"]'), p = t.querySelector('[data-key="removed-value"]'), y = t.querySelector('[data-key="chars-value"]');
662
688
  if (!r.lastReport) {
663
- l && (l.hidden = !1), i && (i.hidden = !0);
689
+ l && (l.hidden = !1), c && (c.hidden = !0);
664
690
  return;
665
691
  }
666
- if (l && (l.hidden = !0), i && (i.hidden = !1), c && (c.textContent = r.lastReport.source), f && (f.textContent = G(r.lastReport.profile, a.labels)), b) {
667
- const v = r.lastReport.removedElements + r.lastReport.removedAttributes + r.lastReport.removedComments + r.lastReport.normalizedStyles;
668
- b.textContent = String(v);
692
+ if (l && (l.hidden = !0), c && (c.hidden = !1), i && (i.textContent = r.lastReport.source), f && (f.textContent = U(r.lastReport.profile, a.labels)), p) {
693
+ const g = r.lastReport.removedElements + r.lastReport.removedAttributes + r.lastReport.removedComments + r.lastReport.normalizedStyles;
694
+ p.textContent = String(g);
669
695
  }
670
- k && (k.textContent = String(r.lastReport.outputTextLength));
696
+ y && (y.textContent = String(r.lastReport.outputTextLength));
671
697
  }
672
698
  function Q(e, t) {
673
- if (!t.classList.contains("show")) return;
699
+ if (!t.classList.contains("show"))
700
+ return;
674
701
  const a = te(e).getBoundingClientRect(), r = Math.min(window.innerWidth - 20, 360), n = Math.max(10, window.innerWidth - r - 10), o = Math.min(Math.max(10, a.right - r), n), s = Math.max(10, Math.min(window.innerHeight - 10, a.top + 12));
675
702
  t.style.width = `${r}px`, t.style.left = `${o}px`, t.style.top = `${s}px`, t.style.maxHeight = `${Math.max(240, window.innerHeight - 20)}px`;
676
703
  }
677
- function N(e, t = !1) {
678
- const a = g.get(e);
679
- a && (a.classList.remove("show"), q.set(e, !1), D(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
704
+ function q(e, t = !1) {
705
+ const a = h.get(e);
706
+ a && (a.classList.remove("show"), I.set(e, !1), N(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
680
707
  }
681
708
  function Xe(e) {
682
- const t = g.get(e);
683
- if (t) return t;
684
- const a = d.get(e) || $ || K(), r = `rte-smart-paste-panel-${$e++}`, n = document.createElement("section");
709
+ const t = h.get(e);
710
+ if (t)
711
+ return t;
712
+ const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${$e++}`, n = document.createElement("section");
685
713
  return n.className = u, n.id = r, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", a.labels.panelAriaLabel), n.innerHTML = `
686
714
  <header class="rte-smart-paste-header">
687
715
  <h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
@@ -715,54 +743,60 @@ function Xe(e) {
715
743
  </div>
716
744
  <div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
717
745
  `, n.addEventListener("click", (o) => {
718
- const l = o.target?.closest("[data-action]");
719
- if (!l) return;
720
- const i = l.getAttribute("data-action");
721
- if (i) {
722
- if (i === "close") {
723
- N(e, !0);
746
+ const s = o.target, l = s == null ? void 0 : s.closest("[data-action]");
747
+ if (!l)
748
+ return;
749
+ const c = l.getAttribute("data-action");
750
+ if (c) {
751
+ if (c === "close") {
752
+ q(e, !0);
724
753
  return;
725
754
  }
726
- if (i === "toggle-enabled") {
727
- const c = p(e, d.get(e) || a);
728
- c.enabled = !c.enabled, D(e, "toggleSmartPasteEnabled", c.enabled), x(e), O(n, c.enabled ? a.labels.enabledText : a.labels.disabledText);
755
+ if (c === "toggle-enabled") {
756
+ const i = m(e, d.get(e) || a);
757
+ i.enabled = !i.enabled, N(e, "toggleSmartPasteEnabled", i.enabled), S(e), R(n, i.enabled ? a.labels.enabledText : a.labels.disabledText);
729
758
  return;
730
759
  }
731
- if (i === "cycle-profile") {
732
- const c = p(e, d.get(e) || a);
733
- c.profile = ae(c.profile), x(e), O(n, `${a.labels.profileLabel}: ${G(c.profile, a.labels)}`);
760
+ if (c === "cycle-profile") {
761
+ const i = m(e, d.get(e) || a);
762
+ i.profile = ae(i.profile), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
734
763
  return;
735
764
  }
736
- if (i === "set-profile") {
737
- const c = p(e, d.get(e) || a);
738
- c.profile = _(l.getAttribute("data-profile")), x(e), O(n, `${a.labels.profileLabel}: ${G(c.profile, a.labels)}`);
765
+ if (c === "set-profile") {
766
+ const i = m(e, d.get(e) || a);
767
+ i.profile = H(l.getAttribute("data-profile")), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
739
768
  }
740
769
  }
741
770
  }), n.addEventListener("keydown", (o) => {
742
771
  if (o.key === "Escape") {
743
- o.preventDefault(), N(e, !0);
772
+ o.preventDefault(), q(e, !0);
744
773
  return;
745
774
  }
746
- if (o.key !== "ArrowRight" && o.key !== "ArrowLeft") return;
775
+ if (o.key !== "ArrowRight" && o.key !== "ArrowLeft")
776
+ return;
747
777
  const s = Array.from(
748
778
  n.querySelectorAll('[data-action="set-profile"][data-profile]')
749
779
  );
750
- if (s.length === 0) return;
780
+ if (s.length === 0)
781
+ return;
751
782
  const l = s.findIndex((f) => f === document.activeElement);
752
- if (l < 0) return;
753
- const i = o.key === "ArrowRight" ? 1 : -1, c = (l + i + s.length) % s.length;
754
- o.preventDefault(), s[c].focus();
755
- }), F(n, e), document.body.appendChild(n), g.set(e, n), q.set(e, !1), x(e), n;
783
+ if (l < 0)
784
+ return;
785
+ const c = o.key === "ArrowRight" ? 1 : -1, i = (l + c + s.length) % s.length;
786
+ o.preventDefault(), s[i].focus();
787
+ }), G(n, e), document.body.appendChild(n), h.set(e, n), I.set(e, !1), S(e), n;
756
788
  }
757
789
  function ye(e) {
758
790
  const t = Xe(e);
759
- g.forEach((r, n) => {
760
- n !== e && N(n, !1);
761
- }), t.classList.add("show"), q.set(e, !0), D(e, "toggleSmartPastePanel", !0), F(t, e), Q(e, t), t.querySelector('[data-action="toggle-enabled"]')?.focus();
791
+ h.forEach((r, n) => {
792
+ n !== e && q(n, !1);
793
+ }), t.classList.add("show"), I.set(e, !0), N(e, "toggleSmartPastePanel", !0), G(t, e), Q(e, t);
794
+ const a = t.querySelector('[data-action="toggle-enabled"]');
795
+ a == null || a.focus();
762
796
  }
763
797
  function xe(e, t) {
764
798
  const a = re(e);
765
- return (typeof t == "boolean" ? t : !a) ? ye(e) : N(e, !1), !0;
799
+ return (typeof t == "boolean" ? t : !a) ? ye(e) : q(e, !1), !0;
766
800
  }
767
801
  function ve(e) {
768
802
  return {
@@ -772,50 +806,56 @@ function ve(e) {
772
806
  };
773
807
  }
774
808
  function Ze(e, t) {
775
- const a = d.get(e) || $;
776
- if (!a) return !1;
777
- const r = p(e, a);
809
+ const a = d.get(e) || O;
810
+ if (!a)
811
+ return !1;
812
+ const r = m(e, a);
778
813
  if (!r.enabled || de(e)) {
779
- const b = g.get(e);
780
- return b && de(e) && O(b, a.labels.readonlyMessage), !1;
814
+ const p = h.get(e);
815
+ return p && de(e) && R(p, a.labels.readonlyMessage), !1;
781
816
  }
782
817
  const n = t.clipboardData;
783
- if (!n) return !1;
818
+ if (!n)
819
+ return !1;
784
820
  const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
785
- if (!o && !s) return !1;
821
+ if (!o && !s)
822
+ return !1;
786
823
  const l = Ue(o, s, r.profile, a);
787
- if (!l.value) return !1;
788
- const i = e.innerHTML;
789
- if (!(l.mode === "html" ? Ve(e, l.value) : je(e, l.value))) return !1;
790
- r.lastReport = { ...l.report }, L.set(e, r), Fe(e, i), Ge(e), e.dispatchEvent(
824
+ if (!l.value)
825
+ return !1;
826
+ const c = e.innerHTML;
827
+ if (!(l.mode === "html" ? Ve(e, l.value) : je(e, l.value)))
828
+ return !1;
829
+ r.lastReport = { ...l.report }, M.set(e, r), Fe(e, c), Ge(e), e.dispatchEvent(
791
830
  new CustomEvent("editora:smart-paste", {
792
831
  bubbles: !0,
793
832
  detail: ve(r)
794
833
  })
795
- ), x(e);
796
- const f = g.get(e);
834
+ ), S(e);
835
+ const f = h.get(e);
797
836
  if (f) {
798
- const b = l.report.removedElements + l.report.removedAttributes + l.report.removedComments + l.report.normalizedStyles;
799
- O(
837
+ const p = l.report.removedElements + l.report.removedAttributes + l.report.removedComments + l.report.normalizedStyles;
838
+ R(
800
839
  f,
801
- `${a.labels.panelTitle}: ${G(r.profile, a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${b}.`
840
+ `${a.labels.panelTitle}: ${U(r.profile, a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${p}.`
802
841
  );
803
842
  }
804
843
  return !0;
805
844
  }
806
845
  function Je(e) {
807
846
  return (t) => {
808
- t.defaultPrevented || t[ie] === !0 || (m = e, !Ze(e, t)) || (t[ie] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
847
+ t.defaultPrevented || t[ie] === !0 || (b = e, !Ze(e, t)) || (t[ie] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
809
848
  };
810
849
  }
811
850
  function Qe(e) {
812
- if (j.has(e)) return;
851
+ if (F.has(e))
852
+ return;
813
853
  const t = Je(e);
814
- e.addEventListener("paste", t, !0), j.set(e, t);
854
+ e.addEventListener("paste", t, !0), F.set(e, t);
815
855
  }
816
- function R(e) {
817
- const t = L.get(e);
818
- D(e, "toggleSmartPastePanel", re(e)), D(e, "toggleSmartPasteEnabled", t?.enabled === !0);
856
+ function z(e) {
857
+ const t = M.get(e);
858
+ N(e, "toggleSmartPastePanel", re(e)), N(e, "toggleSmartPasteEnabled", (t == null ? void 0 : t.enabled) === !0);
819
859
  }
820
860
  function et(e) {
821
861
  const t = e.key.toLowerCase();
@@ -830,21 +870,27 @@ function rt(e) {
830
870
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
831
871
  }
832
872
  function at(e) {
833
- $ = e, A || (A = (t) => {
834
- V();
835
- const r = t.target?.closest(y);
836
- if (!r) return;
873
+ O = e, L || (L = (t) => {
874
+ j();
875
+ const a = t.target, r = a == null ? void 0 : a.closest(v);
876
+ if (!r)
877
+ return;
837
878
  const n = d.get(r) || e;
838
- p(r, n), d.set(r, n), m = r, R(r);
839
- const o = g.get(r);
840
- o && (F(o, r), Q(r, o), x(r));
841
- }, document.addEventListener("focusin", A, !0)), P || (P = (t) => {
842
- if (t.defaultPrevented || t.target?.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
879
+ m(r, n), d.set(r, n), b = r, z(r);
880
+ const o = h.get(r);
881
+ o && (G(o, r), Q(r, o), S(r));
882
+ }, document.addEventListener("focusin", L, !0)), w || (w = (t) => {
883
+ if (t.defaultPrevented)
884
+ return;
885
+ const a = t.target;
886
+ if (a != null && a.closest(`.${u} input, .${u} textarea, .${u} select`))
887
+ return;
843
888
  const r = ze(t);
844
- if (!r) return;
845
- const n = d.get(r) || $ || e;
846
- if (p(r, n), d.set(r, n), m = r, t.key === "Escape" && re(r)) {
847
- t.preventDefault(), N(r, !0);
889
+ if (!r)
890
+ return;
891
+ const n = d.get(r) || O || e;
892
+ if (m(r, n), d.set(r, n), b = r, t.key === "Escape" && re(r)) {
893
+ t.preventDefault(), q(r, !0);
848
894
  return;
849
895
  }
850
896
  if (et(t)) {
@@ -853,56 +899,57 @@ function at(e) {
853
899
  }
854
900
  if (tt(t)) {
855
901
  t.preventDefault(), t.stopPropagation();
856
- const o = p(r, n);
857
- o.profile = ae(o.profile), x(r);
902
+ const o = m(r, n);
903
+ o.profile = ae(o.profile), S(r);
858
904
  return;
859
905
  }
860
906
  if (rt(t)) {
861
907
  t.preventDefault(), t.stopPropagation();
862
- const o = p(r, n);
863
- o.enabled = !o.enabled, R(r), x(r);
908
+ const o = m(r, n);
909
+ o.enabled = !o.enabled, z(r), S(r);
864
910
  }
865
- }, document.addEventListener("keydown", P, !0)), T || (T = () => {
866
- V(), g.forEach((t, a) => {
867
- !a.isConnected || !t.isConnected || (F(t, a), Q(a, t));
911
+ }, document.addEventListener("keydown", w, !0)), A || (A = () => {
912
+ j(), h.forEach((t, a) => {
913
+ !a.isConnected || !t.isConnected || (G(t, a), Q(a, t));
868
914
  });
869
- }, window.addEventListener("scroll", T, !0), window.addEventListener("resize", T)), !w && typeof MutationObserver < "u" && document.body && (w = new MutationObserver((t) => {
870
- He(t) && V();
871
- }), w.observe(document.body, {
915
+ }, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !$ && typeof MutationObserver < "u" && document.body && ($ = new MutationObserver((t) => {
916
+ He(t) && j();
917
+ }), $.observe(document.body, {
872
918
  childList: !0,
873
919
  subtree: !0
874
920
  }));
875
921
  }
876
922
  function ot() {
877
- A && (document.removeEventListener("focusin", A, !0), A = null), P && (document.removeEventListener("keydown", P, !0), P = null), T && (window.removeEventListener("scroll", T, !0), window.removeEventListener("resize", T), T = null), w && (w.disconnect(), w = null), g.forEach((e) => e.remove()), g.clear(), z.forEach((e) => me(e)), z.clear(), $ = null, m = null;
923
+ L && (document.removeEventListener("focusin", L, !0), L = null), w && (document.removeEventListener("keydown", w, !0), w = null), A && (window.removeEventListener("scroll", A, !0), window.removeEventListener("resize", A), A = null), $ && ($.disconnect(), $ = null), h.forEach((e) => e.remove()), h.clear(), _.forEach((e) => me(e)), _.clear(), O = null, b = null;
878
924
  }
879
925
  function nt() {
880
- if (typeof document > "u" || document.getElementById(le)) return;
926
+ if (typeof document > "u" || document.getElementById(le))
927
+ return;
881
928
  const e = document.createElement("style");
882
929
  e.id = le, e.textContent = `
883
- .rte-toolbar-group-items.${h},
884
- .editora-toolbar-group-items.${h},
885
- .rte-toolbar-group-items.${S},
886
- .editora-toolbar-group-items.${S} {
930
+ .rte-toolbar-group-items.${x},
931
+ .editora-toolbar-group-items.${x},
932
+ .rte-toolbar-group-items.${E},
933
+ .editora-toolbar-group-items.${E} {
887
934
  display: flex;
888
935
  border: 1px solid #ccc;
889
936
  border-radius: 3px;
890
937
  background: #fff;
891
938
  }
892
939
 
893
- .rte-toolbar-group-items.${h} .rte-toolbar-button,
894
- .editora-toolbar-group-items.${h} .editora-toolbar-button,
895
- .rte-toolbar-group-items.${S} .rte-toolbar-button,
896
- .editora-toolbar-group-items.${S} .editora-toolbar-button {
940
+ .rte-toolbar-group-items.${x} .rte-toolbar-button,
941
+ .editora-toolbar-group-items.${x} .editora-toolbar-button,
942
+ .rte-toolbar-group-items.${E} .rte-toolbar-button,
943
+ .editora-toolbar-group-items.${E} .editora-toolbar-button {
897
944
  border: none;
898
945
  border-right: 1px solid #ccc;
899
946
  border-radius: 0;
900
947
  }
901
948
 
902
- .rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
903
- .editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
904
- .rte-toolbar-group-items.${S} .rte-toolbar-item:last-child .rte-toolbar-button,
905
- .editora-toolbar-group-items.${S} .editora-toolbar-item:last-child .editora-toolbar-button {
949
+ .rte-toolbar-group-items.${x} .rte-toolbar-item:last-child .rte-toolbar-button,
950
+ .editora-toolbar-group-items.${x} .editora-toolbar-item:last-child .editora-toolbar-button,
951
+ .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
952
+ .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button {
906
953
  border-right: none;
907
954
  }
908
955
 
@@ -911,23 +958,23 @@ function nt() {
911
958
  background-color: #ccc;
912
959
  }
913
960
 
914
- ${E} .rte-toolbar-group-items.${h},
915
- ${E} .editora-toolbar-group-items.${h},
916
- ${E} .rte-toolbar-group-items.${S},
917
- ${E} .editora-toolbar-group-items.${S},
961
+ ${k} .rte-toolbar-group-items.${x},
962
+ ${k} .editora-toolbar-group-items.${x},
963
+ ${k} .rte-toolbar-group-items.${E},
964
+ ${k} .editora-toolbar-group-items.${E},
918
965
  .${u}.rte-smart-paste-theme-dark {
919
966
  border-color: #566275;
920
967
  }
921
968
 
922
- ${E} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
923
- ${E} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
924
- ${E} .rte-toolbar-group-items.${S} .rte-toolbar-button svg,
925
- ${E} .editora-toolbar-group-items.${S} .editora-toolbar-button svg {
969
+ ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button svg,
970
+ ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button svg,
971
+ ${k} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
972
+ ${k} .editora-toolbar-group-items.${E} .editora-toolbar-button svg {
926
973
  fill: none;
927
974
  }
928
975
 
929
- ${E} .rte-toolbar-group-items.${h} .rte-toolbar-button,
930
- ${E} .editora-toolbar-group-items.${h} .editora-toolbar-button
976
+ ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button,
977
+ ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button
931
978
  {
932
979
  border-color: #566275;
933
980
  }
@@ -1242,7 +1289,7 @@ function nt() {
1242
1289
  `, document.head.appendChild(e);
1243
1290
  }
1244
1291
  const st = (e = {}) => {
1245
- const t = K(e), a = /* @__PURE__ */ new Set();
1292
+ const t = V(e), a = /* @__PURE__ */ new Set();
1246
1293
  return nt(), {
1247
1294
  name: "smartPaste",
1248
1295
  toolbar: [
@@ -1278,39 +1325,46 @@ const st = (e = {}) => {
1278
1325
  ],
1279
1326
  commands: {
1280
1327
  smartPaste: (r, n) => {
1281
- const o = C(n, !1, !1);
1282
- if (!o) return !1;
1328
+ const o = T(n, !1, !1);
1329
+ if (!o)
1330
+ return !1;
1283
1331
  const s = d.get(o) || t;
1284
- return p(o, s), d.set(o, s), m = o, ye(o), !0;
1332
+ return m(o, s), d.set(o, s), b = o, ye(o), !0;
1285
1333
  },
1286
1334
  toggleSmartPastePanel: (r, n) => {
1287
- const o = C(n, !1, !1);
1288
- if (!o) return !1;
1335
+ const o = T(n, !1, !1);
1336
+ if (!o)
1337
+ return !1;
1289
1338
  const s = d.get(o) || t;
1290
- return p(o, s), d.set(o, s), m = o, xe(o, typeof r == "boolean" ? r : void 0);
1339
+ return m(o, s), d.set(o, s), b = o, xe(o, typeof r == "boolean" ? r : void 0);
1291
1340
  },
1292
1341
  cycleSmartPasteProfile: (r, n) => {
1293
- const o = C(n, !1, !1);
1294
- if (!o) return !1;
1295
- const s = d.get(o) || t, l = p(o, s);
1296
- return d.set(o, s), l.profile = ae(l.profile), x(o), !0;
1342
+ const o = T(n, !1, !1);
1343
+ if (!o)
1344
+ return !1;
1345
+ const s = d.get(o) || t, l = m(o, s);
1346
+ return d.set(o, s), l.profile = ae(l.profile), S(o), !0;
1297
1347
  },
1298
1348
  setSmartPasteProfile: (r, n) => {
1299
- const o = C(n, !1, !1);
1300
- if (!o) return !1;
1301
- const s = d.get(o) || t, l = p(o, s);
1302
- return d.set(o, s), l.profile = _(r), x(o), !0;
1349
+ const o = T(n, !1, !1);
1350
+ if (!o)
1351
+ return !1;
1352
+ const s = d.get(o) || t, l = m(o, s);
1353
+ return d.set(o, s), l.profile = H(r), S(o), !0;
1303
1354
  },
1304
1355
  toggleSmartPasteEnabled: (r, n) => {
1305
- const o = C(n, !1, !1);
1306
- if (!o) return !1;
1307
- const s = d.get(o) || t, l = p(o, s);
1308
- return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, R(o), x(o), !0;
1356
+ const o = T(n, !1, !1);
1357
+ if (!o)
1358
+ return !1;
1359
+ const s = d.get(o) || t, l = m(o, s);
1360
+ return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, z(o), S(o), !0;
1309
1361
  },
1310
1362
  setSmartPasteOptions: (r, n) => {
1311
- const o = C(n, !1, !1);
1312
- if (!o || !r || typeof r != "object") return !1;
1313
- const s = d.get(o) || t, l = ce(s), i = K({
1363
+ var f, p, y, g, P, C;
1364
+ const o = T(n, !1, !1);
1365
+ if (!o || !r || typeof r != "object")
1366
+ return !1;
1367
+ const s = d.get(o) || t, l = ce(s), c = V({
1314
1368
  ...l,
1315
1369
  ...r,
1316
1370
  labels: {
@@ -1321,37 +1375,38 @@ const st = (e = {}) => {
1321
1375
  ...l.profileOptions,
1322
1376
  ...r.profileOptions || {},
1323
1377
  fidelity: {
1324
- ...l.profileOptions?.fidelity || {},
1325
- ...r.profileOptions?.fidelity || {}
1378
+ ...((f = l.profileOptions) == null ? void 0 : f.fidelity) || {},
1379
+ ...((p = r.profileOptions) == null ? void 0 : p.fidelity) || {}
1326
1380
  },
1327
1381
  balanced: {
1328
- ...l.profileOptions?.balanced || {},
1329
- ...r.profileOptions?.balanced || {}
1382
+ ...((y = l.profileOptions) == null ? void 0 : y.balanced) || {},
1383
+ ...((g = r.profileOptions) == null ? void 0 : g.balanced) || {}
1330
1384
  },
1331
1385
  plain: {
1332
- ...l.profileOptions?.plain || {},
1333
- ...r.profileOptions?.plain || {}
1386
+ ...((P = l.profileOptions) == null ? void 0 : P.plain) || {},
1387
+ ...((C = r.profileOptions) == null ? void 0 : C.plain) || {}
1334
1388
  }
1335
1389
  },
1336
1390
  normalizeText: r.normalizeText || s.normalizeText
1337
1391
  });
1338
- d.set(o, i);
1339
- const c = p(o, i);
1340
- return typeof r.enabled == "boolean" && (c.enabled = r.enabled), r.defaultProfile && (c.profile = _(r.defaultProfile)), x(o), R(o), !0;
1392
+ d.set(o, c);
1393
+ const i = m(o, c);
1394
+ return typeof r.enabled == "boolean" && (i.enabled = r.enabled), r.defaultProfile && (i.profile = H(r.defaultProfile)), S(o), z(o), !0;
1341
1395
  },
1342
1396
  getSmartPasteState: (r, n) => {
1343
- const o = C(n, !1, !1);
1344
- if (!o) return !1;
1345
- const s = d.get(o) || t, l = p(o, s), i = ve(l);
1397
+ const o = T(n, !1, !1);
1398
+ if (!o)
1399
+ return !1;
1400
+ const s = d.get(o) || t, l = m(o, s), c = ve(l);
1346
1401
  if (typeof r == "function")
1347
1402
  try {
1348
- r(i);
1403
+ r(c);
1349
1404
  } catch {
1350
1405
  }
1351
- return o.__smartPasteState = i, o.dispatchEvent(
1406
+ return o.__smartPasteState = c, o.dispatchEvent(
1352
1407
  new CustomEvent("editora:smart-paste-state", {
1353
1408
  bubbles: !0,
1354
- detail: i
1409
+ detail: c
1355
1410
  })
1356
1411
  ), !0;
1357
1412
  }
@@ -1365,21 +1420,22 @@ const st = (e = {}) => {
1365
1420
  "Mod-Alt-Shift-G": "toggleSmartPasteEnabled"
1366
1421
  },
1367
1422
  init: function(n) {
1368
- I += 1;
1369
- const o = this && typeof this.__pluginConfig == "object" ? K({ ...ce(t), ...this.__pluginConfig }) : t;
1423
+ W += 1;
1424
+ const o = this && typeof this.__pluginConfig == "object" ? V({ ...ce(t), ...this.__pluginConfig }) : t;
1370
1425
  at(o);
1371
- const s = C(
1372
- n?.editorElement ? { editorElement: n.editorElement } : void 0,
1426
+ const s = T(
1427
+ n != null && n.editorElement ? { editorElement: n.editorElement } : void 0,
1373
1428
  !1,
1374
1429
  !1
1375
1430
  );
1376
- if (!s) return;
1377
- m = s, a.add(s);
1378
- const l = p(s, o);
1379
- l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), R(s);
1431
+ if (!s)
1432
+ return;
1433
+ b = s, a.add(s);
1434
+ const l = m(s, o);
1435
+ l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), z(s);
1380
1436
  },
1381
1437
  destroy: () => {
1382
- a.forEach((r) => be(r)), a.clear(), I = Math.max(0, I - 1), !(I > 0) && ot();
1438
+ a.forEach((r) => be(r)), a.clear(), W = Math.max(0, W - 1), !(W > 0) && ot();
1383
1439
  }
1384
1440
  };
1385
1441
  };