@editora/core 1.0.7 → 1.0.9

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 (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -0,0 +1,1447 @@
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 != "undefined" ? NodeFilter.SHOW_COMMENT : 128, ie = "__editoraSmartPasteHandled", ke = /* @__PURE__ */ new Set([
2
+ "script",
3
+ "style",
4
+ "meta",
5
+ "link",
6
+ "object",
7
+ "embed",
8
+ "iframe",
9
+ "svg",
10
+ "canvas",
11
+ "math",
12
+ "form",
13
+ "input",
14
+ "button",
15
+ "textarea",
16
+ "select",
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([
19
+ "color",
20
+ "background-color",
21
+ "font-weight",
22
+ "font-style",
23
+ "text-decoration",
24
+ "text-align",
25
+ "font-size",
26
+ "font-family",
27
+ "line-height",
28
+ "letter-spacing",
29
+ "word-spacing",
30
+ "white-space",
31
+ "vertical-align",
32
+ "margin-left",
33
+ "margin-right",
34
+ "margin-top",
35
+ "margin-bottom",
36
+ "padding-left",
37
+ "padding-right",
38
+ "padding-top",
39
+ "padding-bottom",
40
+ "text-indent",
41
+ "border",
42
+ "border-top",
43
+ "border-right",
44
+ "border-bottom",
45
+ "border-left",
46
+ "border-color",
47
+ "border-width",
48
+ "border-style",
49
+ "list-style-type"
50
+ ]), we = {
51
+ panelTitle: "Smart Paste",
52
+ panelAriaLabel: "Smart paste panel",
53
+ enabledText: "Smart paste is enabled",
54
+ disabledText: "Smart paste is disabled",
55
+ toggleOnText: "Disable Smart Paste",
56
+ toggleOffText: "Enable Smart Paste",
57
+ cycleProfileText: "Cycle Profile",
58
+ profileLabel: "Profile",
59
+ fidelityText: "Fidelity",
60
+ balancedText: "Balanced",
61
+ plainText: "Plain Text",
62
+ lastPasteHeading: "Last Paste Result",
63
+ lastPasteEmptyText: "Paste content to see cleanup metrics.",
64
+ lastPasteSourceLabel: "Source",
65
+ lastPasteProfileLabel: "Profile",
66
+ lastPasteRemovedLabel: "Removed",
67
+ lastPasteCharsLabel: "Output Chars",
68
+ closeText: "Close",
69
+ shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+S/V/G",
70
+ readonlyMessage: "Editor is read-only. Smart paste was skipped."
71
+ }, Y = {
72
+ fidelity: {
73
+ keepStyles: !0,
74
+ keepClasses: !1,
75
+ keepDataAttributes: !1,
76
+ preserveTables: !0
77
+ },
78
+ balanced: {
79
+ keepStyles: !1,
80
+ keepClasses: !1,
81
+ keepDataAttributes: !1,
82
+ preserveTables: !0
83
+ },
84
+ plain: {
85
+ keepStyles: !1,
86
+ keepClasses: !1,
87
+ keepDataAttributes: !1,
88
+ preserveTables: !1
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;
92
+ function X(e) {
93
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
94
+ }
95
+ function Me(e) {
96
+ return e.replace(/\u00A0/g, " ").replace(/\r\n?/g, `
97
+ `);
98
+ }
99
+ function H(e) {
100
+ return e === "balanced" || e === "plain" ? e : "fidelity";
101
+ }
102
+ function Z(e, t) {
103
+ var a, r, n, o;
104
+ return {
105
+ keepStyles: (a = e == null ? void 0 : e.keepStyles) != null ? a : t.keepStyles,
106
+ keepClasses: (r = e == null ? void 0 : e.keepClasses) != null ? r : t.keepClasses,
107
+ keepDataAttributes: (n = e == null ? void 0 : e.keepDataAttributes) != null ? n : t.keepDataAttributes,
108
+ preserveTables: (o = e == null ? void 0 : e.preserveTables) != null ? o : t.preserveTables
109
+ };
110
+ }
111
+ function V(e = {}) {
112
+ var a;
113
+ const t = e.profileOptions || {};
114
+ return {
115
+ enabled: e.enabled !== !1,
116
+ defaultProfile: H(e.defaultProfile),
117
+ maxHtmlLength: Math.max(8e3, Math.min(8e5, Number((a = e.maxHtmlLength) != null ? a : 22e4))),
118
+ removeComments: e.removeComments !== !1,
119
+ normalizeWhitespace: e.normalizeWhitespace !== !1,
120
+ labels: {
121
+ ...we,
122
+ ...e.labels || {}
123
+ },
124
+ normalizeText: e.normalizeText || Me,
125
+ profileOptions: {
126
+ fidelity: Z(t.fidelity, Y.fidelity),
127
+ balanced: Z(t.balanced, Y.balanced),
128
+ plain: Z(t.plain, Y.plain)
129
+ }
130
+ };
131
+ }
132
+ function ce(e) {
133
+ return {
134
+ enabled: e.enabled,
135
+ defaultProfile: e.defaultProfile,
136
+ maxHtmlLength: e.maxHtmlLength,
137
+ removeComments: e.removeComments,
138
+ normalizeWhitespace: e.normalizeWhitespace,
139
+ labels: { ...e.labels },
140
+ normalizeText: e.normalizeText,
141
+ profileOptions: {
142
+ fidelity: { ...e.profileOptions.fidelity },
143
+ balanced: { ...e.profileOptions.balanced },
144
+ plain: { ...e.profileOptions.plain }
145
+ }
146
+ };
147
+ }
148
+ function te(e) {
149
+ return e.closest(ee) || e;
150
+ }
151
+ function D(e) {
152
+ if (!e)
153
+ return null;
154
+ if (e.matches(v))
155
+ return e;
156
+ const t = e.querySelector(v);
157
+ return t instanceof HTMLElement ? t : null;
158
+ }
159
+ function Oe() {
160
+ if (typeof window == "undefined")
161
+ return null;
162
+ const e = window[se];
163
+ if (!(e instanceof HTMLElement))
164
+ return null;
165
+ window[se] = null;
166
+ const t = D(e);
167
+ if (t)
168
+ return t;
169
+ const a = e.closest(ee);
170
+ if (a) {
171
+ const n = D(a);
172
+ if (n)
173
+ return n;
174
+ }
175
+ const r = e.closest(v);
176
+ return r instanceof HTMLElement ? r : null;
177
+ }
178
+ function Re(e) {
179
+ const t = e.closest("[data-editora-editor]");
180
+ if (t && D(t) === e)
181
+ return t;
182
+ let a = e;
183
+ for (; a; ) {
184
+ if (a.matches(ee) && (a === e || D(a) === e))
185
+ return a;
186
+ a = a.parentElement;
187
+ }
188
+ return te(e);
189
+ }
190
+ function pe(e) {
191
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
192
+ }
193
+ function T(e, t = !0, a = !0) {
194
+ if (j(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
195
+ return e.contentElement;
196
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
197
+ const s = D(e.editorElement);
198
+ if (s)
199
+ return s;
200
+ }
201
+ const r = Oe();
202
+ if (r)
203
+ return r;
204
+ const n = window.getSelection();
205
+ if (n && n.rangeCount > 0) {
206
+ const s = pe(n.getRangeAt(0).startContainer), l = s == null ? void 0 : s.closest(v);
207
+ if (l)
208
+ return l;
209
+ }
210
+ const o = document.activeElement;
211
+ if (o) {
212
+ if (o.matches(v))
213
+ return o;
214
+ const s = o.closest(v);
215
+ if (s)
216
+ return s;
217
+ }
218
+ if (a) {
219
+ if (b && b.isConnected)
220
+ return b;
221
+ b && !b.isConnected && (b = null);
222
+ }
223
+ return t ? document.querySelector(v) : null;
224
+ }
225
+ function ze(e) {
226
+ const t = e.target;
227
+ if (t) {
228
+ const r = t.closest(v);
229
+ if (r)
230
+ return r;
231
+ }
232
+ const a = window.getSelection();
233
+ if (a && a.rangeCount > 0) {
234
+ const r = pe(a.getRangeAt(0).startContainer), n = r == null ? void 0 : r.closest(v);
235
+ if (n)
236
+ return n;
237
+ }
238
+ return null;
239
+ }
240
+ function B(e) {
241
+ return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
242
+ }
243
+ function _e(e) {
244
+ const t = te(e);
245
+ if (B(t))
246
+ return !0;
247
+ const a = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
248
+ return B(a) ? !0 : B(document.documentElement) || B(document.body);
249
+ }
250
+ function G(e, t) {
251
+ e.classList.remove("rte-smart-paste-theme-dark"), _e(t) && e.classList.add("rte-smart-paste-theme-dark");
252
+ }
253
+ function de(e) {
254
+ return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
255
+ }
256
+ function N(e, t, a) {
257
+ const r = Re(e);
258
+ Array.from(
259
+ r.querySelectorAll(
260
+ `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
261
+ )
262
+ ).forEach((o) => {
263
+ o.classList.toggle("active", a), o.setAttribute("data-active", a ? "true" : "false"), o.setAttribute("aria-pressed", a ? "true" : "false");
264
+ });
265
+ }
266
+ function m(e, t) {
267
+ d.has(e) || d.set(e, t);
268
+ let a = M.get(e);
269
+ return a || (a = {
270
+ enabled: t.enabled,
271
+ profile: t.defaultProfile,
272
+ lastReport: null
273
+ }, M.set(e, a)), Qe(e), _.add(e), a;
274
+ }
275
+ function me(e) {
276
+ const t = F.get(e);
277
+ t && (e.removeEventListener("paste", t, !0), F.delete(e));
278
+ }
279
+ function be(e) {
280
+ var t;
281
+ 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);
282
+ }
283
+ function j() {
284
+ Array.from(_).forEach((t) => {
285
+ t.isConnected || be(t);
286
+ });
287
+ }
288
+ function He(e) {
289
+ var t, a, r, n;
290
+ for (let o = 0; o < e.length; o += 1) {
291
+ const s = e[o];
292
+ if (!(s.type !== "childList" || s.removedNodes.length === 0))
293
+ for (let l = 0; l < s.removedNodes.length; l += 1) {
294
+ const c = s.removedNodes[l];
295
+ if (c.nodeType !== Node.ELEMENT_NODE)
296
+ continue;
297
+ const i = c;
298
+ 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}`))
299
+ return !0;
300
+ }
301
+ }
302
+ return !1;
303
+ }
304
+ function re(e) {
305
+ return I.get(e) === !0;
306
+ }
307
+ function R(e, t) {
308
+ const a = e.querySelector(".rte-smart-paste-live");
309
+ a && (a.textContent = t);
310
+ }
311
+ function J(e, t) {
312
+ const a = t.normalizeText(e);
313
+ return t.normalizeWhitespace ? a.split(`
314
+ `).map((n) => n.replace(/[\t ]+/g, " ").trimEnd()).join(`
315
+ `).replace(/\n{3,}/g, `
316
+
317
+ `).trim() : a;
318
+ }
319
+ function De(e) {
320
+ return /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office|<o:p\b/i.test(e);
321
+ }
322
+ function Ne(e) {
323
+ return /id=["']docs-internal-guid|docs-\w+|data-sheets-value|data-sheets-userformat/i.test(e);
324
+ }
325
+ function qe(e, t) {
326
+ return e ? De(e) ? "word" : Ne(e) ? "google-docs" : "html" : t ? "plain" : "html";
327
+ }
328
+ function Ie(e) {
329
+ 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(" ");
330
+ }
331
+ function We(e) {
332
+ if (!e)
333
+ return { value: "", changed: !1 };
334
+ const t = e.split(";"), a = [];
335
+ let r = !1;
336
+ return t.forEach((n) => {
337
+ const o = n.indexOf(":");
338
+ if (o <= 0) {
339
+ n.trim() && (r = !0);
340
+ return;
341
+ }
342
+ const s = n.slice(0, o).trim().toLowerCase(), l = n.slice(o + 1).trim();
343
+ if (!s || !l) {
344
+ r = !0;
345
+ return;
346
+ }
347
+ if (!Le.has(s)) {
348
+ r = !0;
349
+ return;
350
+ }
351
+ if (/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(l)) {
352
+ r = !0;
353
+ return;
354
+ }
355
+ a.push(`${s}: ${l}`);
356
+ }), {
357
+ value: a.join("; "),
358
+ changed: r
359
+ };
360
+ }
361
+ function ue(e) {
362
+ const t = e.trim();
363
+ return t && (Ae.test(t) || Pe.test(t)) ? t : "";
364
+ }
365
+ function fe(e) {
366
+ const t = e.parentNode;
367
+ if (t) {
368
+ for (; e.firstChild; )
369
+ t.insertBefore(e.firstChild, e);
370
+ t.removeChild(e);
371
+ }
372
+ }
373
+ function Be(e, t, a, r) {
374
+ const n = e.tagName.toLowerCase();
375
+ if (ke.has(n)) {
376
+ r.removedElements += 1, e.remove();
377
+ return;
378
+ }
379
+ if (!t.preserveTables && Ce.has(n)) {
380
+ const s = e.textContent || "", l = document.createTextNode(s);
381
+ e.replaceWith(l), r.removedElements += 1;
382
+ return;
383
+ }
384
+ if (Array.from(e.attributes).forEach((s) => {
385
+ const l = s.name.toLowerCase(), c = s.value;
386
+ if (l.startsWith("on")) {
387
+ e.removeAttribute(s.name), r.removedAttributes += 1;
388
+ return;
389
+ }
390
+ if (l === "style") {
391
+ if (!t.keepStyles) {
392
+ e.removeAttribute(s.name), r.removedAttributes += 1;
393
+ return;
394
+ }
395
+ const i = We(c);
396
+ if (!i.value) {
397
+ e.removeAttribute(s.name), r.removedAttributes += 1, i.changed && (r.normalizedStyles += 1);
398
+ return;
399
+ }
400
+ (i.changed || i.value !== c) && (e.setAttribute("style", i.value), r.normalizedStyles += 1);
401
+ return;
402
+ }
403
+ if (l === "class") {
404
+ if (!t.keepClasses) {
405
+ e.removeAttribute(s.name), r.removedAttributes += 1;
406
+ return;
407
+ }
408
+ const i = Ie(c);
409
+ if (!i) {
410
+ e.removeAttribute(s.name), r.removedAttributes += 1;
411
+ return;
412
+ }
413
+ i !== c && (e.setAttribute("class", i), r.removedAttributes += 1);
414
+ return;
415
+ }
416
+ if (l.startsWith("data-") && !t.keepDataAttributes) {
417
+ e.removeAttribute(s.name), r.removedAttributes += 1;
418
+ return;
419
+ }
420
+ if (l === "id" || l === "xmlns" || l.startsWith("xml")) {
421
+ e.removeAttribute(s.name), r.removedAttributes += 1;
422
+ return;
423
+ }
424
+ if ((a === "word" || a === "google-docs") && (l === "lang" || l === "dir")) {
425
+ e.removeAttribute(s.name), r.removedAttributes += 1;
426
+ return;
427
+ }
428
+ if (l === "href" || l === "src" || l === "xlink:href") {
429
+ const i = ue(c);
430
+ if (!i) {
431
+ e.removeAttribute(s.name), r.removedAttributes += 1;
432
+ return;
433
+ }
434
+ i !== c && e.setAttribute(s.name, i);
435
+ }
436
+ }), n === "a") {
437
+ if (!e.getAttribute("href")) {
438
+ fe(e), r.removedElements += 1;
439
+ return;
440
+ }
441
+ e.getAttribute("target") === "_blank" && e.setAttribute("rel", "noopener noreferrer");
442
+ }
443
+ if (n === "img") {
444
+ const s = e.getAttribute("src");
445
+ if (!s || !ue(s)) {
446
+ r.removedElements += 1, e.remove();
447
+ return;
448
+ }
449
+ }
450
+ if (Te.has(n) && !e.attributes.length && !e.className && !e.style.cssText) {
451
+ const s = e.children.length > 0, l = (e.textContent || "").trim().length > 0;
452
+ if (!s && !l) {
453
+ e.remove(), r.removedElements += 1;
454
+ return;
455
+ }
456
+ !s && l && (fe(e), r.removedElements += 1);
457
+ }
458
+ }
459
+ function Ke(e, t, a, r, n) {
460
+ const o = document.createElement("template");
461
+ o.innerHTML = e;
462
+ const s = {
463
+ removedElements: 0,
464
+ removedAttributes: 0,
465
+ removedComments: 0,
466
+ normalizedStyles: 0
467
+ };
468
+ if (r.removeComments)
469
+ try {
470
+ const f = document.createTreeWalker(o.content, Ee, null), p = [];
471
+ let y = f.nextNode();
472
+ for (; y; )
473
+ p.push(y), y = f.nextNode();
474
+ p.forEach((g) => {
475
+ g.remove(), s.removedComments += 1;
476
+ });
477
+ } catch (f) {
478
+ }
479
+ Array.from(o.content.querySelectorAll("*")).forEach((f) => {
480
+ f.isConnected && Be(f, t, a, s);
481
+ });
482
+ let c = o.innerHTML;
483
+ r.normalizeWhitespace && n !== "fidelity" ? c = c.replace(/\s{2,}/g, " ").replace(/>\s+</g, "><").trim() : r.normalizeWhitespace && (c = c.trim());
484
+ const i = (o.content.textContent || "").trim().length;
485
+ return {
486
+ html: c,
487
+ textLength: i,
488
+ counters: s
489
+ };
490
+ }
491
+ function ge(e) {
492
+ const t = window.getSelection();
493
+ if (!t || t.rangeCount === 0)
494
+ return null;
495
+ const a = t.getRangeAt(0);
496
+ return e.contains(a.commonAncestorContainer) ? a : null;
497
+ }
498
+ function he(e, t) {
499
+ if (!e.isConnected)
500
+ return;
501
+ const a = window.getSelection();
502
+ a && (a.removeAllRanges(), a.addRange(t));
503
+ }
504
+ function Ve(e, t) {
505
+ e.focus({ preventScroll: !0 });
506
+ try {
507
+ if (document.execCommand("insertHTML", !1, t))
508
+ return !0;
509
+ } catch (s) {
510
+ }
511
+ const a = ge(e);
512
+ if (!a)
513
+ return !1;
514
+ a.deleteContents();
515
+ const r = document.createElement("template");
516
+ r.innerHTML = t;
517
+ const n = r.content, o = n.lastChild;
518
+ if (a.insertNode(n), o) {
519
+ const s = document.createRange();
520
+ s.setStartAfter(o), s.collapse(!0), he(e, s);
521
+ }
522
+ return !0;
523
+ }
524
+ function je(e, t) {
525
+ e.focus({ preventScroll: !0 });
526
+ try {
527
+ if (document.execCommand("insertText", !1, t))
528
+ return !0;
529
+ } catch (o) {
530
+ }
531
+ const a = ge(e);
532
+ if (!a)
533
+ return !1;
534
+ a.deleteContents();
535
+ const r = document.createTextNode(t);
536
+ a.insertNode(r);
537
+ const n = document.createRange();
538
+ return n.setStart(r, r.length), n.collapse(!0), he(e, n), !0;
539
+ }
540
+ function Fe(e, t) {
541
+ if (t === e.innerHTML)
542
+ return;
543
+ const a = window.execEditorCommand || window.executeEditorCommand;
544
+ if (typeof a == "function")
545
+ try {
546
+ a("recordDomTransaction", e, t, e.innerHTML);
547
+ } catch (r) {
548
+ }
549
+ }
550
+ function Ge(e) {
551
+ e.dispatchEvent(new Event("input", { bubbles: !0 }));
552
+ }
553
+ function K(e, t, a, r, n, o) {
554
+ return {
555
+ source: e,
556
+ profile: t,
557
+ inputHtmlLength: a,
558
+ outputHtmlLength: r,
559
+ outputTextLength: n,
560
+ removedElements: o.removedElements,
561
+ removedAttributes: o.removedAttributes,
562
+ removedComments: o.removedComments,
563
+ normalizedStyles: o.normalizedStyles,
564
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
565
+ };
566
+ }
567
+ function Ue(e, t, a, r) {
568
+ const n = qe(e, t);
569
+ if (a === "plain") {
570
+ const l = t || e.replace(/<[^>]*>/g, " "), c = J(l, r);
571
+ return {
572
+ mode: "text",
573
+ value: c,
574
+ report: K(
575
+ n,
576
+ a,
577
+ e.length,
578
+ 0,
579
+ c.length,
580
+ {
581
+ removedElements: 0,
582
+ removedAttributes: 0,
583
+ removedComments: 0,
584
+ normalizedStyles: 0
585
+ }
586
+ )
587
+ };
588
+ }
589
+ if (!e || e.length > r.maxHtmlLength) {
590
+ const l = J(t || e.replace(/<[^>]*>/g, " "), r);
591
+ return {
592
+ mode: "text",
593
+ value: l,
594
+ report: K(
595
+ n,
596
+ a,
597
+ e.length,
598
+ 0,
599
+ l.length,
600
+ {
601
+ removedElements: 0,
602
+ removedAttributes: 0,
603
+ removedComments: 0,
604
+ normalizedStyles: 0
605
+ }
606
+ )
607
+ };
608
+ }
609
+ const o = r.profileOptions[a], s = Ke(e, o, n, r, a);
610
+ if (!s.html) {
611
+ const l = J(t || e.replace(/<[^>]*>/g, " "), r);
612
+ return {
613
+ mode: "text",
614
+ value: l,
615
+ report: K(n, a, e.length, 0, l.length, s.counters)
616
+ };
617
+ }
618
+ return {
619
+ mode: "html",
620
+ value: s.html,
621
+ report: K(
622
+ n,
623
+ a,
624
+ e.length,
625
+ s.html.length,
626
+ s.textLength,
627
+ s.counters
628
+ )
629
+ };
630
+ }
631
+ function U(e, t) {
632
+ return e === "balanced" ? t.balancedText : e === "plain" ? t.plainText : t.fidelityText;
633
+ }
634
+ function ae(e) {
635
+ return e === "fidelity" ? "balanced" : e === "balanced" ? "plain" : "fidelity";
636
+ }
637
+ function Ye(e, t) {
638
+ e.setAttribute("aria-label", t.labels.panelAriaLabel);
639
+ const a = e.querySelector(".rte-smart-paste-title");
640
+ a && (a.textContent = t.labels.panelTitle);
641
+ const r = e.querySelector('[data-action="close"]');
642
+ r && r.setAttribute("aria-label", t.labels.closeText);
643
+ const n = e.querySelector('[data-action="toggle-enabled"]');
644
+ if (n) {
645
+ const Se = n.getAttribute("data-enabled") === "true";
646
+ n.textContent = Se ? t.labels.toggleOnText : t.labels.toggleOffText;
647
+ }
648
+ const o = e.querySelector('[data-action="cycle-profile"]');
649
+ o && (o.textContent = t.labels.cycleProfileText);
650
+ const s = e.querySelector(".rte-smart-paste-profile-heading");
651
+ s && (s.textContent = t.labels.profileLabel);
652
+ const l = e.querySelector('.rte-smart-paste-profile[role="group"]');
653
+ l && l.setAttribute("aria-label", t.labels.profileLabel);
654
+ const c = e.querySelector('[data-action="set-profile"][data-profile="fidelity"]');
655
+ c && (c.textContent = t.labels.fidelityText);
656
+ const i = e.querySelector('[data-action="set-profile"][data-profile="balanced"]');
657
+ i && (i.textContent = t.labels.balancedText);
658
+ const f = e.querySelector('[data-action="set-profile"][data-profile="plain"]');
659
+ f && (f.textContent = t.labels.plainText);
660
+ const p = e.querySelector(".rte-smart-paste-report-title");
661
+ p && (p.textContent = t.labels.lastPasteHeading);
662
+ const y = e.querySelector(".rte-smart-paste-empty");
663
+ y && (y.textContent = t.labels.lastPasteEmptyText);
664
+ const g = e.querySelector('[data-key="source-label"]');
665
+ g && (g.textContent = t.labels.lastPasteSourceLabel);
666
+ const P = e.querySelector('[data-key="profile-label"]');
667
+ P && (P.textContent = t.labels.lastPasteProfileLabel);
668
+ const C = e.querySelector('[data-key="removed-label"]');
669
+ C && (C.textContent = t.labels.lastPasteRemovedLabel);
670
+ const oe = e.querySelector('[data-key="chars-label"]');
671
+ oe && (oe.textContent = t.labels.lastPasteCharsLabel);
672
+ const ne = e.querySelector(".rte-smart-paste-shortcut");
673
+ ne && (ne.textContent = t.labels.shortcutText);
674
+ }
675
+ function S(e) {
676
+ const t = h.get(e), a = d.get(e) || O, r = M.get(e);
677
+ if (!t || !a || !r)
678
+ return;
679
+ Ye(t, a);
680
+ const n = t.querySelector(".rte-smart-paste-status");
681
+ n && (n.textContent = r.enabled ? a.labels.enabledText : a.labels.disabledText);
682
+ const o = t.querySelector('[data-action="toggle-enabled"]');
683
+ 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(
684
+ t.querySelectorAll('[data-action="set-profile"][data-profile]')
685
+ ).forEach((g) => {
686
+ const C = H(g.getAttribute("data-profile")) === r.profile;
687
+ g.classList.toggle("active", C), g.setAttribute("aria-pressed", C ? "true" : "false");
688
+ });
689
+ 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"]');
690
+ if (!r.lastReport) {
691
+ l && (l.hidden = !1), c && (c.hidden = !0);
692
+ return;
693
+ }
694
+ 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) {
695
+ const g = r.lastReport.removedElements + r.lastReport.removedAttributes + r.lastReport.removedComments + r.lastReport.normalizedStyles;
696
+ p.textContent = String(g);
697
+ }
698
+ y && (y.textContent = String(r.lastReport.outputTextLength));
699
+ }
700
+ function Q(e, t) {
701
+ if (!t.classList.contains("show"))
702
+ return;
703
+ 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));
704
+ 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`;
705
+ }
706
+ function q(e, t = !1) {
707
+ const a = h.get(e);
708
+ a && (a.classList.remove("show"), I.set(e, !1), N(e, "toggleSmartPastePanel", !1), t && e.focus({ preventScroll: !0 }));
709
+ }
710
+ function Xe(e) {
711
+ const t = h.get(e);
712
+ if (t)
713
+ return t;
714
+ const a = d.get(e) || O || V(), r = `rte-smart-paste-panel-${$e++}`, n = document.createElement("section");
715
+ 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 = `
716
+ <header class="rte-smart-paste-header">
717
+ <h2 class="rte-smart-paste-title">${X(a.labels.panelTitle)}</h2>
718
+ <button type="button" class="rte-smart-paste-icon-btn" data-action="close" aria-label="${X(a.labels.closeText)}">✕</button>
719
+ </header>
720
+ <div class="rte-smart-paste-body">
721
+ <p class="rte-smart-paste-status"></p>
722
+ <div class="rte-smart-paste-controls">
723
+ <button type="button" class="rte-smart-paste-btn rte-smart-paste-btn-primary" data-action="toggle-enabled" data-enabled="true"></button>
724
+ <button type="button" class="rte-smart-paste-btn" data-action="cycle-profile"></button>
725
+ </div>
726
+ <div class="rte-smart-paste-profile" role="group" aria-label="${X(a.labels.profileLabel)}">
727
+ <p class="rte-smart-paste-profile-heading"></p>
728
+ <div class="rte-smart-paste-profile-grid">
729
+ <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="fidelity" aria-pressed="false"></button>
730
+ <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="balanced" aria-pressed="false"></button>
731
+ <button type="button" class="rte-smart-paste-chip" data-action="set-profile" data-profile="plain" aria-pressed="false"></button>
732
+ </div>
733
+ </div>
734
+ <section class="rte-smart-paste-metrics" aria-live="polite">
735
+ <h3 class="rte-smart-paste-report-title"></h3>
736
+ <p class="rte-smart-paste-empty"></p>
737
+ <dl class="rte-smart-paste-report" hidden>
738
+ <div class="rte-smart-paste-line"><dt data-key="source-label"></dt><dd data-key="source-value"></dd></div>
739
+ <div class="rte-smart-paste-line"><dt data-key="profile-label"></dt><dd data-key="profile-value"></dd></div>
740
+ <div class="rte-smart-paste-line"><dt data-key="removed-label"></dt><dd data-key="removed-value"></dd></div>
741
+ <div class="rte-smart-paste-line"><dt data-key="chars-label"></dt><dd data-key="chars-value"></dd></div>
742
+ </dl>
743
+ </section>
744
+ <p class="rte-smart-paste-shortcut"></p>
745
+ </div>
746
+ <div class="rte-smart-paste-live" aria-live="polite" aria-atomic="true"></div>
747
+ `, n.addEventListener("click", (o) => {
748
+ const s = o.target, l = s == null ? void 0 : s.closest("[data-action]");
749
+ if (!l)
750
+ return;
751
+ const c = l.getAttribute("data-action");
752
+ if (c) {
753
+ if (c === "close") {
754
+ q(e, !0);
755
+ return;
756
+ }
757
+ if (c === "toggle-enabled") {
758
+ const i = m(e, d.get(e) || a);
759
+ i.enabled = !i.enabled, N(e, "toggleSmartPasteEnabled", i.enabled), S(e), R(n, i.enabled ? a.labels.enabledText : a.labels.disabledText);
760
+ return;
761
+ }
762
+ if (c === "cycle-profile") {
763
+ const i = m(e, d.get(e) || a);
764
+ i.profile = ae(i.profile), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
765
+ return;
766
+ }
767
+ if (c === "set-profile") {
768
+ const i = m(e, d.get(e) || a);
769
+ i.profile = H(l.getAttribute("data-profile")), S(e), R(n, `${a.labels.profileLabel}: ${U(i.profile, a.labels)}`);
770
+ }
771
+ }
772
+ }), n.addEventListener("keydown", (o) => {
773
+ if (o.key === "Escape") {
774
+ o.preventDefault(), q(e, !0);
775
+ return;
776
+ }
777
+ if (o.key !== "ArrowRight" && o.key !== "ArrowLeft")
778
+ return;
779
+ const s = Array.from(
780
+ n.querySelectorAll('[data-action="set-profile"][data-profile]')
781
+ );
782
+ if (s.length === 0)
783
+ return;
784
+ const l = s.findIndex((f) => f === document.activeElement);
785
+ if (l < 0)
786
+ return;
787
+ const c = o.key === "ArrowRight" ? 1 : -1, i = (l + c + s.length) % s.length;
788
+ o.preventDefault(), s[i].focus();
789
+ }), G(n, e), document.body.appendChild(n), h.set(e, n), I.set(e, !1), S(e), n;
790
+ }
791
+ function ye(e) {
792
+ const t = Xe(e);
793
+ h.forEach((r, n) => {
794
+ n !== e && q(n, !1);
795
+ }), t.classList.add("show"), I.set(e, !0), N(e, "toggleSmartPastePanel", !0), G(t, e), Q(e, t);
796
+ const a = t.querySelector('[data-action="toggle-enabled"]');
797
+ a == null || a.focus();
798
+ }
799
+ function xe(e, t) {
800
+ const a = re(e);
801
+ return (typeof t == "boolean" ? t : !a) ? ye(e) : q(e, !1), !0;
802
+ }
803
+ function ve(e) {
804
+ return {
805
+ enabled: e.enabled,
806
+ profile: e.profile,
807
+ lastReport: e.lastReport ? { ...e.lastReport } : null
808
+ };
809
+ }
810
+ function Ze(e, t) {
811
+ const a = d.get(e) || O;
812
+ if (!a)
813
+ return !1;
814
+ const r = m(e, a);
815
+ if (!r.enabled || de(e)) {
816
+ const p = h.get(e);
817
+ return p && de(e) && R(p, a.labels.readonlyMessage), !1;
818
+ }
819
+ const n = t.clipboardData;
820
+ if (!n)
821
+ return !1;
822
+ const o = n.getData("text/html") || "", s = n.getData("text/plain") || "";
823
+ if (!o && !s)
824
+ return !1;
825
+ const l = Ue(o, s, r.profile, a);
826
+ if (!l.value)
827
+ return !1;
828
+ const c = e.innerHTML;
829
+ if (!(l.mode === "html" ? Ve(e, l.value) : je(e, l.value)))
830
+ return !1;
831
+ r.lastReport = { ...l.report }, M.set(e, r), Fe(e, c), Ge(e), e.dispatchEvent(
832
+ new CustomEvent("editora:smart-paste", {
833
+ bubbles: !0,
834
+ detail: ve(r)
835
+ })
836
+ ), S(e);
837
+ const f = h.get(e);
838
+ if (f) {
839
+ const p = l.report.removedElements + l.report.removedAttributes + l.report.removedComments + l.report.normalizedStyles;
840
+ R(
841
+ f,
842
+ `${a.labels.panelTitle}: ${U(r.profile, a.labels)}. ${a.labels.lastPasteRemovedLabel}: ${p}.`
843
+ );
844
+ }
845
+ return !0;
846
+ }
847
+ function Je(e) {
848
+ return (t) => {
849
+ t.defaultPrevented || t[ie] === !0 || (b = e, !Ze(e, t)) || (t[ie] = !0, t.preventDefault(), typeof t.stopImmediatePropagation == "function" ? t.stopImmediatePropagation() : t.stopPropagation());
850
+ };
851
+ }
852
+ function Qe(e) {
853
+ if (F.has(e))
854
+ return;
855
+ const t = Je(e);
856
+ e.addEventListener("paste", t, !0), F.set(e, t);
857
+ }
858
+ function z(e) {
859
+ const t = M.get(e);
860
+ N(e, "toggleSmartPastePanel", re(e)), N(e, "toggleSmartPasteEnabled", (t == null ? void 0 : t.enabled) === !0);
861
+ }
862
+ function et(e) {
863
+ const t = e.key.toLowerCase();
864
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "s";
865
+ }
866
+ function tt(e) {
867
+ const t = e.key.toLowerCase();
868
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "v";
869
+ }
870
+ function rt(e) {
871
+ const t = e.key.toLowerCase();
872
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "g";
873
+ }
874
+ function at(e) {
875
+ O = e, L || (L = (t) => {
876
+ j();
877
+ const a = t.target, r = a == null ? void 0 : a.closest(v);
878
+ if (!r)
879
+ return;
880
+ const n = d.get(r) || e;
881
+ m(r, n), d.set(r, n), b = r, z(r);
882
+ const o = h.get(r);
883
+ o && (G(o, r), Q(r, o), S(r));
884
+ }, document.addEventListener("focusin", L, !0)), w || (w = (t) => {
885
+ if (t.defaultPrevented)
886
+ return;
887
+ const a = t.target;
888
+ if (a != null && a.closest(`.${u} input, .${u} textarea, .${u} select`))
889
+ return;
890
+ const r = ze(t);
891
+ if (!r)
892
+ return;
893
+ const n = d.get(r) || O || e;
894
+ if (m(r, n), d.set(r, n), b = r, t.key === "Escape" && re(r)) {
895
+ t.preventDefault(), q(r, !0);
896
+ return;
897
+ }
898
+ if (et(t)) {
899
+ t.preventDefault(), t.stopPropagation(), xe(r);
900
+ return;
901
+ }
902
+ if (tt(t)) {
903
+ t.preventDefault(), t.stopPropagation();
904
+ const o = m(r, n);
905
+ o.profile = ae(o.profile), S(r);
906
+ return;
907
+ }
908
+ if (rt(t)) {
909
+ t.preventDefault(), t.stopPropagation();
910
+ const o = m(r, n);
911
+ o.enabled = !o.enabled, z(r), S(r);
912
+ }
913
+ }, document.addEventListener("keydown", w, !0)), A || (A = () => {
914
+ j(), h.forEach((t, a) => {
915
+ !a.isConnected || !t.isConnected || (G(t, a), Q(a, t));
916
+ });
917
+ }, window.addEventListener("scroll", A, !0), window.addEventListener("resize", A)), !$ && typeof MutationObserver != "undefined" && document.body && ($ = new MutationObserver((t) => {
918
+ He(t) && j();
919
+ }), $.observe(document.body, {
920
+ childList: !0,
921
+ subtree: !0
922
+ }));
923
+ }
924
+ function ot() {
925
+ 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;
926
+ }
927
+ function nt() {
928
+ if (typeof document == "undefined" || document.getElementById(le))
929
+ return;
930
+ const e = document.createElement("style");
931
+ e.id = le, e.textContent = `
932
+ .rte-toolbar-group-items.${x},
933
+ .editora-toolbar-group-items.${x},
934
+ .rte-toolbar-group-items.${E},
935
+ .editora-toolbar-group-items.${E} {
936
+ display: flex;
937
+ border: 1px solid #ccc;
938
+ border-radius: 3px;
939
+ background: #fff;
940
+ }
941
+
942
+ .rte-toolbar-group-items.${x} .rte-toolbar-button,
943
+ .editora-toolbar-group-items.${x} .editora-toolbar-button,
944
+ .rte-toolbar-group-items.${E} .rte-toolbar-button,
945
+ .editora-toolbar-group-items.${E} .editora-toolbar-button {
946
+ border: none;
947
+ border-right: 1px solid #ccc;
948
+ border-radius: 0;
949
+ }
950
+
951
+ .rte-toolbar-group-items.${x} .rte-toolbar-item:last-child .rte-toolbar-button,
952
+ .editora-toolbar-group-items.${x} .editora-toolbar-item:last-child .editora-toolbar-button,
953
+ .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
954
+ .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button {
955
+ border-right: none;
956
+ }
957
+
958
+ .rte-toolbar-button[data-command="toggleSmartPasteEnabled"].active,
959
+ .editora-toolbar-button[data-command="toggleSmartPasteEnabled"].active {
960
+ background-color: #ccc;
961
+ }
962
+
963
+ ${k} .rte-toolbar-group-items.${x},
964
+ ${k} .editora-toolbar-group-items.${x},
965
+ ${k} .rte-toolbar-group-items.${E},
966
+ ${k} .editora-toolbar-group-items.${E},
967
+ .${u}.rte-smart-paste-theme-dark {
968
+ border-color: #566275;
969
+ }
970
+
971
+ ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button svg,
972
+ ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button svg,
973
+ ${k} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
974
+ ${k} .editora-toolbar-group-items.${E} .editora-toolbar-button svg {
975
+ fill: none;
976
+ }
977
+
978
+ ${k} .rte-toolbar-group-items.${x} .rte-toolbar-button,
979
+ ${k} .editora-toolbar-group-items.${x} .editora-toolbar-button
980
+ {
981
+ border-color: #566275;
982
+ }
983
+
984
+ .${u} {
985
+ position: fixed;
986
+ z-index: 12000;
987
+ display: none;
988
+ width: min(360px, calc(100vw - 20px));
989
+ max-height: calc(100vh - 20px);
990
+ border: 1px solid #d1d5db;
991
+ border-radius: 14px;
992
+ background: #ffffff;
993
+ color: #111827;
994
+ box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
995
+ overflow: hidden;
996
+ }
997
+
998
+ .${u}.show {
999
+ display: flex;
1000
+ flex-direction: column;
1001
+ }
1002
+
1003
+ .${u}.rte-smart-paste-theme-dark {
1004
+ border-color: #334155;
1005
+ background: #0f172a;
1006
+ color: #e2e8f0;
1007
+ box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
1008
+ }
1009
+
1010
+ .rte-smart-paste-header {
1011
+ display: flex;
1012
+ align-items: center;
1013
+ justify-content: space-between;
1014
+ gap: 8px;
1015
+ padding: 12px 14px;
1016
+ border-bottom: 1px solid #e5e7eb;
1017
+ background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
1018
+ }
1019
+
1020
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-header {
1021
+ border-color: #1e293b;
1022
+ background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
1023
+ }
1024
+
1025
+ .rte-smart-paste-title {
1026
+ margin: 0;
1027
+ font-size: 15px;
1028
+ line-height: 1.2;
1029
+ font-weight: 700;
1030
+ }
1031
+
1032
+ .rte-smart-paste-icon-btn {
1033
+ width: 34px;
1034
+ height: 34px;
1035
+ border: 1px solid #cbd5e1;
1036
+ border-radius: 6px;
1037
+ background: #ffffff;
1038
+ color: #0f172a;
1039
+ font-size: 16px;
1040
+ line-height: 1;
1041
+ font-weight: 600;
1042
+ padding: 0;
1043
+ display: inline-flex;
1044
+ align-items: center;
1045
+ justify-content: center;
1046
+ cursor: pointer;
1047
+ }
1048
+
1049
+ .rte-smart-paste-icon-btn:hover,
1050
+ .rte-smart-paste-icon-btn:focus-visible {
1051
+ outline: none;
1052
+ border-color: #3b82f6;
1053
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
1054
+ }
1055
+
1056
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn {
1057
+ background: #0f172a;
1058
+ border-color: #475569;
1059
+ color: #e2e8f0;
1060
+ }
1061
+
1062
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:hover,
1063
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-icon-btn:focus-visible {
1064
+ border-color: #60a5fa;
1065
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
1066
+ }
1067
+
1068
+ .rte-smart-paste-body {
1069
+ display: flex;
1070
+ flex-direction: column;
1071
+ gap: 10px;
1072
+ padding: 12px;
1073
+ overflow: auto;
1074
+ }
1075
+
1076
+ .rte-smart-paste-status {
1077
+ margin: 0;
1078
+ font-size: 12px;
1079
+ line-height: 1.35;
1080
+ color: #475569;
1081
+ font-weight: 600;
1082
+ }
1083
+
1084
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-status {
1085
+ color: #94a3b8;
1086
+ }
1087
+
1088
+ .rte-smart-paste-controls {
1089
+ display: flex;
1090
+ gap: 8px;
1091
+ flex-wrap: wrap;
1092
+ }
1093
+
1094
+ .rte-smart-paste-btn {
1095
+ border: 1px solid #cbd5e1;
1096
+ border-radius: 8px;
1097
+ height: 34px;
1098
+ padding: 0 10px;
1099
+ background: #ffffff;
1100
+ color: inherit;
1101
+ font-size: 12px;
1102
+ font-weight: 600;
1103
+ cursor: pointer;
1104
+ }
1105
+
1106
+ .rte-smart-paste-btn:hover,
1107
+ .rte-smart-paste-btn:focus-visible {
1108
+ border-color: #94a3b8;
1109
+ background: #f8fafc;
1110
+ outline: none;
1111
+ }
1112
+
1113
+ .rte-smart-paste-btn-primary {
1114
+ border-color: #0284c7;
1115
+ background: #0ea5e9;
1116
+ color: #f8fafc;
1117
+ }
1118
+
1119
+ .rte-smart-paste-btn-primary:hover,
1120
+ .rte-smart-paste-btn-primary:focus-visible {
1121
+ border-color: #0369a1;
1122
+ background: #0284c7;
1123
+ color: #ffffff;
1124
+ }
1125
+
1126
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn {
1127
+ border-color: #334155;
1128
+ background: #111827;
1129
+ color: #e2e8f0;
1130
+ }
1131
+
1132
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:hover,
1133
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-btn:focus-visible {
1134
+ border-color: #475569;
1135
+ background: #1e293b;
1136
+ }
1137
+
1138
+ .rte-smart-paste-profile {
1139
+ display: grid;
1140
+ gap: 6px;
1141
+ }
1142
+
1143
+ .rte-smart-paste-profile-heading {
1144
+ margin: 0;
1145
+ font-size: 12px;
1146
+ line-height: 1.35;
1147
+ font-weight: 700;
1148
+ color: #334155;
1149
+ }
1150
+
1151
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-profile-heading {
1152
+ color: #cbd5e1;
1153
+ }
1154
+
1155
+ .rte-smart-paste-profile-grid {
1156
+ display: grid;
1157
+ grid-template-columns: repeat(3, minmax(0, 1fr));
1158
+ gap: 8px;
1159
+ }
1160
+
1161
+ .rte-smart-paste-chip {
1162
+ height: 34px;
1163
+ border-radius: 9px;
1164
+ border: 1px solid #cbd5e1;
1165
+ background: #ffffff;
1166
+ color: inherit;
1167
+ font-size: 12px;
1168
+ font-weight: 600;
1169
+ cursor: pointer;
1170
+ }
1171
+
1172
+ .rte-smart-paste-chip:hover,
1173
+ .rte-smart-paste-chip:focus-visible {
1174
+ border-color: #0284c7;
1175
+ outline: none;
1176
+ }
1177
+
1178
+ .rte-smart-paste-chip.active {
1179
+ border-color: #0284c7;
1180
+ background: rgba(14, 165, 233, 0.14);
1181
+ color: #0c4a6e;
1182
+ }
1183
+
1184
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip {
1185
+ border-color: #334155;
1186
+ background: #0b1220;
1187
+ color: #e2e8f0;
1188
+ }
1189
+
1190
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-chip.active {
1191
+ border-color: #38bdf8;
1192
+ background: rgba(14, 165, 233, 0.2);
1193
+ color: #e0f2fe;
1194
+ }
1195
+
1196
+ .rte-smart-paste-metrics {
1197
+ border: 1px solid #e2e8f0;
1198
+ border-radius: 10px;
1199
+ padding: 10px;
1200
+ background: #f8fafc;
1201
+ display: grid;
1202
+ gap: 8px;
1203
+ }
1204
+
1205
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-metrics {
1206
+ border-color: #334155;
1207
+ background: #0b1220;
1208
+ }
1209
+
1210
+ .rte-smart-paste-report-title {
1211
+ margin: 0;
1212
+ font-size: 12px;
1213
+ line-height: 1.3;
1214
+ font-weight: 700;
1215
+ }
1216
+
1217
+ .rte-smart-paste-empty {
1218
+ margin: 0;
1219
+ font-size: 12px;
1220
+ line-height: 1.35;
1221
+ color: #475569;
1222
+ }
1223
+
1224
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-empty {
1225
+ color: #94a3b8;
1226
+ }
1227
+
1228
+ .rte-smart-paste-report {
1229
+ margin: 0;
1230
+ display: grid;
1231
+ gap: 6px;
1232
+ }
1233
+
1234
+ .rte-smart-paste-line {
1235
+ display: flex;
1236
+ justify-content: space-between;
1237
+ gap: 10px;
1238
+ font-size: 12px;
1239
+ line-height: 1.3;
1240
+ }
1241
+
1242
+ .rte-smart-paste-line dt {
1243
+ margin: 0;
1244
+ color: #475569;
1245
+ font-weight: 600;
1246
+ }
1247
+
1248
+ .rte-smart-paste-line dd {
1249
+ margin: 0;
1250
+ font-weight: 700;
1251
+ }
1252
+
1253
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-line dt {
1254
+ color: #94a3b8;
1255
+ }
1256
+
1257
+ .rte-smart-paste-shortcut {
1258
+ margin: 2px 0 0;
1259
+ font-size: 11px;
1260
+ color: #64748b;
1261
+ }
1262
+
1263
+ .${u}.rte-smart-paste-theme-dark .rte-smart-paste-shortcut {
1264
+ color: #94a3b8;
1265
+ }
1266
+
1267
+ .rte-smart-paste-live {
1268
+ position: absolute;
1269
+ width: 1px;
1270
+ height: 1px;
1271
+ margin: -1px;
1272
+ padding: 0;
1273
+ overflow: hidden;
1274
+ clip: rect(0 0 0 0);
1275
+ border: 0;
1276
+ }
1277
+
1278
+ @media (max-width: 768px) {
1279
+ .${u} {
1280
+ left: 10px !important;
1281
+ right: 10px;
1282
+ top: 10px !important;
1283
+ width: auto !important;
1284
+ max-height: calc(100vh - 20px);
1285
+ }
1286
+
1287
+ .rte-smart-paste-profile-grid {
1288
+ grid-template-columns: 1fr;
1289
+ }
1290
+ }
1291
+ `, document.head.appendChild(e);
1292
+ }
1293
+ const st = (e = {}) => {
1294
+ const t = V(e), a = /* @__PURE__ */ new Set();
1295
+ return nt(), {
1296
+ name: "smartPaste",
1297
+ toolbar: [
1298
+ {
1299
+ id: "smartPasteGroup",
1300
+ label: "Smart Paste",
1301
+ type: "group",
1302
+ command: "smartPaste",
1303
+ items: [
1304
+ {
1305
+ id: "smartPaste",
1306
+ label: "Smart Paste Panel",
1307
+ command: "toggleSmartPastePanel",
1308
+ shortcut: "Mod-Alt-Shift-s",
1309
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8.5 4.5h7l3 3V18a2.5 2.5 0 0 1-2.5 2.5h-7A2.5 2.5 0 0 1 6.5 18V7a2.5 2.5 0 0 1 2-2.45Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M15.5 4.5V8h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M9.3 12h5.4M9.3 15h5.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
1310
+ },
1311
+ {
1312
+ id: "smartPasteProfile",
1313
+ label: "Cycle Smart Paste Profile",
1314
+ command: "cycleSmartPasteProfile",
1315
+ shortcut: "Mod-Alt-Shift-v",
1316
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 7.5h10" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="17.5" cy="7.5" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 12h5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12.5" cy="12" r="2" stroke="currentColor" stroke-width="1.6"/><path d="M4.5 16.5h12" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="9.5" cy="16.5" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'
1317
+ },
1318
+ {
1319
+ id: "smartPasteToggle",
1320
+ label: "Toggle Smart Paste",
1321
+ command: "toggleSmartPasteEnabled",
1322
+ shortcut: "Mod-Alt-Shift-g",
1323
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="8" width="17" height="8" rx="4" stroke="currentColor" stroke-width="1.6"/><circle cx="8" cy="12" r="2.6" fill="currentColor"/><path d="M14.5 12h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
1324
+ }
1325
+ ]
1326
+ }
1327
+ ],
1328
+ commands: {
1329
+ smartPaste: (r, n) => {
1330
+ const o = T(n, !1, !1);
1331
+ if (!o)
1332
+ return !1;
1333
+ const s = d.get(o) || t;
1334
+ return m(o, s), d.set(o, s), b = o, ye(o), !0;
1335
+ },
1336
+ toggleSmartPastePanel: (r, n) => {
1337
+ const o = T(n, !1, !1);
1338
+ if (!o)
1339
+ return !1;
1340
+ const s = d.get(o) || t;
1341
+ return m(o, s), d.set(o, s), b = o, xe(o, typeof r == "boolean" ? r : void 0);
1342
+ },
1343
+ cycleSmartPasteProfile: (r, n) => {
1344
+ const o = T(n, !1, !1);
1345
+ if (!o)
1346
+ return !1;
1347
+ const s = d.get(o) || t, l = m(o, s);
1348
+ return d.set(o, s), l.profile = ae(l.profile), S(o), !0;
1349
+ },
1350
+ setSmartPasteProfile: (r, n) => {
1351
+ const o = T(n, !1, !1);
1352
+ if (!o)
1353
+ return !1;
1354
+ const s = d.get(o) || t, l = m(o, s);
1355
+ return d.set(o, s), l.profile = H(r), S(o), !0;
1356
+ },
1357
+ toggleSmartPasteEnabled: (r, n) => {
1358
+ const o = T(n, !1, !1);
1359
+ if (!o)
1360
+ return !1;
1361
+ const s = d.get(o) || t, l = m(o, s);
1362
+ return d.set(o, s), l.enabled = typeof r == "boolean" ? r : !l.enabled, z(o), S(o), !0;
1363
+ },
1364
+ setSmartPasteOptions: (r, n) => {
1365
+ var f, p, y, g, P, C;
1366
+ const o = T(n, !1, !1);
1367
+ if (!o || !r || typeof r != "object")
1368
+ return !1;
1369
+ const s = d.get(o) || t, l = ce(s), c = V({
1370
+ ...l,
1371
+ ...r,
1372
+ labels: {
1373
+ ...s.labels,
1374
+ ...r.labels || {}
1375
+ },
1376
+ profileOptions: {
1377
+ ...l.profileOptions,
1378
+ ...r.profileOptions || {},
1379
+ fidelity: {
1380
+ ...((f = l.profileOptions) == null ? void 0 : f.fidelity) || {},
1381
+ ...((p = r.profileOptions) == null ? void 0 : p.fidelity) || {}
1382
+ },
1383
+ balanced: {
1384
+ ...((y = l.profileOptions) == null ? void 0 : y.balanced) || {},
1385
+ ...((g = r.profileOptions) == null ? void 0 : g.balanced) || {}
1386
+ },
1387
+ plain: {
1388
+ ...((P = l.profileOptions) == null ? void 0 : P.plain) || {},
1389
+ ...((C = r.profileOptions) == null ? void 0 : C.plain) || {}
1390
+ }
1391
+ },
1392
+ normalizeText: r.normalizeText || s.normalizeText
1393
+ });
1394
+ d.set(o, c);
1395
+ const i = m(o, c);
1396
+ return typeof r.enabled == "boolean" && (i.enabled = r.enabled), r.defaultProfile && (i.profile = H(r.defaultProfile)), S(o), z(o), !0;
1397
+ },
1398
+ getSmartPasteState: (r, n) => {
1399
+ const o = T(n, !1, !1);
1400
+ if (!o)
1401
+ return !1;
1402
+ const s = d.get(o) || t, l = m(o, s), c = ve(l);
1403
+ if (typeof r == "function")
1404
+ try {
1405
+ r(c);
1406
+ } catch (i) {
1407
+ }
1408
+ return o.__smartPasteState = c, o.dispatchEvent(
1409
+ new CustomEvent("editora:smart-paste-state", {
1410
+ bubbles: !0,
1411
+ detail: c
1412
+ })
1413
+ ), !0;
1414
+ }
1415
+ },
1416
+ keymap: {
1417
+ "Mod-Alt-Shift-s": "toggleSmartPastePanel",
1418
+ "Mod-Alt-Shift-S": "toggleSmartPastePanel",
1419
+ "Mod-Alt-Shift-v": "cycleSmartPasteProfile",
1420
+ "Mod-Alt-Shift-V": "cycleSmartPasteProfile",
1421
+ "Mod-Alt-Shift-g": "toggleSmartPasteEnabled",
1422
+ "Mod-Alt-Shift-G": "toggleSmartPasteEnabled"
1423
+ },
1424
+ init: function(n) {
1425
+ W += 1;
1426
+ const o = this && typeof this.__pluginConfig == "object" ? V({ ...ce(t), ...this.__pluginConfig }) : t;
1427
+ at(o);
1428
+ const s = T(
1429
+ n != null && n.editorElement ? { editorElement: n.editorElement } : void 0,
1430
+ !1,
1431
+ !1
1432
+ );
1433
+ if (!s)
1434
+ return;
1435
+ b = s, a.add(s);
1436
+ const l = m(s, o);
1437
+ l.enabled = o.enabled, l.profile = o.defaultProfile, d.set(s, o), z(s);
1438
+ },
1439
+ destroy: () => {
1440
+ a.forEach((r) => be(r)), a.clear(), W = Math.max(0, W - 1), !(W > 0) && ot();
1441
+ }
1442
+ };
1443
+ };
1444
+ export {
1445
+ st as SmartPastePlugin
1446
+ };
1447
+ //# sourceMappingURL=SmartPastePlugin.native-a6c5efec.mjs.map