@editora/plugins 1.0.10 → 1.0.11

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