@editora/core 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/editora.min.js +26 -24
  44. package/dist/editora.umd.js +26 -24
  45. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  46. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  47. package/dist/index-XsYC_KdJ.mjs +3923 -0
  48. package/dist/index-_eKRBZPq.js +12 -0
  49. package/dist/index.cjs.js +3 -3
  50. package/dist/index.esm.js +17 -14
  51. package/dist/plugin-loader.js +53 -52
  52. package/dist/webcomponent-core.js +2055 -476
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +96 -66
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +2223 -643
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1564 -1198
  60. package/index.d.ts +32 -0
  61. package/package.json +10 -3
  62. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  63. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  64. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  65. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  66. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  67. package/dist/index-BLm1MtzH.js +0 -10
  68. package/dist/index-Cd9jEuZP.mjs +0 -2341
@@ -0,0 +1,3923 @@
1
+ class Gt {
2
+ constructor(t, e, o) {
3
+ this.doc = t, this.selection = e, this.schema = o;
4
+ }
5
+ static create(t, e) {
6
+ const o = e || t.node("doc", {}, [t.node("paragraph")]);
7
+ return new Gt(o, { anchor: 0, head: 0 }, t);
8
+ }
9
+ apply(t, e) {
10
+ return new Gt(t, e || this.selection, this.schema);
11
+ }
12
+ }
13
+ class rn {
14
+ constructor(t, e) {
15
+ this.nodes = new Map(Object.entries(t)), this.marks = new Map(Object.entries(e));
16
+ }
17
+ node(t, e, o) {
18
+ return { type: t, attrs: e, content: o };
19
+ }
20
+ text(t, e) {
21
+ return { type: "text", text: t, marks: e };
22
+ }
23
+ }
24
+ class an {
25
+ constructor() {
26
+ this.plugins = [], this.pluginConfigs = /* @__PURE__ */ new Map();
27
+ }
28
+ register(t, e) {
29
+ this.plugins.push(t), e && this.pluginConfigs.set(t.name, e);
30
+ const o = this.pluginConfigs.get(t.name) || t.config;
31
+ if (t.initialize)
32
+ try {
33
+ t.initialize(o);
34
+ } catch (i) {
35
+ console.error(`Failed to initialize plugin "${t.name}":`, i);
36
+ }
37
+ if (t.init && t.init !== t.initialize)
38
+ try {
39
+ t.init(o);
40
+ } catch (i) {
41
+ console.error(`Failed to run init hook for plugin "${t.name}":`, i);
42
+ }
43
+ }
44
+ unregister(t) {
45
+ const e = this.plugins.findIndex((o) => o.name === t);
46
+ if (e > -1) {
47
+ const o = this.plugins[e];
48
+ o.destroy && o.destroy(), this.plugins.splice(e, 1), this.pluginConfigs.delete(t);
49
+ }
50
+ }
51
+ getPlugin(t) {
52
+ return this.plugins.find((e) => e.name === t);
53
+ }
54
+ getPluginConfig(t) {
55
+ return this.pluginConfigs.get(t);
56
+ }
57
+ buildSchema() {
58
+ const t = {}, e = {};
59
+ return this.plugins.forEach((o) => {
60
+ o.nodes && Object.assign(t, o.nodes), o.marks && Object.assign(e, o.marks);
61
+ }), new rn(t, e);
62
+ }
63
+ getCommands() {
64
+ const t = {};
65
+ return this.plugins.forEach((e) => {
66
+ e.commands && Object.assign(t, e.commands);
67
+ }), t;
68
+ }
69
+ getToolbarItems() {
70
+ return this.plugins.flatMap((t) => t.toolbar || []);
71
+ }
72
+ /**
73
+ * Execute plugin command with mode awareness
74
+ */
75
+ async executePluginCommand(t, e, ...o) {
76
+ const i = this.getPlugin(t);
77
+ if (!i)
78
+ throw new Error(`Plugin not found: ${t}`);
79
+ const r = this.getPluginConfig(t) || i.config || {}, l = r.mode || "local";
80
+ try {
81
+ switch (l) {
82
+ case "local":
83
+ return i.executeLocal ? i.executeLocal(e, ...o) : null;
84
+ case "api":
85
+ if (!i.executeAPI)
86
+ throw new Error(`Plugin ${t} does not support API mode`);
87
+ return await i.executeAPI(e, ...o);
88
+ case "hybrid":
89
+ if (i.executeHybrid)
90
+ return await i.executeHybrid(e, ...o);
91
+ try {
92
+ if (i.executeAPI)
93
+ return await i.executeAPI(e, ...o);
94
+ } catch (c) {
95
+ if (console.warn(`API execution failed for ${t}, falling back to local`, c), i.executeLocal && r.fallbackToLocal !== !1)
96
+ return i.executeLocal(e, ...o);
97
+ throw c;
98
+ }
99
+ break;
100
+ default:
101
+ throw new Error(`Unknown plugin mode: ${l}`);
102
+ }
103
+ } catch (c) {
104
+ throw console.error(`Error executing command ${e} on plugin ${t}:`, c), c;
105
+ }
106
+ }
107
+ /**
108
+ * Destroy all plugins
109
+ */
110
+ async destroyAll() {
111
+ const t = this.plugins.filter((e) => e.destroy).map((e) => e.destroy());
112
+ await Promise.all(t), this.plugins = [], this.pluginConfigs.clear();
113
+ }
114
+ }
115
+ class sn {
116
+ constructor(t) {
117
+ this.shortcuts = /* @__PURE__ */ new Map(), this.enabled = !0, this.isMac = typeof navigator != "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0, (t == null ? void 0 : t.enabled) === !1 && (this.enabled = !1), this.registerDefaultShortcuts(), t != null && t.shortcuts && t.shortcuts.forEach((e) => this.registerShortcut(e)), t != null && t.customShortcuts && Object.values(t.customShortcuts).forEach((e) => {
118
+ this.registerShortcut(e);
119
+ });
120
+ }
121
+ registerDefaultShortcuts() {
122
+ this.registerShortcut({
123
+ key: "b",
124
+ ctrl: !this.isMac,
125
+ meta: this.isMac,
126
+ command: "toggleBold",
127
+ description: "Bold",
128
+ preventDefault: !0
129
+ }), this.registerShortcut({
130
+ key: "i",
131
+ ctrl: !this.isMac,
132
+ meta: this.isMac,
133
+ command: "toggleItalic",
134
+ description: "Italic",
135
+ preventDefault: !0
136
+ }), this.registerShortcut({
137
+ key: "u",
138
+ ctrl: !this.isMac,
139
+ meta: this.isMac,
140
+ command: "toggleUnderline",
141
+ description: "Underline",
142
+ preventDefault: !0
143
+ }), this.registerShortcut({
144
+ key: "d",
145
+ ctrl: !this.isMac,
146
+ meta: this.isMac,
147
+ command: "toggleStrikethrough",
148
+ description: "Strikethrough",
149
+ preventDefault: !0
150
+ }), this.registerShortcut({
151
+ key: "z",
152
+ ctrl: !this.isMac,
153
+ meta: this.isMac,
154
+ command: "undo",
155
+ description: "Undo",
156
+ preventDefault: !0
157
+ }), this.registerShortcut({
158
+ key: "z",
159
+ ctrl: !this.isMac,
160
+ meta: this.isMac,
161
+ shift: !0,
162
+ command: "redo",
163
+ description: "Redo",
164
+ preventDefault: !0
165
+ }), this.registerShortcut({
166
+ key: "y",
167
+ ctrl: !this.isMac,
168
+ meta: this.isMac,
169
+ command: "redo",
170
+ description: "Redo",
171
+ preventDefault: !0
172
+ });
173
+ for (let t = 1; t <= 6; t++)
174
+ this.registerShortcut({
175
+ key: String(t),
176
+ ctrl: !this.isMac,
177
+ meta: this.isMac,
178
+ alt: !0,
179
+ command: "setBlockType",
180
+ params: `h${t}`,
181
+ description: `Heading ${t}`,
182
+ preventDefault: !0
183
+ });
184
+ this.registerShortcut({
185
+ key: "7",
186
+ ctrl: !this.isMac,
187
+ meta: this.isMac,
188
+ alt: !0,
189
+ command: "setBlockType",
190
+ params: "p",
191
+ description: "Paragraph",
192
+ preventDefault: !0
193
+ }), this.registerShortcut({
194
+ key: "7",
195
+ ctrl: !this.isMac,
196
+ meta: this.isMac,
197
+ shift: !0,
198
+ command: "toggleOrderedList",
199
+ description: "Numbered List",
200
+ preventDefault: !0
201
+ }), this.registerShortcut({
202
+ key: "8",
203
+ ctrl: !this.isMac,
204
+ meta: this.isMac,
205
+ shift: !0,
206
+ command: "toggleBulletList",
207
+ description: "Bullet List",
208
+ preventDefault: !0
209
+ }), this.registerShortcut({
210
+ key: "k",
211
+ ctrl: !this.isMac,
212
+ meta: this.isMac,
213
+ command: "openLinkDialog",
214
+ description: "Insert/Edit Link",
215
+ preventDefault: !0
216
+ }), this.registerShortcut({
217
+ key: "e",
218
+ ctrl: !this.isMac,
219
+ meta: this.isMac,
220
+ alt: !0,
221
+ command: "insertCodeBlock",
222
+ description: "Code Block",
223
+ preventDefault: !0
224
+ }), this.registerShortcut({
225
+ key: "q",
226
+ ctrl: !this.isMac,
227
+ meta: this.isMac,
228
+ shift: !0,
229
+ command: "toggleBlockquote",
230
+ description: "Blockquote",
231
+ preventDefault: !0
232
+ }), this.registerShortcut({
233
+ key: "l",
234
+ ctrl: !this.isMac,
235
+ meta: this.isMac,
236
+ shift: !0,
237
+ command: "setTextAlignment",
238
+ params: "left",
239
+ description: "Align Left",
240
+ preventDefault: !0
241
+ }), this.registerShortcut({
242
+ key: "e",
243
+ ctrl: !this.isMac,
244
+ meta: this.isMac,
245
+ shift: !0,
246
+ alt: !0,
247
+ command: "setTextAlignment",
248
+ params: "center",
249
+ description: "Align Center",
250
+ preventDefault: !0
251
+ }), this.registerShortcut({
252
+ key: "r",
253
+ ctrl: !this.isMac,
254
+ meta: this.isMac,
255
+ shift: !0,
256
+ command: "setTextAlignment",
257
+ params: "right",
258
+ description: "Align Right",
259
+ preventDefault: !0
260
+ }), this.registerShortcut({
261
+ key: "j",
262
+ ctrl: !this.isMac,
263
+ meta: this.isMac,
264
+ shift: !0,
265
+ command: "setTextAlignment",
266
+ params: "justify",
267
+ description: "Justify",
268
+ preventDefault: !0
269
+ }), this.registerShortcut({
270
+ key: "\\",
271
+ ctrl: !this.isMac,
272
+ meta: this.isMac,
273
+ command: "clearFormatting",
274
+ description: "Clear Formatting",
275
+ preventDefault: !0
276
+ }), this.registerShortcut({
277
+ key: "]",
278
+ ctrl: !this.isMac,
279
+ meta: this.isMac,
280
+ command: "increaseIndent",
281
+ description: "Indent",
282
+ preventDefault: !0
283
+ }), this.registerShortcut({
284
+ key: "[",
285
+ ctrl: !this.isMac,
286
+ meta: this.isMac,
287
+ command: "decreaseIndent",
288
+ description: "Outdent",
289
+ preventDefault: !0
290
+ }), this.registerShortcut({
291
+ key: "g",
292
+ ctrl: !this.isMac,
293
+ meta: this.isMac,
294
+ shift: !0,
295
+ command: "insertImage",
296
+ description: "Insert Image",
297
+ preventDefault: !0
298
+ }), this.registerShortcut({
299
+ key: "t",
300
+ ctrl: !this.isMac,
301
+ meta: this.isMac,
302
+ shift: !0,
303
+ alt: !0,
304
+ command: "insertTable",
305
+ description: "Insert Table",
306
+ preventDefault: !0
307
+ }), this.registerShortcut({
308
+ key: "f11",
309
+ command: "toggleFullscreen",
310
+ description: "Toggle Fullscreen",
311
+ preventDefault: !0
312
+ }), this.registerShortcut({
313
+ key: "p",
314
+ ctrl: !this.isMac,
315
+ meta: this.isMac,
316
+ shift: !0,
317
+ command: "togglePreview",
318
+ description: "Preview",
319
+ preventDefault: !0
320
+ }), this.registerShortcut({
321
+ key: "p",
322
+ ctrl: !this.isMac,
323
+ meta: this.isMac,
324
+ command: "print",
325
+ description: "Print",
326
+ preventDefault: !0
327
+ }), this.registerShortcut({
328
+ key: "s",
329
+ ctrl: !this.isMac,
330
+ meta: this.isMac,
331
+ shift: !0,
332
+ alt: !0,
333
+ command: "insertSpecialCharacter",
334
+ description: "Insert Special Character",
335
+ preventDefault: !0
336
+ }), this.registerShortcut({
337
+ key: "m",
338
+ ctrl: !this.isMac,
339
+ meta: this.isMac,
340
+ shift: !0,
341
+ command: "insertEmoji",
342
+ description: "Insert Emoji",
343
+ preventDefault: !0
344
+ }), this.registerShortcut({
345
+ key: "9",
346
+ ctrl: !this.isMac,
347
+ meta: this.isMac,
348
+ shift: !0,
349
+ command: "toggleChecklist",
350
+ description: "Checklist",
351
+ preventDefault: !0
352
+ }), this.registerShortcut({
353
+ key: "a",
354
+ ctrl: !this.isMac,
355
+ meta: this.isMac,
356
+ shift: !0,
357
+ alt: !0,
358
+ command: "toggleA11yChecker",
359
+ description: "Accessibility Checker",
360
+ preventDefault: !0
361
+ }), this.registerShortcut({
362
+ key: "F7",
363
+ command: "toggleSpellCheck",
364
+ description: "Spell Check",
365
+ preventDefault: !0
366
+ }), this.registerShortcut({
367
+ key: "m",
368
+ ctrl: !this.isMac,
369
+ meta: this.isMac,
370
+ alt: !0,
371
+ command: "insertMath",
372
+ description: "Insert Math",
373
+ preventDefault: !0
374
+ }), this.registerShortcut({
375
+ key: "f",
376
+ ctrl: !this.isMac,
377
+ meta: this.isMac,
378
+ alt: !0,
379
+ command: "insertFootnote",
380
+ description: "Insert Footnote",
381
+ preventDefault: !0
382
+ });
383
+ }
384
+ registerShortcut(t) {
385
+ const e = this.getShortcutKey(t);
386
+ this.shortcuts.set(e, t);
387
+ }
388
+ unregisterShortcut(t) {
389
+ const e = this.getShortcutKey(t);
390
+ this.shortcuts.delete(e);
391
+ }
392
+ getShortcutKey(t) {
393
+ const e = [];
394
+ return t.ctrl && e.push("ctrl"), t.alt && e.push("alt"), t.shift && e.push("shift"), t.meta && e.push("meta"), e.push(t.key.toLowerCase()), e.join("+");
395
+ }
396
+ getEventKey(t) {
397
+ const e = [];
398
+ return t.ctrlKey && e.push("ctrl"), t.altKey && e.push("alt"), t.shiftKey && e.push("shift"), t.metaKey && e.push("meta"), e.push(t.key.toLowerCase()), e.join("+");
399
+ }
400
+ handleKeyDown(t, e) {
401
+ if (!this.enabled) return !1;
402
+ const o = this.getEventKey(t), i = this.shortcuts.get(o);
403
+ return i ? (i.preventDefault !== !1 && (t.preventDefault(), t.stopPropagation()), e(i.command, i.params), !0) : !1;
404
+ }
405
+ enable() {
406
+ this.enabled = !0;
407
+ }
408
+ disable() {
409
+ this.enabled = !1;
410
+ }
411
+ isEnabled() {
412
+ return this.enabled;
413
+ }
414
+ getAllShortcuts() {
415
+ return Array.from(this.shortcuts.values());
416
+ }
417
+ getShortcutForCommand(t) {
418
+ return Array.from(this.shortcuts.values()).find((e) => e.command === t);
419
+ }
420
+ getShortcutDescription(t) {
421
+ const e = [];
422
+ this.isMac ? (t.meta && e.push("⌘"), t.ctrl && e.push("⌃"), t.alt && e.push("⌥"), t.shift && e.push("⇧")) : (t.ctrl && e.push("Ctrl"), t.alt && e.push("Alt"), t.shift && e.push("Shift"));
423
+ const o = t.key.length === 1 ? t.key.toUpperCase() : t.key;
424
+ return e.push(o), e.join("+");
425
+ }
426
+ getShortcutsHelp() {
427
+ const t = this.getAllShortcuts(), e = /* @__PURE__ */ new Map();
428
+ t.forEach((i) => {
429
+ const r = this.getShortcutCategory(i.command);
430
+ e.has(r) || e.set(r, []), e.get(r).push(i);
431
+ });
432
+ let o = `# Keyboard Shortcuts
433
+
434
+ `;
435
+ return e.forEach((i, r) => {
436
+ o += `## ${r}
437
+
438
+ `, i.forEach((l) => {
439
+ const c = this.getShortcutDescription(l);
440
+ o += `- **${c}**: ${l.description || l.command}
441
+ `;
442
+ }), o += `
443
+ `;
444
+ }), o;
445
+ }
446
+ getShortcutCategory(t) {
447
+ return t.includes("toggle") && (t.includes("Bold") || t.includes("Italic") || t.includes("Underline") || t.includes("Strike") || t.includes("Code") || t.includes("Super") || t.includes("Sub")) ? "Text Formatting" : t.includes("Heading") || t.includes("Paragraph") ? "Block Formatting" : t.includes("List") || t.includes("Checklist") ? "Lists" : t.includes("Alignment") || t.includes("Indent") ? "Alignment & Indentation" : t.includes("undo") || t.includes("redo") ? "History" : t.includes("insert") ? "Insert" : t.includes("find") || t.includes("replace") ? "Find & Replace" : t.includes("Accessibility") || t.includes("spell") ? "Tools" : "Other";
448
+ }
449
+ }
450
+ class ln {
451
+ constructor(t = {}) {
452
+ this.commands = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([e, o]) => {
453
+ this.register(e, o);
454
+ });
455
+ }
456
+ /**
457
+ * Register a command
458
+ */
459
+ register(t, e) {
460
+ this.commands.has(t) && console.warn(`Command ${t} is being overwritten`), this.commands.set(t, e);
461
+ }
462
+ /**
463
+ * Unregister a command
464
+ */
465
+ unregister(t) {
466
+ this.commands.delete(t);
467
+ }
468
+ /**
469
+ * Get a command handler
470
+ */
471
+ get(t) {
472
+ return this.commands.get(t);
473
+ }
474
+ /**
475
+ * Check if command exists
476
+ */
477
+ has(t) {
478
+ return this.commands.has(t);
479
+ }
480
+ /**
481
+ * Get all command names
482
+ */
483
+ getCommandNames() {
484
+ return Array.from(this.commands.keys());
485
+ }
486
+ /**
487
+ * Clear all commands
488
+ */
489
+ clear() {
490
+ this.commands.clear();
491
+ }
492
+ }
493
+ class cn {
494
+ constructor(t = {}) {
495
+ this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new an(), t.plugins && Array.isArray(t.plugins) && t.plugins.forEach((o) => this.pluginManager.register(o));
496
+ const e = this.pluginManager.buildSchema();
497
+ this.state = Gt.create(e), this.commandRegistry = new ln(this.pluginManager.getCommands());
498
+ }
499
+ /**
500
+ * Execute a command
501
+ */
502
+ execCommand(t, ...e) {
503
+ if (this.isReadonly)
504
+ return console.warn("Cannot execute commands in readonly mode"), !1;
505
+ if (this.isDestroyed)
506
+ return console.warn("Cannot execute commands on destroyed editor"), !1;
507
+ const o = this.commandRegistry.get(t);
508
+ if (!o)
509
+ return console.warn(`Command not found: ${t}`), !1;
510
+ let i;
511
+ return e.length === 0 ? i = o(this.state) : e.length === 1 ? i = o(this.state, e[0]) : i = o(this.state, ...e), i instanceof Promise ? (i.then((r) => {
512
+ r && typeof r == "object" && "doc" in r && "selection" in r && (this.setState(r), this.emit("change", this.state));
513
+ }).catch((r) => {
514
+ console.error(`Async command failed: ${t}`, r);
515
+ }), !0) : i && typeof i == "object" && "doc" in i && "selection" in i ? (this.setState(i), this.emit("change", this.state), !0) : i !== !1 && i != null;
516
+ }
517
+ /**
518
+ * Update editor state
519
+ */
520
+ setState(t) {
521
+ this.isDestroyed || (this.state = t, this.emit("stateChange", t));
522
+ }
523
+ /**
524
+ * Get current state
525
+ */
526
+ getState() {
527
+ return this.state;
528
+ }
529
+ /**
530
+ * Set readonly mode
531
+ */
532
+ setReadonly(t) {
533
+ this.isReadonly = t, this.emit("readonlyChange", t);
534
+ }
535
+ /**
536
+ * Check if readonly
537
+ */
538
+ isReadOnly() {
539
+ return this.isReadonly;
540
+ }
541
+ /**
542
+ * Event emitter
543
+ */
544
+ on(t, e) {
545
+ return this.listeners.has(t) || this.listeners.set(t, []), this.listeners.get(t).push(e), () => {
546
+ const o = this.listeners.get(t);
547
+ if (o) {
548
+ const i = o.indexOf(e);
549
+ i > -1 && o.splice(i, 1);
550
+ }
551
+ };
552
+ }
553
+ /**
554
+ * Emit event
555
+ */
556
+ emit(t, ...e) {
557
+ const o = this.listeners.get(t);
558
+ o && o.forEach((i) => {
559
+ try {
560
+ i(...e);
561
+ } catch (r) {
562
+ console.error(`Error in ${t} handler:`, r);
563
+ }
564
+ });
565
+ }
566
+ /**
567
+ * Destroy editor instance
568
+ */
569
+ destroy() {
570
+ this.isDestroyed || (this.isDestroyed = !0, this.listeners.clear(), this.emit("destroy"));
571
+ }
572
+ /**
573
+ * Check if destroyed
574
+ */
575
+ isEditorDestroyed() {
576
+ return this.isDestroyed;
577
+ }
578
+ }
579
+ class dn {
580
+ constructor(t, e, o) {
581
+ this.overflowUnits = [], this.overflowUnitHomes = /* @__PURE__ */ new WeakMap(), this.expandedOpen = !1, this.onDocumentPointerDownForOverflow = (i) => {
582
+ var l, c;
583
+ if (!this.expandedOpen) return;
584
+ const r = i.target;
585
+ r && ((l = this.moreButton) != null && l.contains(r) || (c = this.expandedRow) != null && c.contains(r)) || this.setExpandedOpen(!1);
586
+ }, this.config = t, this.plugins = e, this.pluginLoader = o;
587
+ }
588
+ setLastCommandTrigger(t, e) {
589
+ if (typeof window == "undefined" || !t) return;
590
+ const o = e || t.getAttribute("data-command") || void 0;
591
+ o && (window.__editoraLastCommandButton = t, window.__editoraLastCommand = o);
592
+ }
593
+ /**
594
+ * Set command handler for toolbar buttons
595
+ */
596
+ setCommandHandler(t) {
597
+ this.commandHandler = t;
598
+ }
599
+ /**
600
+ * Parse toolbar string into button groups
601
+ */
602
+ parseToolbarString(t) {
603
+ const e = [], o = t.split("|").map((c) => c.trim()), i = this.getAvailableToolbarItems(), r = /* @__PURE__ */ new Map();
604
+ i.forEach((c) => {
605
+ c.command && r.set(c.command, c), c.type === "group" && c.label && r.set(c.label, c);
606
+ });
607
+ const l = {
608
+ bold: "toggleBold",
609
+ italic: "toggleItalic",
610
+ underline: "toggleUnderline",
611
+ strikethrough: "toggleStrikethrough",
612
+ bullist: "toggleBulletList",
613
+ numlist: "toggleOrderedList",
614
+ checklist: "toggleChecklist",
615
+ link: "openLinkDialog",
616
+ image: "openImageDialog",
617
+ table: "insertTable",
618
+ trackChanges: "toggleTrackChanges",
619
+ acceptTrackChanges: "acceptAllTrackChanges",
620
+ rejectTrackChanges: "rejectAllTrackChanges",
621
+ anchor: "insertAnchor",
622
+ code: "toggleSourceView",
623
+ blockquote: "toggleBlockquote",
624
+ undo: "undo",
625
+ redo: "redo",
626
+ textColor: "openTextColorPicker",
627
+ backgroundColor: "openBackgroundColorPicker",
628
+ fontSize: "fontSize",
629
+ fontFamily: "setFontFamily",
630
+ lineHeight: "setLineHeight",
631
+ heading: "setBlockType",
632
+ paragraph: "setParagraph",
633
+ textAlignment: "setTextAlignment",
634
+ direction: "setDirectionLTR",
635
+ indent: "increaseIndent",
636
+ outdent: "decreaseIndent",
637
+ capitalization: "setCapitalization",
638
+ math: "insertMath",
639
+ specialCharacters: "insertSpecialCharacter",
640
+ emojis: "openEmojiDialog",
641
+ embedIframe: "openEmbedIframeDialog",
642
+ fullscreen: "toggleFullscreen",
643
+ preview: "togglePreview",
644
+ print: "print",
645
+ a11yChecker: "toggleA11yChecker",
646
+ spellCheck: "toggleSpellCheck",
647
+ comments: "addComment",
648
+ showHideComments: "toggleComments",
649
+ toggleComments: "toggleComments",
650
+ footnote: "insertFootnote",
651
+ mergeTags: "insertMergeTag",
652
+ dataBinding: "openDataBindingDialog",
653
+ dataBindingPreview: "openDataBindingDialog",
654
+ contentRules: "toggleContentRulesPanel",
655
+ contentRulesAudit: "runContentRulesAudit",
656
+ contentRulesRealtime: "toggleContentRulesRealtime",
657
+ mention: "insertMention",
658
+ slash: "openSlashCommands",
659
+ slashCommands: "openSlashCommands",
660
+ pageBreak: "insertPageBreak",
661
+ template: "insertTemplate",
662
+ importWord: "importWord",
663
+ exportWord: "exportWord",
664
+ exportPdf: "exportPdf",
665
+ insertImage: "insertImage",
666
+ insertVideo: "insertVideo",
667
+ codeBlock: "insertCodeBlock"
668
+ };
669
+ return o.forEach((c) => {
670
+ const p = [];
671
+ c.split(/\s+/).filter(Boolean).forEach((E) => {
672
+ if (E === "direction") {
673
+ const w = r.get("setDirectionLTR"), v = r.get("setDirectionRTL");
674
+ w && p.push({
675
+ id: "directionLTR",
676
+ label: w.label,
677
+ command: w.command,
678
+ icon: w.icon,
679
+ type: w.type || "button",
680
+ options: w.options
681
+ }), v && p.push({
682
+ id: "directionRTL",
683
+ label: v.label,
684
+ command: v.command,
685
+ icon: v.icon,
686
+ type: v.type || "button",
687
+ options: v.options
688
+ });
689
+ return;
690
+ }
691
+ if (E === "comments") {
692
+ const w = r.get("addComment"), v = r.get("toggleComments");
693
+ w && p.push({
694
+ id: "addComment",
695
+ label: w.label,
696
+ command: w.command,
697
+ icon: w.icon,
698
+ type: w.type || "button",
699
+ options: w.options
700
+ }), v && p.push({
701
+ id: "toggleComments",
702
+ label: v.label,
703
+ command: v.command,
704
+ icon: v.icon,
705
+ type: v.type || "button",
706
+ options: v.options
707
+ });
708
+ return;
709
+ }
710
+ const A = l[E] || E;
711
+ let C = r.get(A);
712
+ C || (C = r.get(E)), C && p.push({
713
+ id: E,
714
+ label: C.label,
715
+ command: C.command,
716
+ icon: C.icon,
717
+ type: C.type === "separator" ? "separator" : C.type || "button",
718
+ options: C.options,
719
+ items: C.items
720
+ });
721
+ }), p.length > 0 && e.push(p);
722
+ }), e;
723
+ }
724
+ /**
725
+ * Get all available toolbar items from plugins
726
+ */
727
+ getAvailableToolbarItems() {
728
+ return this.plugins.flatMap((e) => e.toolbar || []);
729
+ }
730
+ /**
731
+ * Render toolbar to DOM element
732
+ */
733
+ render(t) {
734
+ this.container = t, t.innerHTML = "", t.className = "editora-toolbar", this.config.sticky && t.classList.add("editora-toolbar-sticky"), this.config.position && t.classList.add(`editora-toolbar-${this.config.position}`);
735
+ const e = document.createElement("div");
736
+ e.className = "editora-toolbar-items-container", this.itemsContainer = e, this.overflowUnits = [];
737
+ const o = this.config.items || this.getDefaultToolbarString(), i = this.parseToolbarString(o);
738
+ i.forEach((r, l) => {
739
+ const c = document.createElement("div");
740
+ if (c.className = "editora-toolbar-group", r.forEach((p) => {
741
+ this.appendToolbarButton(c, p);
742
+ const m = c.lastElementChild;
743
+ m instanceof HTMLElement && (this.overflowUnits.push(m), this.overflowUnitHomes.set(m, c));
744
+ }), e.appendChild(c), l < i.length - 1) {
745
+ const p = document.createElement("div");
746
+ p.className = "editora-toolbar-separator", e.appendChild(p);
747
+ }
748
+ }), t.appendChild(e), this.setupOverflow(t);
749
+ }
750
+ /** Measures top-level items in `itemsContainer` and moves whatever doesn't
751
+ * fit into a collapsible "more options" row, re-measuring on resize. */
752
+ setupOverflow(t) {
753
+ if (!this.itemsContainer || typeof ResizeObserver == "undefined") return;
754
+ const o = document.createElement("button");
755
+ o.type = "button", o.className = "editora-toolbar-more-button", o.title = "Show more options", o.setAttribute("aria-label", "More toolbar options"), o.textContent = "☰", o.style.display = "none", o.addEventListener("click", (c) => {
756
+ c.preventDefault(), this.setExpandedOpen(!this.expandedOpen);
757
+ }), this.moreButton = o, t.appendChild(o);
758
+ const i = document.createElement("div");
759
+ i.className = "editora-toolbar-expanded-row", this.expandedRow = i, t.appendChild(i), document.addEventListener("mousedown", this.onDocumentPointerDownForOverflow, !0);
760
+ const r = () => {
761
+ const c = this.overflowUnits;
762
+ if (c.length === 0) return;
763
+ c.forEach((D) => {
764
+ var N;
765
+ D.parentElement === i && ((N = this.overflowUnitHomes.get(D)) == null || N.appendChild(D));
766
+ });
767
+ const p = t.clientWidth, m = 16, E = 40, A = 4, C = Math.max(0, p - m - E - A);
768
+ let w = 0, v = 0;
769
+ for (const D of c) {
770
+ const N = D.getBoundingClientRect().width + A;
771
+ if (w + N <= C)
772
+ w += N, v++;
773
+ else
774
+ break;
775
+ }
776
+ v = Math.max(1, Math.min(v, c.length));
777
+ const K = v < c.length;
778
+ o.style.display = K ? "" : "none", o.classList.toggle("active", K && this.expandedOpen), !K && this.expandedOpen && this.setExpandedOpen(!1), c.forEach((D, N) => {
779
+ N >= v && i.appendChild(D);
780
+ });
781
+ }, l = () => {
782
+ this.overflowRafId !== void 0 && cancelAnimationFrame(this.overflowRafId), this.overflowRafId = requestAnimationFrame(r);
783
+ };
784
+ this.resizeObserver = new ResizeObserver(() => l()), this.resizeObserver.observe(t), l();
785
+ }
786
+ setExpandedOpen(t) {
787
+ var e, o;
788
+ this.expandedOpen = t, (e = this.expandedRow) == null || e.classList.toggle("show", t), (o = this.moreButton) == null || o.classList.toggle("active", t);
789
+ }
790
+ /**
791
+ * Append a toolbar button or group to a parent element
792
+ */
793
+ appendToolbarButton(t, e) {
794
+ if (e.type === "separator") {
795
+ const o = document.createElement("div");
796
+ o.className = "editora-toolbar-separator", t.appendChild(o);
797
+ } else if (e.type === "dropdown") {
798
+ const o = this.createDropdown(e);
799
+ t.appendChild(o);
800
+ } else if (e.type === "inline-menu") {
801
+ const o = this.createInlineMenu(e);
802
+ t.appendChild(o);
803
+ } else if (e.type === "group" && e.items && e.items.length) {
804
+ const o = this.createGroupButton(e);
805
+ t.appendChild(o);
806
+ } else if (e.type === "input") {
807
+ const o = this.createInput(e);
808
+ t.appendChild(o);
809
+ } else {
810
+ const o = this.createButton(e);
811
+ t.appendChild(o);
812
+ }
813
+ }
814
+ /**
815
+ * Create a toolbar button element
816
+ */
817
+ createGroupButton(t) {
818
+ const e = document.createElement("div"), o = t.label.toLowerCase().replace(/\s+/g, "-");
819
+ if (e.className = `editora-toolbar-group-button ${o}`, e.title = t.label, t.icon)
820
+ if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
821
+ const i = document.createElement("span");
822
+ i.className = "editora-toolbar-icon", i.innerHTML = t.icon, e.appendChild(i);
823
+ } else
824
+ e.innerHTML = t.icon;
825
+ if (t.items && t.items.length) {
826
+ const i = document.createElement("div");
827
+ i.className = `editora-toolbar-group-items ${o}`, t.items.forEach((r) => {
828
+ this.appendToolbarButton(i, r);
829
+ }), e.appendChild(i);
830
+ }
831
+ return e;
832
+ }
833
+ /**
834
+ * Create a toolbar button element
835
+ */
836
+ createInput(t) {
837
+ const e = document.createElement("input");
838
+ return e.className = `editora-toolbar-input ${t.label.toLowerCase().replace(/\s+/g, "-")}`, e.type = "text", e.title = t.label, e.placeholder = t.placeholder || "", t.command && e.setAttribute("data-command", t.command), t.active && e.classList.add("active"), t.disabled && (e.disabled = !0), e.addEventListener("click", (o) => {
839
+ o.preventDefault(), this.setLastCommandTrigger(e, t.command), this.commandHandler && t.command && this.commandHandler(t.command);
840
+ }), e;
841
+ }
842
+ /**
843
+ * Create a toolbar button element
844
+ */
845
+ createButton(t) {
846
+ const e = document.createElement("button");
847
+ if (e.className = "editora-toolbar-button", e.type = "button", e.title = t.label, t.command && e.setAttribute("data-command", t.command), t.icon)
848
+ if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
849
+ const o = document.createElement("span");
850
+ o.className = "editora-toolbar-icon", o.innerHTML = t.icon, e.appendChild(o);
851
+ } else
852
+ e.innerHTML = t.icon;
853
+ else
854
+ e.textContent = t.label;
855
+ return t.active && e.classList.add("active"), t.disabled && (e.disabled = !0), e.addEventListener("click", (o) => {
856
+ o.preventDefault(), this.commandHandler && t.command && this.commandHandler(t.command);
857
+ }), e;
858
+ }
859
+ /**
860
+ * Create a dropdown element
861
+ */
862
+ createDropdown(t) {
863
+ const e = document.createElement("div");
864
+ e.className = "editora-toolbar-dropdown";
865
+ const o = document.createElement("button");
866
+ o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
867
+ const i = document.createElement("div");
868
+ i.className = "editora-toolbar-dropdown-menu", i.style.display = "none", t.options && t.options.forEach((c) => {
869
+ const p = document.createElement("button");
870
+ p.className = "editora-toolbar-dropdown-item", p.type = "button", p.textContent = c.label, p.setAttribute("data-value", c.value), p.addEventListener("click", (m) => {
871
+ m.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, c.value), i.style.display = "none";
872
+ }), i.appendChild(p);
873
+ }), o.addEventListener("click", (c) => {
874
+ c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command);
875
+ const p = i.style.display === "block";
876
+ i.style.display = p ? "none" : "block";
877
+ });
878
+ const r = (c) => {
879
+ e.contains(c.target) || (i.style.display = "none");
880
+ }, l = (c) => {
881
+ c.key === "Escape" && (i.style.display = "none");
882
+ };
883
+ return document.addEventListener("mousedown", r, !0), document.addEventListener("keydown", l), e._cleanupDropdown = () => {
884
+ document.removeEventListener("mousedown", r, !0), document.removeEventListener("keydown", l);
885
+ }, e.appendChild(o), e.appendChild(i), e;
886
+ }
887
+ /**
888
+ * Create an inline menu element (like dropdown but triggered by button click)
889
+ */
890
+ createInlineMenu(t) {
891
+ const e = document.createElement("div");
892
+ e.className = "editora-toolbar-dropdown editora-toolbar-inline-menu";
893
+ const o = document.createElement("button");
894
+ if (o.className = "editora-toolbar-button", o.type = "button", o.title = t.label, t.icon)
895
+ if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
896
+ const c = document.createElement("span");
897
+ c.className = "editora-toolbar-icon", c.innerHTML = t.icon, o.appendChild(c);
898
+ } else
899
+ o.innerHTML = t.icon;
900
+ else
901
+ o.textContent = t.label;
902
+ const i = document.createElement("div");
903
+ i.className = "editora-toolbar-dropdown-menu", i.style.display = "none", t.options && t.options.forEach((c) => {
904
+ const p = document.createElement("button");
905
+ p.className = "editora-toolbar-dropdown-item", p.type = "button", p.textContent = c.label, p.setAttribute("data-value", c.value), p.addEventListener("click", (m) => {
906
+ m.preventDefault(), m.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, c.value), i.style.display = "none";
907
+ }), i.appendChild(p);
908
+ }), o.addEventListener("click", (c) => {
909
+ var m;
910
+ c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command);
911
+ const p = (m = this.container) == null ? void 0 : m.querySelectorAll(
912
+ ".editora-toolbar-dropdown-menu"
913
+ );
914
+ p == null || p.forEach((E) => {
915
+ E !== i && (E.style.display = "none");
916
+ }), i.style.display = i.style.display === "none" ? "block" : "none";
917
+ });
918
+ const r = (c) => {
919
+ e.contains(c.target) || (i.style.display = "none");
920
+ }, l = (c) => {
921
+ c.key === "Escape" && (i.style.display = "none");
922
+ };
923
+ return document.addEventListener("mousedown", r, !0), document.addEventListener("keydown", l), e._cleanupDropdown = () => {
924
+ document.removeEventListener("mousedown", r, !0), document.removeEventListener("keydown", l);
925
+ }, e.appendChild(o), e.appendChild(i), e;
926
+ }
927
+ /**
928
+ * Get default toolbar string if none provided
929
+ */
930
+ getDefaultToolbarString() {
931
+ return this.getAvailableToolbarItems().map((e) => e.command).join(" ");
932
+ }
933
+ /**
934
+ * Update button state
935
+ */
936
+ updateButtonState(t, e) {
937
+ if (!this.container) return;
938
+ const o = this.container.querySelector(
939
+ `[data-command="${t}"]`
940
+ );
941
+ o && (e.active !== void 0 && o.classList.toggle("active", e.active), e.disabled !== void 0 && (o.disabled = e.disabled));
942
+ }
943
+ /**
944
+ * Destroy toolbar
945
+ */
946
+ destroy() {
947
+ var t;
948
+ this.container && (this.container.querySelectorAll(".editora-toolbar-dropdown").forEach((o) => {
949
+ const i = o._cleanupDropdown;
950
+ i && i();
951
+ }), this.container.innerHTML = ""), (t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = void 0, this.overflowRafId !== void 0 && cancelAnimationFrame(this.overflowRafId), document.removeEventListener("mousedown", this.onDocumentPointerDownForOverflow, !0), this.itemsContainer = void 0, this.moreButton = void 0, this.expandedRow = void 0, this.commandHandler = void 0;
952
+ }
953
+ }
954
+ class un {
955
+ constructor(t) {
956
+ this.visible = !1, this.config = t;
957
+ }
958
+ /**
959
+ * Create and mount floating toolbar
960
+ */
961
+ create(t) {
962
+ const e = document.createElement("div");
963
+ return e.className = "editora-floating-toolbar", e.style.display = "none", e.style.position = "absolute", e.style.zIndex = "1000", this.container = e, t.appendChild(e), e;
964
+ }
965
+ /**
966
+ * Show toolbar at position
967
+ */
968
+ show(t, e) {
969
+ this.container && (this.container.style.display = "block", this.container.style.left = `${t}px`, this.container.style.top = `${e}px`, this.visible = !0);
970
+ }
971
+ /**
972
+ * Hide toolbar
973
+ */
974
+ hide() {
975
+ this.container && (this.container.style.display = "none", this.visible = !1);
976
+ }
977
+ /**
978
+ * Update position
979
+ */
980
+ updatePosition(t, e) {
981
+ !this.container || !this.visible || (this.container.style.left = `${t}px`, this.container.style.top = `${e}px`);
982
+ }
983
+ /**
984
+ * Check if visible
985
+ */
986
+ isVisible() {
987
+ return this.visible;
988
+ }
989
+ /**
990
+ * Destroy floating toolbar
991
+ */
992
+ destroy() {
993
+ this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0, this.visible = !1;
994
+ }
995
+ }
996
+ class fn {
997
+ constructor(t = {}) {
998
+ this.statusInfo = {}, this.config = t;
999
+ }
1000
+ /**
1001
+ * Create and mount status bar
1002
+ */
1003
+ create(t) {
1004
+ const e = document.createElement("div");
1005
+ return e.className = "editora-statusbar", this.config.position && e.classList.add(`editora-statusbar-${this.config.position}`), this.container = e, t.appendChild(e), e;
1006
+ }
1007
+ /**
1008
+ * Update status information
1009
+ */
1010
+ update(t) {
1011
+ this.statusInfo = { ...this.statusInfo, ...t }, this.render();
1012
+ }
1013
+ /**
1014
+ * Render status bar content
1015
+ */
1016
+ render() {
1017
+ if (!this.container) return;
1018
+ this.container.innerHTML = "";
1019
+ const t = document.createElement("div");
1020
+ t.className = "editora-statusbar-left";
1021
+ const e = document.createElement("div");
1022
+ e.className = "editora-statusbar-right";
1023
+ const o = [];
1024
+ if (this.statusInfo.selectionInfo) {
1025
+ const r = this.statusInfo.selectionInfo;
1026
+ r.startLine === r.endLine && r.startColumn === r.endColumn ? o.push(`Ln ${r.startLine}, Col ${r.startColumn}`) : (r.startLine === r.endLine ? o.push(`Ln ${r.startLine}, Col ${r.startColumn}-${r.endColumn}`) : o.push(`Ln ${r.startLine}:${r.startColumn} - ${r.endLine}:${r.endColumn}`), o.push(`${r.selectedChars} chars selected`));
1027
+ } else if (this.statusInfo.cursorPosition) {
1028
+ const r = this.statusInfo.cursorPosition;
1029
+ o.push(`Ln ${r.line}, Col ${r.column}`);
1030
+ }
1031
+ this.statusInfo.language && o.push(this.statusInfo.language);
1032
+ const i = [];
1033
+ this.statusInfo.wordCount !== void 0 && i.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && i.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && i.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([r, l]) => {
1034
+ i.push(`${r}: ${l}`);
1035
+ }), o.forEach((r, l) => {
1036
+ const c = document.createElement("span");
1037
+ if (c.className = "editora-statusbar-item", c.textContent = r, t.appendChild(c), l < o.length - 1) {
1038
+ const p = document.createElement("span");
1039
+ p.className = "editora-statusbar-separator", p.textContent = "|", t.appendChild(p);
1040
+ }
1041
+ }), i.forEach((r, l) => {
1042
+ const c = document.createElement("span");
1043
+ if (c.className = "editora-statusbar-item", c.textContent = r, e.appendChild(c), l < i.length - 1) {
1044
+ const p = document.createElement("span");
1045
+ p.className = "editora-statusbar-separator", p.textContent = "|", e.appendChild(p);
1046
+ }
1047
+ }), this.container.appendChild(t), this.container.appendChild(e);
1048
+ }
1049
+ /**
1050
+ * Destroy status bar
1051
+ */
1052
+ destroy() {
1053
+ this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
1054
+ }
1055
+ }
1056
+ function pn(s, t) {
1057
+ const e = s.textContent || "", o = hn(s, t.startContainer, t.startOffset), r = e.substring(0, o).split(`
1058
+ `), l = r.length, c = r[r.length - 1].length + 1;
1059
+ return { line: l, column: c };
1060
+ }
1061
+ function hn(s, t, e) {
1062
+ var l;
1063
+ let o = 0;
1064
+ const i = document.createTreeWalker(
1065
+ s,
1066
+ NodeFilter.SHOW_TEXT,
1067
+ null
1068
+ );
1069
+ let r = i.firstChild();
1070
+ for (; r; ) {
1071
+ if (r === t) {
1072
+ o += e;
1073
+ break;
1074
+ } else r.nodeType === Node.TEXT_NODE && (o += ((l = r.textContent) == null ? void 0 : l.length) || 0);
1075
+ r = i.nextNode();
1076
+ }
1077
+ return o;
1078
+ }
1079
+ function mn(s) {
1080
+ var o, i;
1081
+ const t = s.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
1082
+ let e = 1;
1083
+ if (t.length > 0) {
1084
+ e = t.length;
1085
+ const r = t[t.length - 1];
1086
+ (r.tagName === "BR" || ((o = r.innerHTML) == null ? void 0 : o.trim()) === "" || ((i = r.textContent) == null ? void 0 : i.trim()) === "") && e++;
1087
+ } else {
1088
+ const l = (s.textContent || "").split(`
1089
+ `).length;
1090
+ e = Math.max(1, l);
1091
+ }
1092
+ return e;
1093
+ }
1094
+ function gn(s) {
1095
+ const t = s.trim() ? s.trim().split(/\s+/).length : 0, e = s.length;
1096
+ return { words: t, chars: e };
1097
+ }
1098
+ function bn(s, t) {
1099
+ const e = s.toString();
1100
+ return {
1101
+ startLine: t.line,
1102
+ startColumn: t.column,
1103
+ endLine: t.line,
1104
+ // For now, assuming single line selections
1105
+ endColumn: t.column + e.length,
1106
+ selectedChars: e.length,
1107
+ selectedWords: e.trim().split(/\s+/).filter(Boolean).length
1108
+ };
1109
+ }
1110
+ function no(s, t) {
1111
+ (t == null || t > s.length) && (t = s.length);
1112
+ for (var e = 0, o = Array(t); e < t; e++) o[e] = s[e];
1113
+ return o;
1114
+ }
1115
+ function yn(s) {
1116
+ if (Array.isArray(s)) return s;
1117
+ }
1118
+ function vn(s, t) {
1119
+ var e = s == null ? null : typeof Symbol != "undefined" && s[Symbol.iterator] || s["@@iterator"];
1120
+ if (e != null) {
1121
+ var o, i, r, l, c = [], p = !0, m = !1;
1122
+ try {
1123
+ if (r = (e = e.call(s)).next, t !== 0) for (; !(p = (o = r.call(e)).done) && (c.push(o.value), c.length !== t); p = !0) ;
1124
+ } catch (E) {
1125
+ m = !0, i = E;
1126
+ } finally {
1127
+ try {
1128
+ if (!p && e.return != null && (l = e.return(), Object(l) !== l)) return;
1129
+ } finally {
1130
+ if (m) throw i;
1131
+ }
1132
+ }
1133
+ return c;
1134
+ }
1135
+ }
1136
+ function En() {
1137
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1138
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1139
+ }
1140
+ function wn(s, t) {
1141
+ return yn(s) || vn(s, t) || Tn(s, t) || En();
1142
+ }
1143
+ function Tn(s, t) {
1144
+ if (s) {
1145
+ if (typeof s == "string") return no(s, t);
1146
+ var e = {}.toString.call(s).slice(8, -1);
1147
+ return e === "Object" && s.constructor && (e = s.constructor.name), e === "Map" || e === "Set" ? Array.from(s) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? no(s, t) : void 0;
1148
+ }
1149
+ }
1150
+ const xo = Object.entries, io = Object.setPrototypeOf, kn = Object.isFrozen, xn = Object.getPrototypeOf, An = Object.getOwnPropertyDescriptor;
1151
+ let M = Object.freeze, I = Object.seal, mt = Object.create, Ao = typeof Reflect != "undefined" && Reflect, Ee = Ao.apply, we = Ao.construct;
1152
+ M || (M = function(t) {
1153
+ return t;
1154
+ });
1155
+ I || (I = function(t) {
1156
+ return t;
1157
+ });
1158
+ Ee || (Ee = function(t, e) {
1159
+ for (var o = arguments.length, i = new Array(o > 2 ? o - 2 : 0), r = 2; r < o; r++) i[r - 2] = arguments[r];
1160
+ return t.apply(e, i);
1161
+ });
1162
+ we || (we = function(t) {
1163
+ for (var e = arguments.length, o = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) o[i - 1] = arguments[i];
1164
+ return new t(...o);
1165
+ });
1166
+ const it = L(Array.prototype.forEach), Cn = L(Array.prototype.lastIndexOf), ro = L(Array.prototype.pop), kt = L(Array.prototype.push), Sn = L(Array.prototype.splice), bt = Array.isArray, St = L(String.prototype.toLowerCase), fe = L(String.prototype.toString), ao = L(String.prototype.match), xt = L(String.prototype.replace), so = L(String.prototype.indexOf), _n = L(String.prototype.trim), Ln = L(Number.prototype.toString), Mn = L(Boolean.prototype.toString), lo = typeof BigInt == "undefined" ? null : L(BigInt.prototype.toString), co = typeof Symbol == "undefined" ? null : L(Symbol.prototype.toString), z = L(Object.prototype.hasOwnProperty), At = L(Object.prototype.toString), O = L(RegExp.prototype.test), X = In(TypeError);
1167
+ function L(s) {
1168
+ return function(t) {
1169
+ t instanceof RegExp && (t.lastIndex = 0);
1170
+ for (var e = arguments.length, o = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) o[i - 1] = arguments[i];
1171
+ return Ee(s, t, o);
1172
+ };
1173
+ }
1174
+ function In(s) {
1175
+ return function() {
1176
+ for (var t = arguments.length, e = new Array(t), o = 0; o < t; o++) e[o] = arguments[o];
1177
+ return we(s, e);
1178
+ };
1179
+ }
1180
+ function y(s, t) {
1181
+ let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : St;
1182
+ if (io && io(s, null), !bt(t)) return s;
1183
+ let o = t.length;
1184
+ for (; o--; ) {
1185
+ let i = t[o];
1186
+ if (typeof i == "string") {
1187
+ const r = e(i);
1188
+ r !== i && (kn(t) || (t[o] = r), i = r);
1189
+ }
1190
+ s[i] = !0;
1191
+ }
1192
+ return s;
1193
+ }
1194
+ function On(s) {
1195
+ for (let t = 0; t < s.length; t++) z(s, t) || (s[t] = null);
1196
+ return s;
1197
+ }
1198
+ function H(s) {
1199
+ const t = mt(null);
1200
+ for (const o of xo(s)) {
1201
+ var e = wn(o, 2);
1202
+ const i = e[0], r = e[1];
1203
+ z(s, i) && (bt(r) ? t[i] = On(r) : r && typeof r == "object" && r.constructor === Object ? t[i] = H(r) : t[i] = r);
1204
+ }
1205
+ return t;
1206
+ }
1207
+ function Dn(s) {
1208
+ switch (typeof s) {
1209
+ case "string":
1210
+ return s;
1211
+ case "number":
1212
+ return Ln(s);
1213
+ case "boolean":
1214
+ return Mn(s);
1215
+ case "bigint":
1216
+ return lo ? lo(s) : "0";
1217
+ case "symbol":
1218
+ return co ? co(s) : "Symbol()";
1219
+ case "undefined":
1220
+ return At(s);
1221
+ case "function":
1222
+ case "object": {
1223
+ if (s === null) return At(s);
1224
+ const t = s, e = j(t, "toString");
1225
+ if (typeof e == "function") {
1226
+ const o = e(t);
1227
+ return typeof o == "string" ? o : At(o);
1228
+ }
1229
+ return At(s);
1230
+ }
1231
+ default:
1232
+ return At(s);
1233
+ }
1234
+ }
1235
+ function j(s, t) {
1236
+ for (; s !== null; ) {
1237
+ const o = An(s, t);
1238
+ if (o) {
1239
+ if (o.get) return L(o.get);
1240
+ if (typeof o.value == "function") return L(o.value);
1241
+ }
1242
+ s = xn(s);
1243
+ }
1244
+ function e() {
1245
+ return null;
1246
+ }
1247
+ return e;
1248
+ }
1249
+ function Rn(s) {
1250
+ try {
1251
+ return O(s, ""), !0;
1252
+ } catch (t) {
1253
+ return !1;
1254
+ }
1255
+ }
1256
+ const uo = M([
1257
+ "a",
1258
+ "abbr",
1259
+ "acronym",
1260
+ "address",
1261
+ "area",
1262
+ "article",
1263
+ "aside",
1264
+ "audio",
1265
+ "b",
1266
+ "bdi",
1267
+ "bdo",
1268
+ "big",
1269
+ "blink",
1270
+ "blockquote",
1271
+ "body",
1272
+ "br",
1273
+ "button",
1274
+ "canvas",
1275
+ "caption",
1276
+ "center",
1277
+ "cite",
1278
+ "code",
1279
+ "col",
1280
+ "colgroup",
1281
+ "content",
1282
+ "data",
1283
+ "datalist",
1284
+ "dd",
1285
+ "decorator",
1286
+ "del",
1287
+ "details",
1288
+ "dfn",
1289
+ "dialog",
1290
+ "dir",
1291
+ "div",
1292
+ "dl",
1293
+ "dt",
1294
+ "element",
1295
+ "em",
1296
+ "fieldset",
1297
+ "figcaption",
1298
+ "figure",
1299
+ "font",
1300
+ "footer",
1301
+ "form",
1302
+ "h1",
1303
+ "h2",
1304
+ "h3",
1305
+ "h4",
1306
+ "h5",
1307
+ "h6",
1308
+ "head",
1309
+ "header",
1310
+ "hgroup",
1311
+ "hr",
1312
+ "html",
1313
+ "i",
1314
+ "img",
1315
+ "input",
1316
+ "ins",
1317
+ "kbd",
1318
+ "label",
1319
+ "legend",
1320
+ "li",
1321
+ "main",
1322
+ "map",
1323
+ "mark",
1324
+ "marquee",
1325
+ "menu",
1326
+ "menuitem",
1327
+ "meter",
1328
+ "nav",
1329
+ "nobr",
1330
+ "ol",
1331
+ "optgroup",
1332
+ "option",
1333
+ "output",
1334
+ "p",
1335
+ "picture",
1336
+ "pre",
1337
+ "progress",
1338
+ "q",
1339
+ "rp",
1340
+ "rt",
1341
+ "ruby",
1342
+ "s",
1343
+ "samp",
1344
+ "search",
1345
+ "section",
1346
+ "select",
1347
+ "shadow",
1348
+ "slot",
1349
+ "small",
1350
+ "source",
1351
+ "spacer",
1352
+ "span",
1353
+ "strike",
1354
+ "strong",
1355
+ "style",
1356
+ "sub",
1357
+ "summary",
1358
+ "sup",
1359
+ "table",
1360
+ "tbody",
1361
+ "td",
1362
+ "template",
1363
+ "textarea",
1364
+ "tfoot",
1365
+ "th",
1366
+ "thead",
1367
+ "time",
1368
+ "tr",
1369
+ "track",
1370
+ "tt",
1371
+ "u",
1372
+ "ul",
1373
+ "var",
1374
+ "video",
1375
+ "wbr"
1376
+ ]), pe = M([
1377
+ "svg",
1378
+ "a",
1379
+ "altglyph",
1380
+ "altglyphdef",
1381
+ "altglyphitem",
1382
+ "animatecolor",
1383
+ "animatemotion",
1384
+ "animatetransform",
1385
+ "circle",
1386
+ "clippath",
1387
+ "defs",
1388
+ "desc",
1389
+ "ellipse",
1390
+ "enterkeyhint",
1391
+ "exportparts",
1392
+ "filter",
1393
+ "font",
1394
+ "g",
1395
+ "glyph",
1396
+ "glyphref",
1397
+ "hkern",
1398
+ "image",
1399
+ "inputmode",
1400
+ "line",
1401
+ "lineargradient",
1402
+ "marker",
1403
+ "mask",
1404
+ "metadata",
1405
+ "mpath",
1406
+ "part",
1407
+ "path",
1408
+ "pattern",
1409
+ "polygon",
1410
+ "polyline",
1411
+ "radialgradient",
1412
+ "rect",
1413
+ "stop",
1414
+ "style",
1415
+ "switch",
1416
+ "symbol",
1417
+ "text",
1418
+ "textpath",
1419
+ "title",
1420
+ "tref",
1421
+ "tspan",
1422
+ "view",
1423
+ "vkern"
1424
+ ]), he = M([
1425
+ "feBlend",
1426
+ "feColorMatrix",
1427
+ "feComponentTransfer",
1428
+ "feComposite",
1429
+ "feConvolveMatrix",
1430
+ "feDiffuseLighting",
1431
+ "feDisplacementMap",
1432
+ "feDistantLight",
1433
+ "feDropShadow",
1434
+ "feFlood",
1435
+ "feFuncA",
1436
+ "feFuncB",
1437
+ "feFuncG",
1438
+ "feFuncR",
1439
+ "feGaussianBlur",
1440
+ "feImage",
1441
+ "feMerge",
1442
+ "feMergeNode",
1443
+ "feMorphology",
1444
+ "feOffset",
1445
+ "fePointLight",
1446
+ "feSpecularLighting",
1447
+ "feSpotLight",
1448
+ "feTile",
1449
+ "feTurbulence"
1450
+ ]), Nn = M([
1451
+ "animate",
1452
+ "color-profile",
1453
+ "cursor",
1454
+ "discard",
1455
+ "font-face",
1456
+ "font-face-format",
1457
+ "font-face-name",
1458
+ "font-face-src",
1459
+ "font-face-uri",
1460
+ "foreignobject",
1461
+ "hatch",
1462
+ "hatchpath",
1463
+ "mesh",
1464
+ "meshgradient",
1465
+ "meshpatch",
1466
+ "meshrow",
1467
+ "missing-glyph",
1468
+ "script",
1469
+ "set",
1470
+ "solidcolor",
1471
+ "unknown",
1472
+ "use"
1473
+ ]), me = M([
1474
+ "math",
1475
+ "menclose",
1476
+ "merror",
1477
+ "mfenced",
1478
+ "mfrac",
1479
+ "mglyph",
1480
+ "mi",
1481
+ "mlabeledtr",
1482
+ "mmultiscripts",
1483
+ "mn",
1484
+ "mo",
1485
+ "mover",
1486
+ "mpadded",
1487
+ "mphantom",
1488
+ "mroot",
1489
+ "mrow",
1490
+ "ms",
1491
+ "mspace",
1492
+ "msqrt",
1493
+ "mstyle",
1494
+ "msub",
1495
+ "msup",
1496
+ "msubsup",
1497
+ "mtable",
1498
+ "mtd",
1499
+ "mtext",
1500
+ "mtr",
1501
+ "munder",
1502
+ "munderover",
1503
+ "mprescripts"
1504
+ ]), Pn = M([
1505
+ "maction",
1506
+ "maligngroup",
1507
+ "malignmark",
1508
+ "mlongdiv",
1509
+ "mscarries",
1510
+ "mscarry",
1511
+ "msgroup",
1512
+ "mstack",
1513
+ "msline",
1514
+ "msrow",
1515
+ "semantics",
1516
+ "annotation",
1517
+ "annotation-xml",
1518
+ "mprescripts",
1519
+ "none"
1520
+ ]), fo = M(["#text"]), po = M([
1521
+ "accept",
1522
+ "action",
1523
+ "align",
1524
+ "alt",
1525
+ "autocapitalize",
1526
+ "autocomplete",
1527
+ "autopictureinpicture",
1528
+ "autoplay",
1529
+ "background",
1530
+ "bgcolor",
1531
+ "border",
1532
+ "capture",
1533
+ "cellpadding",
1534
+ "cellspacing",
1535
+ "checked",
1536
+ "cite",
1537
+ "class",
1538
+ "clear",
1539
+ "color",
1540
+ "cols",
1541
+ "colspan",
1542
+ "command",
1543
+ "commandfor",
1544
+ "controls",
1545
+ "controlslist",
1546
+ "coords",
1547
+ "crossorigin",
1548
+ "datetime",
1549
+ "decoding",
1550
+ "default",
1551
+ "dir",
1552
+ "disabled",
1553
+ "disablepictureinpicture",
1554
+ "disableremoteplayback",
1555
+ "download",
1556
+ "draggable",
1557
+ "enctype",
1558
+ "enterkeyhint",
1559
+ "exportparts",
1560
+ "face",
1561
+ "for",
1562
+ "headers",
1563
+ "height",
1564
+ "hidden",
1565
+ "high",
1566
+ "href",
1567
+ "hreflang",
1568
+ "id",
1569
+ "inert",
1570
+ "inputmode",
1571
+ "integrity",
1572
+ "ismap",
1573
+ "kind",
1574
+ "label",
1575
+ "lang",
1576
+ "list",
1577
+ "loading",
1578
+ "loop",
1579
+ "low",
1580
+ "max",
1581
+ "maxlength",
1582
+ "media",
1583
+ "method",
1584
+ "min",
1585
+ "minlength",
1586
+ "multiple",
1587
+ "muted",
1588
+ "name",
1589
+ "nonce",
1590
+ "noshade",
1591
+ "novalidate",
1592
+ "nowrap",
1593
+ "open",
1594
+ "optimum",
1595
+ "part",
1596
+ "pattern",
1597
+ "placeholder",
1598
+ "playsinline",
1599
+ "popover",
1600
+ "popovertarget",
1601
+ "popovertargetaction",
1602
+ "poster",
1603
+ "preload",
1604
+ "pubdate",
1605
+ "radiogroup",
1606
+ "readonly",
1607
+ "rel",
1608
+ "required",
1609
+ "rev",
1610
+ "reversed",
1611
+ "role",
1612
+ "rows",
1613
+ "rowspan",
1614
+ "spellcheck",
1615
+ "scope",
1616
+ "selected",
1617
+ "shape",
1618
+ "size",
1619
+ "sizes",
1620
+ "slot",
1621
+ "span",
1622
+ "srclang",
1623
+ "start",
1624
+ "src",
1625
+ "srcset",
1626
+ "step",
1627
+ "style",
1628
+ "summary",
1629
+ "tabindex",
1630
+ "title",
1631
+ "translate",
1632
+ "type",
1633
+ "usemap",
1634
+ "valign",
1635
+ "value",
1636
+ "width",
1637
+ "wrap",
1638
+ "xmlns"
1639
+ ]), ge = M([
1640
+ "accent-height",
1641
+ "accumulate",
1642
+ "additive",
1643
+ "alignment-baseline",
1644
+ "amplitude",
1645
+ "ascent",
1646
+ "attributename",
1647
+ "attributetype",
1648
+ "azimuth",
1649
+ "basefrequency",
1650
+ "baseline-shift",
1651
+ "begin",
1652
+ "bias",
1653
+ "by",
1654
+ "class",
1655
+ "clip",
1656
+ "clippathunits",
1657
+ "clip-path",
1658
+ "clip-rule",
1659
+ "color",
1660
+ "color-interpolation",
1661
+ "color-interpolation-filters",
1662
+ "color-profile",
1663
+ "color-rendering",
1664
+ "cx",
1665
+ "cy",
1666
+ "d",
1667
+ "dx",
1668
+ "dy",
1669
+ "diffuseconstant",
1670
+ "direction",
1671
+ "display",
1672
+ "divisor",
1673
+ "dominant-baseline",
1674
+ "dur",
1675
+ "edgemode",
1676
+ "elevation",
1677
+ "end",
1678
+ "exponent",
1679
+ "fill",
1680
+ "fill-opacity",
1681
+ "fill-rule",
1682
+ "filter",
1683
+ "filterunits",
1684
+ "flood-color",
1685
+ "flood-opacity",
1686
+ "font-family",
1687
+ "font-size",
1688
+ "font-size-adjust",
1689
+ "font-stretch",
1690
+ "font-style",
1691
+ "font-variant",
1692
+ "font-weight",
1693
+ "fx",
1694
+ "fy",
1695
+ "g1",
1696
+ "g2",
1697
+ "glyph-name",
1698
+ "glyphref",
1699
+ "gradientunits",
1700
+ "gradienttransform",
1701
+ "height",
1702
+ "href",
1703
+ "id",
1704
+ "image-rendering",
1705
+ "in",
1706
+ "in2",
1707
+ "intercept",
1708
+ "k",
1709
+ "k1",
1710
+ "k2",
1711
+ "k3",
1712
+ "k4",
1713
+ "kerning",
1714
+ "keypoints",
1715
+ "keysplines",
1716
+ "keytimes",
1717
+ "lang",
1718
+ "lengthadjust",
1719
+ "letter-spacing",
1720
+ "kernelmatrix",
1721
+ "kernelunitlength",
1722
+ "lighting-color",
1723
+ "local",
1724
+ "marker-end",
1725
+ "marker-mid",
1726
+ "marker-start",
1727
+ "markerheight",
1728
+ "markerunits",
1729
+ "markerwidth",
1730
+ "maskcontentunits",
1731
+ "maskunits",
1732
+ "max",
1733
+ "mask",
1734
+ "mask-type",
1735
+ "media",
1736
+ "method",
1737
+ "mode",
1738
+ "min",
1739
+ "name",
1740
+ "numoctaves",
1741
+ "offset",
1742
+ "operator",
1743
+ "opacity",
1744
+ "order",
1745
+ "orient",
1746
+ "orientation",
1747
+ "origin",
1748
+ "overflow",
1749
+ "paint-order",
1750
+ "path",
1751
+ "pathlength",
1752
+ "patterncontentunits",
1753
+ "patterntransform",
1754
+ "patternunits",
1755
+ "pointer-events",
1756
+ "points",
1757
+ "preservealpha",
1758
+ "preserveaspectratio",
1759
+ "primitiveunits",
1760
+ "r",
1761
+ "rx",
1762
+ "ry",
1763
+ "radius",
1764
+ "refx",
1765
+ "refy",
1766
+ "repeatcount",
1767
+ "repeatdur",
1768
+ "restart",
1769
+ "result",
1770
+ "rotate",
1771
+ "scale",
1772
+ "seed",
1773
+ "shape-rendering",
1774
+ "slope",
1775
+ "specularconstant",
1776
+ "specularexponent",
1777
+ "spreadmethod",
1778
+ "startoffset",
1779
+ "stddeviation",
1780
+ "stitchtiles",
1781
+ "stop-color",
1782
+ "stop-opacity",
1783
+ "stroke-dasharray",
1784
+ "stroke-dashoffset",
1785
+ "stroke-linecap",
1786
+ "stroke-linejoin",
1787
+ "stroke-miterlimit",
1788
+ "stroke-opacity",
1789
+ "stroke",
1790
+ "stroke-width",
1791
+ "style",
1792
+ "surfacescale",
1793
+ "systemlanguage",
1794
+ "tabindex",
1795
+ "tablevalues",
1796
+ "targetx",
1797
+ "targety",
1798
+ "transform",
1799
+ "transform-origin",
1800
+ "text-anchor",
1801
+ "text-decoration",
1802
+ "text-orientation",
1803
+ "text-rendering",
1804
+ "textlength",
1805
+ "type",
1806
+ "u1",
1807
+ "u2",
1808
+ "unicode",
1809
+ "values",
1810
+ "vector-effect",
1811
+ "viewbox",
1812
+ "visibility",
1813
+ "version",
1814
+ "vert-adv-y",
1815
+ "vert-origin-x",
1816
+ "vert-origin-y",
1817
+ "width",
1818
+ "word-spacing",
1819
+ "wrap",
1820
+ "writing-mode",
1821
+ "xchannelselector",
1822
+ "ychannelselector",
1823
+ "x",
1824
+ "x1",
1825
+ "x2",
1826
+ "xmlns",
1827
+ "y",
1828
+ "y1",
1829
+ "y2",
1830
+ "z",
1831
+ "zoomandpan"
1832
+ ]), ho = M([
1833
+ "accent",
1834
+ "accentunder",
1835
+ "align",
1836
+ "bevelled",
1837
+ "close",
1838
+ "columnalign",
1839
+ "columnlines",
1840
+ "columnspacing",
1841
+ "columnspan",
1842
+ "denomalign",
1843
+ "depth",
1844
+ "dir",
1845
+ "display",
1846
+ "displaystyle",
1847
+ "encoding",
1848
+ "fence",
1849
+ "frame",
1850
+ "height",
1851
+ "href",
1852
+ "id",
1853
+ "largeop",
1854
+ "length",
1855
+ "linethickness",
1856
+ "lquote",
1857
+ "lspace",
1858
+ "mathbackground",
1859
+ "mathcolor",
1860
+ "mathsize",
1861
+ "mathvariant",
1862
+ "maxsize",
1863
+ "minsize",
1864
+ "movablelimits",
1865
+ "notation",
1866
+ "numalign",
1867
+ "open",
1868
+ "rowalign",
1869
+ "rowlines",
1870
+ "rowspacing",
1871
+ "rowspan",
1872
+ "rspace",
1873
+ "rquote",
1874
+ "scriptlevel",
1875
+ "scriptminsize",
1876
+ "scriptsizemultiplier",
1877
+ "selection",
1878
+ "separator",
1879
+ "separators",
1880
+ "stretchy",
1881
+ "subscriptshift",
1882
+ "supscriptshift",
1883
+ "symmetric",
1884
+ "voffset",
1885
+ "width",
1886
+ "xmlns"
1887
+ ]), jt = M([
1888
+ "xlink:href",
1889
+ "xml:id",
1890
+ "xlink:title",
1891
+ "xml:space",
1892
+ "xmlns:xlink"
1893
+ ]), zn = I(/{{[\w\W]*|^[\w\W]*}}/g), Bn = I(/<%[\w\W]*|^[\w\W]*%>/g), Fn = I(/\${[\w\W]*/g), Hn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), Un = I(/^aria-[\-\w]+$/), mo = I(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), jn = I(/^(?:\w+script|data):/i), Wn = I(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), $n = I(/^html$/i), Gn = I(/^[a-z][.\w]*(-[.\w]+)+$/i), go = I(/<[/\w!]/g), bo = I(/<[/\w]/g), Kn = I(/<\/no(script|embed|frames)/i), Yn = I(/\/>/i), F = {
1894
+ element: 1,
1895
+ attribute: 2,
1896
+ text: 3,
1897
+ cdataSection: 4,
1898
+ entityReference: 5,
1899
+ entityNode: 6,
1900
+ processingInstruction: 7,
1901
+ comment: 8,
1902
+ document: 9,
1903
+ documentType: 10,
1904
+ documentFragment: 11,
1905
+ notation: 12
1906
+ }, Co = [
1907
+ "style",
1908
+ "script",
1909
+ "xmp",
1910
+ "iframe",
1911
+ "noembed",
1912
+ "noframes",
1913
+ "plaintext",
1914
+ "noscript"
1915
+ ], qn = M(y({}, Co)), Vn = (function() {
1916
+ const s = {};
1917
+ return it(Co, (t) => {
1918
+ s[t] = I(new RegExp("</" + t + "(?=[\\t\\n\\f\\r />])", "i"));
1919
+ }), M(s);
1920
+ })(), Xn = function() {
1921
+ return typeof window == "undefined" ? null : window;
1922
+ }, Zn = function(t, e) {
1923
+ if (typeof t != "object" || typeof t.createPolicy != "function") return null;
1924
+ let o = null;
1925
+ const i = "data-tt-policy-suffix";
1926
+ e && e.hasAttribute(i) && (o = e.getAttribute(i));
1927
+ const r = "dompurify" + (o ? "#" + o : "");
1928
+ try {
1929
+ return t.createPolicy(r, {
1930
+ createHTML(l) {
1931
+ return l;
1932
+ },
1933
+ createScriptURL(l) {
1934
+ return l;
1935
+ }
1936
+ });
1937
+ } catch (l) {
1938
+ return console.warn("TrustedTypes policy " + r + " could not be created."), null;
1939
+ }
1940
+ }, yo = function() {
1941
+ return {
1942
+ afterSanitizeAttributes: [],
1943
+ afterSanitizeElements: [],
1944
+ afterSanitizeShadowDOM: [],
1945
+ beforeSanitizeAttributes: [],
1946
+ beforeSanitizeElements: [],
1947
+ beforeSanitizeShadowDOM: [],
1948
+ uponSanitizeAttribute: [],
1949
+ uponSanitizeElement: [],
1950
+ uponSanitizeShadowNode: []
1951
+ };
1952
+ }, Z = function(t, e, o, i) {
1953
+ return z(t, e) && bt(t[e]) ? y(i.base ? H(i.base) : {}, t[e], i.transform) : o;
1954
+ }, be = function(t, e, o) {
1955
+ const i = z(t, e) ? t[e] : void 0;
1956
+ return i && typeof i == "object" ? H(i) : o();
1957
+ };
1958
+ function So() {
1959
+ let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Xn();
1960
+ const t = (u) => So(u);
1961
+ if (t.version = "3.4.16", t.removed = [], !s || !s.document || s.document.nodeType !== F.document || !s.Element)
1962
+ return t.isSupported = !1, t;
1963
+ let e = s.document;
1964
+ const o = e, i = o.currentScript;
1965
+ s.DocumentFragment;
1966
+ const r = s.HTMLTemplateElement, l = s.Node, c = s.Element, p = s.NodeFilter;
1967
+ s.NamedNodeMap === void 0 && (s.NamedNodeMap || s.MozNamedAttrMap), s.HTMLFormElement;
1968
+ const m = s.DOMParser, E = s.trustedTypes, A = c.prototype, C = j(A, "cloneNode"), w = j(A, "remove"), v = j(A, "removeAttributeNode"), K = j(A, "nextSibling"), D = j(A, "childNodes"), N = j(A, "parentNode"), xe = j(A, "shadowRoot"), Yt = j(A, "attributes"), Q = l && l.prototype ? j(l.prototype, "nodeType") : null, rt = l && l.prototype ? j(l.prototype, "nodeName") : null, _t = l && l.prototype ? j(l.prototype, "ownerDocument") : null, yt = function(n) {
1969
+ return Q ? Q(n) : n.nodeType;
1970
+ }, qt = function(n) {
1971
+ return rt ? rt(n) : n.nodeName;
1972
+ };
1973
+ if (typeof r == "function") {
1974
+ const u = e.createElement("template");
1975
+ u.content && u.content.ownerDocument && (e = u.content.ownerDocument);
1976
+ }
1977
+ let P, tt = "", Vt, Ae = !1, vt = 0;
1978
+ const Ce = function() {
1979
+ if (vt > 0) throw X('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
1980
+ }, at = function(n) {
1981
+ Ce(), vt++;
1982
+ try {
1983
+ return P.createHTML(n);
1984
+ } finally {
1985
+ vt--;
1986
+ }
1987
+ }, Mo = function(n) {
1988
+ Ce(), vt++;
1989
+ try {
1990
+ return P.createScriptURL(n);
1991
+ } finally {
1992
+ vt--;
1993
+ }
1994
+ }, Io = function() {
1995
+ return Ae || (Vt = Zn(E, i), Ae = !0), Vt;
1996
+ }, Lt = e, Xt = Lt.implementation, Se = Lt.createNodeIterator, Oo = Lt.createDocumentFragment, Do = Lt.getElementsByTagName, Ro = o.importNode;
1997
+ let T = yo();
1998
+ t.isSupported = typeof xo == "function" && typeof N == "function" && Xt && Xt.createHTMLDocument !== void 0;
1999
+ const No = zn, Po = Bn, zo = Fn, Bo = Hn, Fo = Un, Ho = jn, _e = Wn, Uo = Gn;
2000
+ let Le = mo, k = null;
2001
+ const Zt = y({}, [
2002
+ ...uo,
2003
+ ...pe,
2004
+ ...he,
2005
+ ...me,
2006
+ ...fo
2007
+ ]);
2008
+ let x = null;
2009
+ const Jt = y({}, [
2010
+ ...po,
2011
+ ...ge,
2012
+ ...ho,
2013
+ ...jt
2014
+ ]);
2015
+ let W = Object.seal(mt(null, {
2016
+ tagNameCheck: {
2017
+ writable: !0,
2018
+ configurable: !1,
2019
+ enumerable: !0,
2020
+ value: null
2021
+ },
2022
+ attributeNameCheck: {
2023
+ writable: !0,
2024
+ configurable: !1,
2025
+ enumerable: !0,
2026
+ value: null
2027
+ },
2028
+ allowCustomizedBuiltInElements: {
2029
+ writable: !0,
2030
+ configurable: !1,
2031
+ enumerable: !0,
2032
+ value: !1
2033
+ }
2034
+ })), Et = null, Me = null;
2035
+ const Y = Object.seal(mt(null, {
2036
+ tagCheck: {
2037
+ writable: !0,
2038
+ configurable: !1,
2039
+ enumerable: !0,
2040
+ value: null
2041
+ },
2042
+ attributeCheck: {
2043
+ writable: !0,
2044
+ configurable: !1,
2045
+ enumerable: !0,
2046
+ value: null
2047
+ }
2048
+ }));
2049
+ let Ie = !0, Qt = !0, Oe = !1, De = !0, q = !1, et = !0, ot = !1, te = !1, Mt = null, It = null, ee = !1, st = !1, Ot = !1, Dt = !1, Re = !0, Ne = !1;
2050
+ const Pe = "user-content-";
2051
+ let oe = !0, ne = !1, lt = {}, ct = null;
2052
+ const ze = y({}, [
2053
+ "annotation-xml",
2054
+ "audio",
2055
+ "colgroup",
2056
+ "desc",
2057
+ "foreignobject",
2058
+ "head",
2059
+ "iframe",
2060
+ "math",
2061
+ "mi",
2062
+ "mn",
2063
+ "mo",
2064
+ "ms",
2065
+ "mtext",
2066
+ "noembed",
2067
+ "noframes",
2068
+ "noscript",
2069
+ "plaintext",
2070
+ "script",
2071
+ "selectedcontent",
2072
+ "style",
2073
+ "svg",
2074
+ "template",
2075
+ "thead",
2076
+ "title",
2077
+ "video",
2078
+ "xmp"
2079
+ ]);
2080
+ let Be = null;
2081
+ const Fe = y({}, [
2082
+ "audio",
2083
+ "video",
2084
+ "img",
2085
+ "source",
2086
+ "image",
2087
+ "track"
2088
+ ]);
2089
+ let He = null;
2090
+ const Ue = y({}, [
2091
+ "alt",
2092
+ "class",
2093
+ "for",
2094
+ "id",
2095
+ "label",
2096
+ "name",
2097
+ "pattern",
2098
+ "placeholder",
2099
+ "role",
2100
+ "summary",
2101
+ "title",
2102
+ "value",
2103
+ "style",
2104
+ "xmlns"
2105
+ ]), Rt = "http://www.w3.org/1998/Math/MathML", Nt = "http://www.w3.org/2000/svg", $ = "http://www.w3.org/1999/xhtml";
2106
+ let dt = $, ie = !1, re = null;
2107
+ const jo = y({}, [
2108
+ Rt,
2109
+ Nt,
2110
+ $
2111
+ ], fe), je = M([
2112
+ "mi",
2113
+ "mo",
2114
+ "mn",
2115
+ "ms",
2116
+ "mtext"
2117
+ ]);
2118
+ let ae = y({}, je);
2119
+ const We = M(["annotation-xml"]);
2120
+ let se = y({}, We);
2121
+ const Wo = y({}, [
2122
+ "title",
2123
+ "style",
2124
+ "font",
2125
+ "a",
2126
+ "script"
2127
+ ]);
2128
+ let wt = null;
2129
+ const $o = ["application/xhtml+xml", "text/html"], Go = "text/html";
2130
+ let _ = null, ut = null;
2131
+ const Ko = e.createElement("form"), $e = function(n) {
2132
+ return n instanceof RegExp || n instanceof Function;
2133
+ }, le = function() {
2134
+ let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2135
+ if (ut && ut === n) return;
2136
+ (!n || typeof n != "object") && (n = {}), n = H(n), wt = $o.indexOf(n.PARSER_MEDIA_TYPE) === -1 ? Go : n.PARSER_MEDIA_TYPE, _ = wt === "application/xhtml+xml" ? fe : St, k = Z(n, "ALLOWED_TAGS", Zt, { transform: _ }), x = Z(n, "ALLOWED_ATTR", Jt, { transform: _ }), re = Z(n, "ALLOWED_NAMESPACES", jo, { transform: fe }), He = Z(n, "ADD_URI_SAFE_ATTR", Ue, {
2137
+ transform: _,
2138
+ base: Ue
2139
+ }), Be = Z(n, "ADD_DATA_URI_TAGS", Fe, {
2140
+ transform: _,
2141
+ base: Fe
2142
+ }), ct = Z(n, "FORBID_CONTENTS", ze, { transform: _ }), Et = Z(n, "FORBID_TAGS", H({}), { transform: _ }), Me = Z(n, "FORBID_ATTR", H({}), { transform: _ }), lt = z(n, "USE_PROFILES") ? n.USE_PROFILES && typeof n.USE_PROFILES == "object" ? H(n.USE_PROFILES) : n.USE_PROFILES : !1, Ie = n.ALLOW_ARIA_ATTR !== !1, Qt = n.ALLOW_DATA_ATTR !== !1, Oe = n.ALLOW_UNKNOWN_PROTOCOLS || !1, De = n.ALLOW_SELF_CLOSE_IN_ATTR !== !1, q = n.SAFE_FOR_TEMPLATES || !1, et = n.SAFE_FOR_XML !== !1, ot = n.WHOLE_DOCUMENT || !1, st = n.RETURN_DOM || !1, Ot = n.RETURN_DOM_FRAGMENT || !1, Dt = n.RETURN_TRUSTED_TYPE || !1, ee = n.FORCE_BODY || !1, Re = n.SANITIZE_DOM !== !1, Ne = n.SANITIZE_NAMED_PROPS || !1, oe = n.KEEP_CONTENT !== !1, ne = n.IN_PLACE || !1, Le = Rn(n.ALLOWED_URI_REGEXP) ? n.ALLOWED_URI_REGEXP : mo, dt = typeof n.NAMESPACE == "string" ? n.NAMESPACE : $, ae = be(n, "MATHML_TEXT_INTEGRATION_POINTS", () => y({}, je)), se = be(n, "HTML_INTEGRATION_POINTS", () => y({}, We));
2143
+ const a = be(n, "CUSTOM_ELEMENT_HANDLING", () => mt(null));
2144
+ if (W = mt(null), z(a, "tagNameCheck") && $e(a.tagNameCheck) && (W.tagNameCheck = a.tagNameCheck), z(a, "attributeNameCheck") && $e(a.attributeNameCheck) && (W.attributeNameCheck = a.attributeNameCheck), z(a, "allowCustomizedBuiltInElements") && typeof a.allowCustomizedBuiltInElements == "boolean" && (W.allowCustomizedBuiltInElements = a.allowCustomizedBuiltInElements), I(W), q && (Qt = !1), Ot && (st = !0), lt && (k = y({}, fo), x = mt(null), lt.html === !0 && (y(k, uo), y(x, po)), lt.svg === !0 && (y(k, pe), y(x, ge), y(x, jt)), lt.svgFilters === !0 && (y(k, he), y(x, ge), y(x, jt)), lt.mathMl === !0 && (y(k, me), y(x, ho), y(x, jt))), Y.tagCheck = null, Y.attributeCheck = null, z(n, "ADD_TAGS") && (typeof n.ADD_TAGS == "function" ? Y.tagCheck = n.ADD_TAGS : bt(n.ADD_TAGS) && (k === Zt && (k = H(k)), y(k, n.ADD_TAGS, _))), z(n, "ADD_ATTR") && (typeof n.ADD_ATTR == "function" ? Y.attributeCheck = n.ADD_ATTR : bt(n.ADD_ATTR) && (x === Jt && (x = H(x)), y(x, n.ADD_ATTR, _))), z(n, "ADD_FORBID_CONTENTS") && bt(n.ADD_FORBID_CONTENTS) && (ct === ze && (ct = H(ct)), y(ct, n.ADD_FORBID_CONTENTS, _)), oe && (k["#text"] = !0), ot && y(k, [
2145
+ "html",
2146
+ "head",
2147
+ "body"
2148
+ ]), k.table && (y(k, ["tbody"]), delete Et.tbody), n.TRUSTED_TYPES_POLICY) {
2149
+ if (typeof n.TRUSTED_TYPES_POLICY.createHTML != "function") throw X('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2150
+ if (typeof n.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw X('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2151
+ const d = P;
2152
+ P = n.TRUSTED_TYPES_POLICY;
2153
+ try {
2154
+ tt = at("");
2155
+ } catch (f) {
2156
+ throw P = d, f;
2157
+ }
2158
+ } else n.TRUSTED_TYPES_POLICY === null ? (P = void 0, tt = "") : (P === void 0 && (P = Io()), P && typeof tt == "string" && (tt = at("")));
2159
+ M && M(n), ut = n;
2160
+ }, Ge = y({}, [
2161
+ ...pe,
2162
+ ...he,
2163
+ ...Nn
2164
+ ]), Ke = y({}, [...me, ...Pn]), Yo = function(n, a, d) {
2165
+ return a.namespaceURI === $ ? n === "svg" : a.namespaceURI === Rt ? n === "svg" && (d === "annotation-xml" || ae[d]) : !!Ge[n];
2166
+ }, qo = function(n, a, d) {
2167
+ return a.namespaceURI === $ ? n === "math" : a.namespaceURI === Nt ? n === "math" && se[d] : !!Ke[n];
2168
+ }, Vo = function(n, a, d) {
2169
+ return a.namespaceURI === Nt && !se[d] || a.namespaceURI === Rt && !ae[d] ? !1 : !Ke[n] && (Wo[n] || !Ge[n]);
2170
+ }, Xo = function(n) {
2171
+ let a = N(n);
2172
+ (!a || !a.tagName) && (a = {
2173
+ namespaceURI: dt,
2174
+ tagName: "template"
2175
+ });
2176
+ const d = St(n.tagName), f = St(a.tagName);
2177
+ return re[n.namespaceURI] ? n.namespaceURI === Nt ? Yo(d, a, f) : n.namespaceURI === Rt ? qo(d, a, f) : n.namespaceURI === $ ? Vo(d, a, f) : !!(wt === "application/xhtml+xml" && re[n.namespaceURI]) : !1;
2178
+ }, V = function(n) {
2179
+ kt(t.removed, { element: n });
2180
+ try {
2181
+ N(n).removeChild(n);
2182
+ } catch (a) {
2183
+ if (w(n), !N(n)) throw X("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
2184
+ }
2185
+ }, Ye = function(n, a, d) {
2186
+ try {
2187
+ v(n, a);
2188
+ } catch (f) {
2189
+ try {
2190
+ n.removeAttribute(d);
2191
+ } catch (h) {
2192
+ }
2193
+ }
2194
+ }, Pt = function(n) {
2195
+ zt(n);
2196
+ const a = D(n);
2197
+ if (a) {
2198
+ const f = [];
2199
+ it(a, (h) => {
2200
+ kt(f, h);
2201
+ }), it(f, (h) => {
2202
+ try {
2203
+ w(h);
2204
+ } catch (g) {
2205
+ }
2206
+ });
2207
+ }
2208
+ const d = Yt(n);
2209
+ if (d) for (let f = d.length - 1; f >= 0; --f) {
2210
+ const h = d[f], g = h && h.name;
2211
+ typeof g == "string" && Ye(n, h, g);
2212
+ }
2213
+ }, nt = function(n, a, d) {
2214
+ if (!d) try {
2215
+ d = a.getAttributeNode(n);
2216
+ } catch (f) {
2217
+ d = null;
2218
+ }
2219
+ kt(t.removed, {
2220
+ attribute: d || null,
2221
+ from: a
2222
+ });
2223
+ try {
2224
+ d ? v(a, d) : a.removeAttribute(n);
2225
+ } catch (f) {
2226
+ try {
2227
+ a.removeAttribute(n);
2228
+ } catch (h) {
2229
+ }
2230
+ }
2231
+ if (n === "is")
2232
+ if (st || Ot) try {
2233
+ V(a);
2234
+ } catch (f) {
2235
+ }
2236
+ else try {
2237
+ a.setAttribute(n, "");
2238
+ } catch (f) {
2239
+ }
2240
+ }, Zo = function(n) {
2241
+ const a = Yt(n);
2242
+ if (a)
2243
+ for (let d = a.length - 1; d >= 0; --d) {
2244
+ const f = a[d], h = f && f.name;
2245
+ typeof h != "string" || x[_(h)] || Ye(n, f, h);
2246
+ }
2247
+ }, zt = function(n) {
2248
+ const a = [n];
2249
+ for (; a.length > 0; ) {
2250
+ const d = a.pop();
2251
+ yt(d) === F.element && Zo(d);
2252
+ const f = D(d);
2253
+ if (f) for (let h = f.length - 1; h >= 0; --h) a.push(f[h]);
2254
+ }
2255
+ }, qe = function(n, a) {
2256
+ return et ? n === "patchsrc" ? !0 : n === "for" && a !== "label" && a !== "output" : !1;
2257
+ }, Jo = function(n) {
2258
+ if (!et) return;
2259
+ const a = [n];
2260
+ for (; a.length > 0; ) {
2261
+ const d = a.pop(), f = yt(d);
2262
+ if (f === F.processingInstruction || f === F.comment && O(bo, d.data)) {
2263
+ try {
2264
+ w(d);
2265
+ } catch (g) {
2266
+ }
2267
+ continue;
2268
+ }
2269
+ if (f === F.element) {
2270
+ const g = d, b = _(qt(d));
2271
+ try {
2272
+ g.hasAttribute && g.hasAttribute("patchsrc") && g.removeAttribute("patchsrc"), g.hasAttribute && g.hasAttribute("for") && qe("for", b) && g.removeAttribute("for");
2273
+ } catch (S) {
2274
+ }
2275
+ }
2276
+ const h = D(d);
2277
+ if (h) for (let g = h.length - 1; g >= 0; --g) a.push(h[g]);
2278
+ }
2279
+ }, Ve = function(n) {
2280
+ let a = null, d = null;
2281
+ if (ee) n = "<remove></remove>" + n;
2282
+ else {
2283
+ const g = ao(n, /^[\r\n\t ]+/);
2284
+ d = g && g[0];
2285
+ }
2286
+ wt === "application/xhtml+xml" && dt === $ && (n = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + n + "</body></html>");
2287
+ const f = P ? at(n) : n;
2288
+ if (dt === $) try {
2289
+ a = new m().parseFromString(f, wt);
2290
+ } catch (g) {
2291
+ }
2292
+ if (!a || !a.documentElement) {
2293
+ a = Xt.createDocument(dt, "template", null);
2294
+ try {
2295
+ a.documentElement.innerHTML = ie ? tt : f;
2296
+ } catch (g) {
2297
+ }
2298
+ }
2299
+ const h = a.body || a.documentElement;
2300
+ return n && d && h.insertBefore(e.createTextNode(d), h.childNodes[0] || null), dt === $ ? Do.call(a, ot ? "html" : "body")[0] : ot ? a.documentElement : h;
2301
+ }, Xe = function(n) {
2302
+ const a = _t ? _t(n) : n.ownerDocument;
2303
+ return Se.call(a || n, n, p.SHOW_ELEMENT | p.SHOW_COMMENT | p.SHOW_TEXT | p.SHOW_PROCESSING_INSTRUCTION | p.SHOW_CDATA_SECTION, null);
2304
+ }, Bt = function(n) {
2305
+ return n = xt(n, No, " "), n = xt(n, Po, " "), n = xt(n, zo, " "), n;
2306
+ }, ce = function(n) {
2307
+ var a;
2308
+ n.normalize();
2309
+ const d = _t ? _t(n) : n.ownerDocument, f = Se.call(d || n, n, p.SHOW_TEXT | p.SHOW_COMMENT | p.SHOW_CDATA_SECTION | p.SHOW_PROCESSING_INSTRUCTION, null);
2310
+ let h = f.nextNode();
2311
+ for (; h; )
2312
+ h.data = Bt(h.data), h = f.nextNode();
2313
+ const g = (a = n.querySelectorAll) === null || a === void 0 ? void 0 : a.call(n, "template");
2314
+ g && it(g, (b) => {
2315
+ ft(b.content) && ce(b.content);
2316
+ });
2317
+ }, Ft = function(n) {
2318
+ const a = rt ? rt(n) : null;
2319
+ return typeof a != "string" || _(a) !== "form" ? !1 : typeof n.nodeName != "string" || typeof n.textContent != "string" || typeof n.removeChild != "function" || n.attributes !== Yt(n) || typeof n.removeAttribute != "function" || typeof n.removeAttributeNode != "function" || typeof n.getAttributeNode != "function" || typeof n.setAttribute != "function" || typeof n.namespaceURI != "string" || typeof n.insertBefore != "function" || typeof n.hasChildNodes != "function" || n.nodeType !== Q(n) || n.childNodes !== D(n);
2320
+ }, ft = function(n) {
2321
+ if (!Q || typeof n != "object" || n === null) return !1;
2322
+ try {
2323
+ return Q(n) === F.documentFragment;
2324
+ } catch (a) {
2325
+ return !1;
2326
+ }
2327
+ }, Tt = function(n) {
2328
+ if (!Q || typeof n != "object" || n === null) return !1;
2329
+ try {
2330
+ return typeof Q(n) == "number";
2331
+ } catch (a) {
2332
+ return !1;
2333
+ }
2334
+ };
2335
+ function G(u, n, a) {
2336
+ u.length !== 0 && it(u, (d) => {
2337
+ d.call(t, n, a, ut);
2338
+ });
2339
+ }
2340
+ const Qo = function(n, a) {
2341
+ return !!(et && n.hasChildNodes() && !Tt(n.firstElementChild) && O(go, n.textContent) && O(go, n.innerHTML) || et && n.namespaceURI === $ && qn[a] && (Tt(n.firstElementChild) || typeof n.textContent == "string" && O(Vn[a], n.textContent)) || n.nodeType === F.processingInstruction || et && n.nodeType === F.comment && O(bo, n.data));
2342
+ }, Ht = function(n, a) {
2343
+ if (n instanceof RegExp) return O(n, a);
2344
+ if (n instanceof Function) {
2345
+ for (var d = arguments.length, f = new Array(d > 2 ? d - 2 : 0), h = 2; h < d; h++) f[h - 2] = arguments[h];
2346
+ return !!n(a, ...f);
2347
+ }
2348
+ return !1;
2349
+ }, tn = function(n, a, d) {
2350
+ if (!Et[a] && to(a) && Ht(W.tagNameCheck, a)) return !1;
2351
+ if (oe && !ct[a]) {
2352
+ const f = N(n), h = D(n);
2353
+ if (h && f) {
2354
+ const g = h.length;
2355
+ for (let b = g - 1; b >= 0; --b) {
2356
+ const S = n === d ? C(h[b], !0) : h[b];
2357
+ f.insertBefore(S, K(n));
2358
+ }
2359
+ }
2360
+ }
2361
+ return V(n), !0;
2362
+ }, Ze = function(n, a, d, f) {
2363
+ return n.length === 0 ? a : a === d || a === f ? H(a) : a;
2364
+ }, pt = function(n, a) {
2365
+ return n === a || N(n) !== null ? !1 : (ne && zt(n), !0);
2366
+ }, Je = function(n, a) {
2367
+ if (G(T.beforeSanitizeElements, n, null), pt(n, a)) return !0;
2368
+ if (Ft(n))
2369
+ return V(n), !0;
2370
+ const d = _(qt(n));
2371
+ if (k = Ze(T.uponSanitizeElement, k, Zt, Mt), G(T.uponSanitizeElement, n, {
2372
+ tagName: d,
2373
+ allowedTags: k
2374
+ }), pt(n, a)) return !0;
2375
+ if (Qo(n, d))
2376
+ return V(n), !0;
2377
+ if (Et[d] || !(Y.tagCheck instanceof Function && Y.tagCheck(d)) && !k[d]) {
2378
+ const f = tn(n, d, a);
2379
+ return f === !1 && (G(T.afterSanitizeElements, n, null), pt(n, a)) ? !0 : f;
2380
+ }
2381
+ if (yt(n) === F.element && !Xo(n) || (d === "noscript" || d === "noembed" || d === "noframes") && O(Kn, n.innerHTML))
2382
+ return V(n), !0;
2383
+ if (q && n.nodeType === F.text) {
2384
+ const f = Bt(n.textContent);
2385
+ n.textContent !== f && (kt(t.removed, { element: n.cloneNode() }), n.textContent = f);
2386
+ }
2387
+ return G(T.afterSanitizeElements, n, null), pt(n, a);
2388
+ }, Qe = function(n, a, d) {
2389
+ if (Me[a] || qe(a, n) || Re && (a === "id" || a === "name") && (d in e || d in Ko)) return !1;
2390
+ const f = x[a] || Y.attributeCheck instanceof Function && Y.attributeCheck(a, n);
2391
+ return Qt && O(Bo, a) || Ie && O(Fo, a) ? !0 : f ? He[a] || O(Le, xt(d, _e, "")) || (a === "src" || a === "xlink:href" || a === "href") && n !== "script" && so(d, "data:") === 0 && Be[n] || Oe && !O(Ho, xt(d, _e, "")) ? !0 : !d : to(n) && Ht(W.tagNameCheck, n) && Ht(W.attributeNameCheck, a, n) || a === "is" && W.allowCustomizedBuiltInElements && Ht(W.tagNameCheck, d);
2392
+ }, en = y({}, [
2393
+ "annotation-xml",
2394
+ "color-profile",
2395
+ "font-face",
2396
+ "font-face-format",
2397
+ "font-face-name",
2398
+ "font-face-src",
2399
+ "font-face-uri",
2400
+ "missing-glyph"
2401
+ ]), to = function(n) {
2402
+ return !en[St(n)] && O(Uo, n);
2403
+ }, on = function(n, a, d, f) {
2404
+ if (P && typeof E == "object" && typeof E.getAttributeType == "function" && !d) switch (E.getAttributeType(n, a)) {
2405
+ case "TrustedHTML":
2406
+ return at(f);
2407
+ case "TrustedScriptURL":
2408
+ return Mo(f);
2409
+ }
2410
+ return f;
2411
+ }, nn = function(n, a, d, f) {
2412
+ try {
2413
+ return d ? n.setAttributeNS(d, a, f) : n.setAttribute(a, f), Ft(n) ? (V(n), !1) : !0;
2414
+ } catch (h) {
2415
+ return nt(a, n), !1;
2416
+ }
2417
+ }, eo = function(n, a) {
2418
+ if (G(T.beforeSanitizeAttributes, n, null), pt(n, a)) return;
2419
+ const d = n.attributes;
2420
+ if (!d || Ft(n)) return;
2421
+ x = Ze(T.uponSanitizeAttribute, x, Jt, It);
2422
+ const f = {
2423
+ attrName: "",
2424
+ attrValue: "",
2425
+ keepAttr: !0,
2426
+ allowedAttributes: x,
2427
+ forceKeepAttr: void 0
2428
+ };
2429
+ let h = d.length;
2430
+ const g = _(n.nodeName);
2431
+ for (; h--; ) {
2432
+ const b = d[h], S = b.name, U = b.namespaceURI, B = b.value, ht = _(S), ue = B;
2433
+ let R = S === "value" ? ue : _n(ue), oo = !1;
2434
+ if (f.attrName = ht, f.attrValue = R, f.keepAttr = !0, f.forceKeepAttr = void 0, G(T.uponSanitizeAttribute, n, f), R = f.attrValue, Ne && (ht === "id" || ht === "name") && so(R, Pe) !== 0 && (nt(S, n, b), R = Pe + R, oo = !0), et && O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, R)) {
2435
+ nt(S, n, b);
2436
+ continue;
2437
+ }
2438
+ if (ht === "attributename" && ao(R, "href")) {
2439
+ nt(S, n, b);
2440
+ continue;
2441
+ }
2442
+ if (!f.forceKeepAttr) {
2443
+ if (!f.keepAttr) {
2444
+ nt(S, n, b);
2445
+ continue;
2446
+ }
2447
+ if (!De && O(Yn, R)) {
2448
+ nt(S, n, b);
2449
+ continue;
2450
+ }
2451
+ if (q && (R = Bt(R)), !Qe(g, ht, R)) {
2452
+ nt(S, n, b);
2453
+ continue;
2454
+ }
2455
+ R = on(g, ht, U, R), R !== ue && nn(n, S, U, R) && oo && ro(t.removed);
2456
+ }
2457
+ }
2458
+ G(T.afterSanitizeAttributes, n, null), pt(n, a);
2459
+ }, Ut = function(n) {
2460
+ let a = null;
2461
+ const d = Xe(n);
2462
+ for (G(T.beforeSanitizeShadowDOM, n, null); a = d.nextNode(); )
2463
+ if (G(T.uponSanitizeShadowNode, a, null), Je(a, n), eo(a, n), ft(a.content) && Ut(a.content), yt(a) === F.element) {
2464
+ const f = xe(a);
2465
+ ft(f) && (de(f), Ut(f));
2466
+ }
2467
+ G(T.afterSanitizeShadowDOM, n, null);
2468
+ }, de = function(n) {
2469
+ const a = [{
2470
+ node: n,
2471
+ shadow: null
2472
+ }];
2473
+ for (; a.length > 0; ) {
2474
+ const d = a.pop();
2475
+ if (d.shadow) {
2476
+ Ut(d.shadow);
2477
+ continue;
2478
+ }
2479
+ const f = d.node, h = yt(f) === F.element, g = D(f);
2480
+ if (g) for (let b = g.length - 1; b >= 0; --b) a.push({
2481
+ node: g[b],
2482
+ shadow: null
2483
+ });
2484
+ if (h) {
2485
+ const b = rt ? rt(f) : null;
2486
+ if (typeof b == "string" && _(b) === "template") {
2487
+ const S = f.content;
2488
+ ft(S) && a.push({
2489
+ node: S,
2490
+ shadow: null
2491
+ });
2492
+ }
2493
+ }
2494
+ if (h) {
2495
+ const b = xe(f);
2496
+ ft(b) && a.push({
2497
+ node: null,
2498
+ shadow: b
2499
+ }, {
2500
+ node: b,
2501
+ shadow: null
2502
+ });
2503
+ }
2504
+ }
2505
+ };
2506
+ return t.sanitize = function(u) {
2507
+ let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, d = null, f = null, h = null;
2508
+ if (ie = !u, ie && (u = "<!-->"), typeof u != "string" && !Tt(u) && (u = Dn(u), typeof u != "string"))
2509
+ throw X("dirty is not a string, aborting");
2510
+ if (!t.isSupported) return u;
2511
+ te ? (k = Mt, x = It) : le(n), (T.uponSanitizeElement.length > 0 || T.uponSanitizeAttribute.length > 0) && (k = H(k)), T.uponSanitizeAttribute.length > 0 && (x = H(x)), t.removed = [];
2512
+ const g = ne && typeof u != "string" && Tt(u);
2513
+ if (g) {
2514
+ Jo(u);
2515
+ const U = qt(u);
2516
+ if (typeof U == "string") {
2517
+ const B = _(U);
2518
+ if (!k[B] || Et[B])
2519
+ throw Pt(u), X("root node is forbidden and cannot be sanitized in-place");
2520
+ }
2521
+ if (Ft(u))
2522
+ throw Pt(u), X("root node is clobbered and cannot be sanitized in-place");
2523
+ try {
2524
+ de(u);
2525
+ } catch (B) {
2526
+ throw Pt(u), B;
2527
+ }
2528
+ } else if (Tt(u))
2529
+ a = Ve("<!---->"), d = a.ownerDocument.importNode(u, !0), d.nodeType === F.element && d.nodeName === "BODY" || d.nodeName === "HTML" ? a = d : a.appendChild(d), de(a);
2530
+ else {
2531
+ if (!st && !q && !ot && u.indexOf("<") === -1) return P && Dt ? at(u) : u;
2532
+ if (a = Ve(u), !a) return st ? null : Dt ? tt : "";
2533
+ }
2534
+ a && ee && V(a.firstChild);
2535
+ const b = g ? u : a;
2536
+ try {
2537
+ const U = Xe(b);
2538
+ for (; f = U.nextNode(); )
2539
+ Je(f, b), eo(f, b), ft(f.content) && Ut(f.content);
2540
+ } catch (U) {
2541
+ throw g && (Pt(u), it(t.removed, (B) => {
2542
+ B.element && zt(B.element);
2543
+ })), U;
2544
+ }
2545
+ if (g) {
2546
+ let U = !1;
2547
+ if (it(t.removed, (B) => {
2548
+ B.element && (B.element === u && (U = !0), zt(B.element));
2549
+ }), U) throw X("a node selected for removal could not be safely returned; refusing to sanitize in place");
2550
+ return q && ce(u), u;
2551
+ }
2552
+ if (st) {
2553
+ if (q && ce(a), Ot)
2554
+ for (h = Oo.call(a.ownerDocument); a.firstChild; ) h.appendChild(a.firstChild);
2555
+ else h = a;
2556
+ return (x.shadowroot || x.shadowrootmode) && (h = Ro.call(o, h, !0)), h;
2557
+ }
2558
+ let S = ot ? a.outerHTML : a.innerHTML;
2559
+ return ot && k["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && O($n, a.ownerDocument.doctype.name) && (S = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
2560
+ ` + S), q && (S = Bt(S)), P && Dt ? at(S) : S;
2561
+ }, t.setConfig = function() {
2562
+ let u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2563
+ le(u), te = !0, Mt = k, It = x;
2564
+ }, t.clearConfig = function() {
2565
+ ut = null, te = !1, Mt = null, It = null, P = Vt, tt = "";
2566
+ }, t.isValidAttribute = function(u, n, a) {
2567
+ ut || le({});
2568
+ const d = _(u), f = _(n);
2569
+ return Qe(d, f, a);
2570
+ }, t.addHook = function(u, n) {
2571
+ typeof n == "function" && z(T, u) && kt(T[u], n);
2572
+ }, t.removeHook = function(u, n) {
2573
+ if (z(T, u)) {
2574
+ if (n !== void 0) {
2575
+ const a = Cn(T[u], n);
2576
+ return a === -1 ? void 0 : Sn(T[u], a, 1)[0];
2577
+ }
2578
+ return ro(T[u]);
2579
+ }
2580
+ }, t.removeHooks = function(u) {
2581
+ z(T, u) && (T[u] = []);
2582
+ }, t.removeAllHooks = function() {
2583
+ T = yo();
2584
+ }, t;
2585
+ }
2586
+ var Wt = So();
2587
+ const Jn = [
2588
+ "p",
2589
+ "br",
2590
+ "strong",
2591
+ "em",
2592
+ "u",
2593
+ "s",
2594
+ "strike",
2595
+ "del",
2596
+ "b",
2597
+ "i",
2598
+ "h1",
2599
+ "h2",
2600
+ "h3",
2601
+ "h4",
2602
+ "h5",
2603
+ "h6",
2604
+ "ul",
2605
+ "ol",
2606
+ "li",
2607
+ "a",
2608
+ "img",
2609
+ "video",
2610
+ "audio",
2611
+ "table",
2612
+ "thead",
2613
+ "tbody",
2614
+ "tr",
2615
+ "th",
2616
+ "td",
2617
+ "blockquote",
2618
+ "pre",
2619
+ "code",
2620
+ "span",
2621
+ "div",
2622
+ "section",
2623
+ "sup",
2624
+ "sub",
2625
+ "hr"
2626
+ // 'iframe' is deliberately not in the default allowlist. Arbitrary pasted
2627
+ // or typed content should not be able to silently embed an iframe - that's
2628
+ // a real vector (e.g. pasting from a compromised page). The editor's
2629
+ // embed-iframe plugin inserts iframes through its own explicit,
2630
+ // user-initiated dialog, a different trust boundary that never calls
2631
+ // through this sanitizer. A consumer that genuinely wants iframes in
2632
+ // pasted/typed content can still opt in via a custom allowedTags list.
2633
+ ], Qn = {
2634
+ "*": ["class", "style", "id", "data-*", "role", "aria-*", "tabindex", "contenteditable", "spellcheck", "dir", "lang"],
2635
+ a: ["href", "target", "rel", "title"],
2636
+ img: ["src", "alt", "width", "height", "loading"],
2637
+ video: ["src", "controls", "width", "height", "autoplay", "loop", "muted"],
2638
+ audio: ["src", "controls", "autoplay", "loop", "muted"],
2639
+ table: ["border", "cellpadding", "cellspacing"],
2640
+ td: ["colspan", "rowspan", "align", "valign"],
2641
+ th: ["colspan", "rowspan", "align", "valign"],
2642
+ // 'iframe' itself is still excluded from DEFAULT_ALLOWED_TAGS above, so this
2643
+ // entry is inert for ordinary input/paste - it only takes effect for the
2644
+ // embed-iframe plugin's trust-marked insertions (see sanitizeInputHTML's
2645
+ // additionalAllowedTags), restoring the attributes that make an inserted
2646
+ // iframe actually usable (src, sizing, fullscreen, scrolling/border).
2647
+ iframe: ["src", "width", "height", "name", "title", "frameborder", "scrolling", "allowfullscreen", "longdesc", "allow"]
2648
+ }, ti = "data-editora-embed";
2649
+ function ei(s) {
2650
+ if (!s || /\s/.test(s.trim())) return !1;
2651
+ try {
2652
+ const t = new URL(s.trim());
2653
+ return (t.protocol === "https:" || t.protocol === "http:") && t.hostname.length > 0;
2654
+ } catch (t) {
2655
+ return !1;
2656
+ }
2657
+ }
2658
+ function _o(s, t, e, o) {
2659
+ if ((t == null ? void 0 : t.sanitize) === !1)
2660
+ return s;
2661
+ const i = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : Jn, r = e != null && e.length ? Array.from(/* @__PURE__ */ new Set([...i, ...e])) : i, c = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : Qn, p = /* @__PURE__ */ new Set();
2662
+ for (const A of Object.values(c))
2663
+ for (const C of A) p.add(C);
2664
+ const m = {
2665
+ ALLOWED_TAGS: r,
2666
+ ALLOWED_ATTR: Array.from(p)
2667
+ };
2668
+ if (!o)
2669
+ return Wt.sanitize(s, m);
2670
+ const E = r.includes("iframe");
2671
+ Wt.addHook(
2672
+ "uponSanitizeElement",
2673
+ (A, C) => {
2674
+ var v;
2675
+ if (C.tagName !== "iframe") return;
2676
+ const w = A;
2677
+ C.allowedTags.iframe = E || ((v = w.getAttribute) == null ? void 0 : v.call(w, ti)) === "true" && ei(w.getAttribute("src"));
2678
+ }
2679
+ );
2680
+ try {
2681
+ return Wt.sanitize(s, m);
2682
+ } finally {
2683
+ Wt.removeHook("uponSanitizeElement");
2684
+ }
2685
+ }
2686
+ function oi(s, t, e, o) {
2687
+ return _o(s, t, o, !1);
2688
+ }
2689
+ function ni(s, t, e) {
2690
+ return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? s : oi(s, t);
2691
+ }
2692
+ function vo(s, t, e, o) {
2693
+ return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? s : _o(s, t, o, !0);
2694
+ }
2695
+ const Kt = class Kt {
2696
+ /**
2697
+ * Resolve configuration from multiple sources with priority
2698
+ */
2699
+ static resolve(t) {
2700
+ const e = {};
2701
+ if (Object.assign(e, this.EDITOR_DEFAULTS), t.pluginDefaults && Object.assign(e, t.pluginDefaults), t.attributes) {
2702
+ const o = this.parseAttributes(t.attributes);
2703
+ Object.assign(e, o);
2704
+ }
2705
+ return t.jsConfig && Object.assign(e, t.jsConfig), this.normalizeConfig(e);
2706
+ }
2707
+ /**
2708
+ * Normalize mixed legacy/new config shapes
2709
+ */
2710
+ static normalizeConfig(t) {
2711
+ const e = { ...t };
2712
+ if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
2713
+ const l = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
2714
+ e.toolbarFloating !== void 0 && (l.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (l.sticky = !!e.toolbarSticky), e.toolbar = l;
2715
+ }
2716
+ if (e.toolbarItems !== void 0 && typeof e.toolbar == "object" && e.toolbar && (e.toolbar.items = e.toolbarItems), e.autosaveEnabled !== void 0 || e.autosaveIntervalMs !== void 0 || e.autosaveStorageKey !== void 0 || e.autosaveProvider !== void 0 || e.autosaveApiUrl !== void 0) {
2717
+ const l = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
2718
+ e.autosaveEnabled !== void 0 && (l.enabled = !!e.autosaveEnabled), e.autosaveIntervalMs !== void 0 && (l.intervalMs = Number(e.autosaveIntervalMs)), e.autosaveStorageKey !== void 0 && (l.storageKey = e.autosaveStorageKey), e.autosaveProvider !== void 0 && (l.provider = e.autosaveProvider), e.autosaveApiUrl !== void 0 && (l.apiUrl = e.autosaveApiUrl), e.autosave = l;
2719
+ }
2720
+ const o = {
2721
+ enabled: !1,
2722
+ intervalMs: 3e4,
2723
+ storageKey: "rte-autosave",
2724
+ provider: "localStorage",
2725
+ apiUrl: ""
2726
+ };
2727
+ if (typeof e.autosave == "boolean")
2728
+ e.autosave = {
2729
+ ...o,
2730
+ enabled: e.autosave
2731
+ };
2732
+ else if (typeof e.autosave == "object" && e.autosave) {
2733
+ const l = {
2734
+ ...o,
2735
+ ...e.autosave
2736
+ };
2737
+ l.intervalMs === void 0 && l.interval !== void 0 && (l.intervalMs = Number(l.interval)), l.enabled === void 0 && (l.enabled = !0), (!Number.isFinite(l.intervalMs) || l.intervalMs <= 0) && (l.intervalMs = o.intervalMs), e.autosave = l;
2738
+ } else
2739
+ e.autosave = o;
2740
+ if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
2741
+ const l = typeof e.language == "object" && e.language ? { ...e.language } : {};
2742
+ e.languageLocale !== void 0 && (l.locale = e.languageLocale), e.languageDirection !== void 0 && (l.direction = e.languageDirection), e.language = l;
2743
+ }
2744
+ const i = { locale: "en", direction: "ltr" };
2745
+ if (typeof e.language == "string" ? e.language = {
2746
+ locale: e.language,
2747
+ direction: i.direction
2748
+ } : typeof e.language == "object" && e.language ? e.language = {
2749
+ ...i,
2750
+ ...e.language
2751
+ } : e.language = i, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
2752
+ const l = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
2753
+ e.spellcheckEnabled !== void 0 && (l.enabled = !!e.spellcheckEnabled), e.spellcheckProvider !== void 0 && (l.provider = e.spellcheckProvider), e.spellcheckApiUrl !== void 0 && (l.apiUrl = e.spellcheckApiUrl), e.spellcheck = l;
2754
+ }
2755
+ const r = {
2756
+ enabled: !1,
2757
+ provider: "browser",
2758
+ apiUrl: ""
2759
+ };
2760
+ if (typeof e.spellcheck == "boolean")
2761
+ e.spellcheck = {
2762
+ ...r,
2763
+ enabled: e.spellcheck
2764
+ };
2765
+ else if (typeof e.spellcheck == "object" && e.spellcheck) {
2766
+ const l = {
2767
+ ...r,
2768
+ ...e.spellcheck
2769
+ };
2770
+ !l.provider && l.mode && (l.provider = l.mode === "local" ? "browser" : "api"), l.enabled === void 0 && (l.enabled = !!(l.mode || l.provider || l.apiUrl)), e.spellcheck = l;
2771
+ } else
2772
+ e.spellcheck = r;
2773
+ return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
2774
+ enabled: !!e.contextMenuEnabled
2775
+ }), typeof e.contextMenu == "boolean" ? e.contextMenu = { enabled: e.contextMenu } : typeof e.contextMenu == "object" && e.contextMenu ? e.contextMenu = {
2776
+ enabled: e.contextMenu.enabled !== !1
2777
+ } : e.contextMenu = { enabled: !0 }, (e.pasteClean !== void 0 || e.pasteKeepFormatting !== void 0 || e.pasteConvertWord !== void 0) && (e.paste = {
2778
+ ...e.paste || {},
2779
+ ...e.pasteClean !== void 0 ? { clean: !!e.pasteClean } : {},
2780
+ ...e.pasteKeepFormatting !== void 0 ? { keepFormatting: !!e.pasteKeepFormatting } : {},
2781
+ ...e.pasteConvertWord !== void 0 ? { convertWord: !!e.pasteConvertWord } : {}
2782
+ }), e.paste = {
2783
+ clean: !0,
2784
+ keepFormatting: !1,
2785
+ convertWord: !0,
2786
+ ...e.paste || {}
2787
+ }, e.contentConfig = {
2788
+ allowedTags: [],
2789
+ allowedAttributes: {},
2790
+ sanitize: !0,
2791
+ ...e.contentConfig || {}
2792
+ }, (e.securitySanitizeOnPaste !== void 0 || e.securitySanitizeOnInput !== void 0) && (e.security = {
2793
+ ...e.security || {},
2794
+ ...e.securitySanitizeOnPaste !== void 0 ? { sanitizeOnPaste: !!e.securitySanitizeOnPaste } : {},
2795
+ ...e.securitySanitizeOnInput !== void 0 ? { sanitizeOnInput: !!e.securitySanitizeOnInput } : {}
2796
+ }), e.security = {
2797
+ sanitizeOnPaste: !0,
2798
+ sanitizeOnInput: !0,
2799
+ ...e.security || {}
2800
+ }, (e.accessibilityEnableAria !== void 0 || e.accessibilityKeyboardNavigation !== void 0 || e.accessibilityChecker !== void 0) && (e.accessibility = {
2801
+ ...e.accessibility || {},
2802
+ ...e.accessibilityEnableAria !== void 0 ? { enableARIA: !!e.accessibilityEnableAria } : {},
2803
+ ...e.accessibilityKeyboardNavigation !== void 0 ? { keyboardNavigation: !!e.accessibilityKeyboardNavigation } : {},
2804
+ ...e.accessibilityChecker !== void 0 ? { checker: !!e.accessibilityChecker } : {}
2805
+ }), typeof e.accessibility == "boolean" && (e.accessibility = {
2806
+ enableARIA: e.accessibility,
2807
+ keyboardNavigation: e.accessibility,
2808
+ checker: !1
2809
+ }), e.accessibility = {
2810
+ enableARIA: !0,
2811
+ keyboardNavigation: !0,
2812
+ checker: !1,
2813
+ ...e.accessibility || {}
2814
+ }, (e.performanceDebounceInputMs !== void 0 || e.performanceViewportOnlyScan !== void 0) && (e.performance = {
2815
+ ...e.performance || {},
2816
+ ...e.performanceDebounceInputMs !== void 0 ? { debounceInputMs: Number(e.performanceDebounceInputMs) } : {},
2817
+ ...e.performanceViewportOnlyScan !== void 0 ? { viewportOnlyScan: !!e.performanceViewportOnlyScan } : {}
2818
+ }), typeof e.performance == "boolean" && (e.performance = {
2819
+ debounceInputMs: 100,
2820
+ viewportOnlyScan: e.performance
2821
+ }), e.performance = {
2822
+ debounceInputMs: 100,
2823
+ viewportOnlyScan: !0,
2824
+ ...e.performance || {}
2825
+ }, (typeof e.performance.debounceInputMs != "number" || !Number.isFinite(e.performance.debounceInputMs) || e.performance.debounceInputMs < 0) && (e.performance.debounceInputMs = 100), e;
2826
+ }
2827
+ /**
2828
+ * Parse web component attributes
2829
+ */
2830
+ static parseAttributes(t) {
2831
+ const e = {};
2832
+ for (const [o, i] of Object.entries(t)) {
2833
+ const r = this.kebabToCamel(o);
2834
+ e[r] = this.BOOLEAN_ATTRIBUTES.has(o) && (i === "" || i === o) ? !0 : this.parseAttributeValue(i);
2835
+ }
2836
+ return e;
2837
+ }
2838
+ /**
2839
+ * Parse attribute value to appropriate type
2840
+ */
2841
+ static parseAttributeValue(t) {
2842
+ if (t === "true") return !0;
2843
+ if (t === "false") return !1;
2844
+ if (/^\d+$/.test(t)) return parseInt(t, 10);
2845
+ if (/^\d+\.\d+$/.test(t)) return parseFloat(t);
2846
+ if (t.startsWith("{") || t.startsWith("["))
2847
+ try {
2848
+ return JSON.parse(t);
2849
+ } catch (e) {
2850
+ return t;
2851
+ }
2852
+ return t;
2853
+ }
2854
+ /**
2855
+ * Convert kebab-case to camelCase
2856
+ */
2857
+ static kebabToCamel(t) {
2858
+ return t.replace(/-([a-z])/g, (e, o) => o.toUpperCase());
2859
+ }
2860
+ /**
2861
+ * Validate configuration
2862
+ */
2863
+ static validate(t) {
2864
+ const e = [];
2865
+ return t.height !== void 0 && typeof t.height == "number" && t.height < 0 && e.push("height must be a positive number"), t.width !== void 0 && typeof t.width == "number" && t.width < 0 && e.push("width must be a positive number"), t.plugins !== void 0 && !Array.isArray(t.plugins) && typeof t.plugins != "string" && e.push("plugins must be an array or string"), t.theme !== void 0 && typeof t.theme != "string" && e.push("theme must be a string"), {
2866
+ valid: e.length === 0,
2867
+ errors: e
2868
+ };
2869
+ }
2870
+ /**
2871
+ * Get default configuration
2872
+ */
2873
+ static getDefaults() {
2874
+ return { ...this.EDITOR_DEFAULTS };
2875
+ }
2876
+ /**
2877
+ * Merge configurations (deep merge)
2878
+ */
2879
+ static merge(...t) {
2880
+ const e = {};
2881
+ for (const o of t)
2882
+ for (const [i, r] of Object.entries(o))
2883
+ r != null && (typeof r == "object" && !Array.isArray(r) && e[i] ? e[i] = this.merge(e[i], r) : e[i] = r);
2884
+ return e;
2885
+ }
2886
+ };
2887
+ Kt.EDITOR_DEFAULTS = {
2888
+ height: 400,
2889
+ width: "100%",
2890
+ readonly: !1,
2891
+ disabled: !1,
2892
+ menubar: !0,
2893
+ toolbar: !0,
2894
+ plugins: [],
2895
+ theme: "light",
2896
+ content: "",
2897
+ placeholder: "Start typing...",
2898
+ autofocus: !1,
2899
+ autosave: !1,
2900
+ accessibility: {
2901
+ enableARIA: !0,
2902
+ keyboardNavigation: !0,
2903
+ checker: !1
2904
+ },
2905
+ performance: {
2906
+ debounceInputMs: 100,
2907
+ viewportOnlyScan: !0
2908
+ },
2909
+ spellcheck: {
2910
+ enabled: !1,
2911
+ provider: "browser",
2912
+ apiUrl: ""
2913
+ },
2914
+ language: {
2915
+ locale: "en",
2916
+ direction: "ltr"
2917
+ },
2918
+ contextMenu: {
2919
+ enabled: !0
2920
+ },
2921
+ contentConfig: {
2922
+ allowedTags: [],
2923
+ allowedAttributes: {},
2924
+ sanitize: !0
2925
+ },
2926
+ paste: {
2927
+ clean: !0,
2928
+ keepFormatting: !1,
2929
+ convertWord: !0
2930
+ },
2931
+ security: {
2932
+ sanitizeOnPaste: !0,
2933
+ sanitizeOnInput: !0
2934
+ },
2935
+ statusbar: !1
2936
+ }, Kt.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
2937
+ "readonly",
2938
+ "disabled",
2939
+ "autofocus",
2940
+ "statusbar",
2941
+ "toolbar-floating",
2942
+ "toolbar-sticky",
2943
+ "autosave-enabled",
2944
+ "accessibility-enable-aria",
2945
+ "accessibility-keyboard-navigation",
2946
+ "accessibility-checker",
2947
+ "performance-viewport-only-scan",
2948
+ "spellcheck-enabled",
2949
+ "context-menu-enabled",
2950
+ "paste-clean",
2951
+ "paste-keep-formatting",
2952
+ "paste-convert-word",
2953
+ "security-sanitize-on-paste",
2954
+ "security-sanitize-on-input"
2955
+ ]);
2956
+ let Te = Kt;
2957
+ class ii {
2958
+ constructor() {
2959
+ this.loadedPlugins = /* @__PURE__ */ new Map(), this.pluginRegistry = /* @__PURE__ */ new Map();
2960
+ }
2961
+ /**
2962
+ * Register a plugin factory (sync or async)
2963
+ */
2964
+ register(t, e) {
2965
+ this.pluginRegistry.set(t, e);
2966
+ }
2967
+ /**
2968
+ * Load a plugin by name (async)
2969
+ */
2970
+ async load(t, e) {
2971
+ if (this.loadedPlugins.has(t))
2972
+ return this.loadedPlugins.get(t);
2973
+ const o = this.pluginRegistry.get(t);
2974
+ if (!o)
2975
+ return console.warn(`Plugin not found: ${t}`), null;
2976
+ const i = await o();
2977
+ return e && this.applyPluginConfig(i, e), this.loadedPlugins.set(t, i), i;
2978
+ }
2979
+ /**
2980
+ * Load multiple plugins
2981
+ */
2982
+ async loadMultiple(t, e) {
2983
+ return (await Promise.all(
2984
+ t.map((i) => this.load(i, e))
2985
+ )).filter((i) => i !== null);
2986
+ }
2987
+ /**
2988
+ * Parse plugin string "lists link image media"
2989
+ */
2990
+ async parsePluginString(t, e) {
2991
+ const o = t.split(/\s+/).filter(Boolean);
2992
+ return this.loadMultiple(o, e);
2993
+ }
2994
+ /**
2995
+ * Apply configuration to plugin
2996
+ */
2997
+ applyPluginConfig(t, e) {
2998
+ t.__pluginConfig = e;
2999
+ }
3000
+ /**
3001
+ * Unload a plugin
3002
+ */
3003
+ unload(t) {
3004
+ this.loadedPlugins.delete(t);
3005
+ }
3006
+ /**
3007
+ * Clear all loaded plugins
3008
+ */
3009
+ clear() {
3010
+ this.loadedPlugins.clear();
3011
+ }
3012
+ /**
3013
+ * Get all loaded plugins
3014
+ */
3015
+ getLoadedPlugins() {
3016
+ return Array.from(this.loadedPlugins.values());
3017
+ }
3018
+ /**
3019
+ * Get all registered plugin names (available for loading)
3020
+ */
3021
+ getRegisteredPluginNames() {
3022
+ return Array.from(this.pluginRegistry.keys());
3023
+ }
3024
+ /**
3025
+ * Check if plugin is loaded
3026
+ */
3027
+ isLoaded(t) {
3028
+ return this.loadedPlugins.has(t);
3029
+ }
3030
+ }
3031
+ const ri = '.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor}.editora-theme-dark .editora-toolbar-button svg:not([fill=none i]),.editora-theme-dark .editora-toolbar-icon svg:not([fill=none i]){fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-items-container{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden}.editora-toolbar-more-button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;padding:0;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-size:16px}.editora-toolbar-more-button:hover{background:#e0e0e0}.editora-toolbar-more-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-more-button{background:var(--editora-dark-content);border-color:var(--editora-dark-border);color:var(--editora-dark-text)}.editora-theme-dark .editora-toolbar-more-button:hover,.editora-theme-dark .editora-toolbar-more-button.active{background:#3a4554;border-color:#607088}.editora-toolbar-expanded-row{display:none;flex-wrap:wrap;align-items:center;gap:4px;width:100%;padding:8px;border-top:1px solid #ddd;background:#f5f5f5}.editora-toolbar-expanded-row.show{display:flex}.editora-theme-dark .editora-toolbar-expanded-row{border-top-color:var(--editora-dark-border);background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%)}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';
3032
+ let $t;
3033
+ const ai = "__editoraCommandEditorRoot", si = "__editoraLastCommandButton", Eo = "editora-editor, [data-editora-editor], .rte-editor, .editora-editor", wo = ".rte-content, .editora-content", ke = /* @__PURE__ */ new Set();
3034
+ let J = null, To = !1, ye = null, ve = null;
3035
+ function ko(s) {
3036
+ if (!(s instanceof HTMLElement)) return !1;
3037
+ const t = s;
3038
+ return typeof t.execCommand == "function" && (t.tagName.toLowerCase() === "editora-editor" || t.classList.contains("editora-editor") || t.hasAttribute("data-editora-editor"));
3039
+ }
3040
+ function li(s) {
3041
+ return s ? s.nodeType === Node.ELEMENT_NODE ? s : s.parentElement : null;
3042
+ }
3043
+ function Ct(s) {
3044
+ if (!s) return null;
3045
+ if (ko(s))
3046
+ return s;
3047
+ const t = s.matches(Eo) ? s : s.closest(Eo);
3048
+ return !t || !ko(t) ? null : t;
3049
+ }
3050
+ function ci() {
3051
+ var i;
3052
+ if (typeof window == "undefined") return null;
3053
+ const s = window[ai];
3054
+ if (s instanceof HTMLElement) {
3055
+ const r = Ct(s);
3056
+ if (r) return r;
3057
+ const l = s.matches(wo) ? s : s.querySelector(wo);
3058
+ if (l) {
3059
+ const c = Ct(l);
3060
+ if (c) return c;
3061
+ }
3062
+ }
3063
+ const t = window[si];
3064
+ if (t instanceof HTMLElement) {
3065
+ const r = Ct(t);
3066
+ if (r) return r;
3067
+ }
3068
+ const e = document.activeElement;
3069
+ if (e) {
3070
+ const r = Ct(e);
3071
+ if (r) return r;
3072
+ }
3073
+ const o = (i = window.getSelection) == null ? void 0 : i.call(window);
3074
+ if (o && o.rangeCount > 0) {
3075
+ const r = Ct(li(o.getRangeAt(0).startContainer));
3076
+ if (r) return r;
3077
+ }
3078
+ if (J && J.isConnected)
3079
+ return J;
3080
+ for (const r of ke)
3081
+ if (r.isConnected) return r;
3082
+ return null;
3083
+ }
3084
+ function di() {
3085
+ if (typeof window == "undefined" || To) return;
3086
+ ye = typeof window.executeEditorCommand == "function" ? window.executeEditorCommand.bind(window) : null, ve = typeof window.execEditorCommand == "function" ? window.execEditorCommand.bind(window) : null;
3087
+ const s = (t, ...e) => {
3088
+ const o = ci();
3089
+ return o ? o.execCommand(t, ...e) : ye ? ye(t, ...e) : ve ? ve(t, ...e) : !1;
3090
+ };
3091
+ window.executeEditorCommand = s, window.execEditorCommand = s, To = !0;
3092
+ }
3093
+ function ui() {
3094
+ const s = "editora-webcomponent-styles";
3095
+ if (!document.getElementById(s)) {
3096
+ const t = document.createElement("style");
3097
+ t.id = s, t.textContent = ri, document.head.appendChild(t);
3098
+ }
3099
+ }
3100
+ function Lo() {
3101
+ if (!$t) {
3102
+ const s = gt.__globalPluginLoader;
3103
+ s ? $t = s : $t = new ii();
3104
+ }
3105
+ return $t;
3106
+ }
3107
+ function fi(s) {
3108
+ const t = Lo();
3109
+ Object.entries(s).forEach(([e, o]) => {
3110
+ t.register(e, o);
3111
+ });
3112
+ }
3113
+ class gt extends HTMLElement {
3114
+ constructor() {
3115
+ if (super(), this.pluginLoader = Lo(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new sn(), this.lastAutosavedContent = "", this.loadedPlugins = [], this.lastBeforeInputType = null, ui(), !this.hasAttribute("data-initial-content")) {
3116
+ const t = this.innerHTML.trim();
3117
+ t && this.setAttribute("data-initial-content", t);
3118
+ }
3119
+ }
3120
+ // Observed attributes for reactive updates
3121
+ static get observedAttributes() {
3122
+ return [
3123
+ "height",
3124
+ "width",
3125
+ "menubar",
3126
+ "plugins",
3127
+ "toolbar",
3128
+ "toolbar-items",
3129
+ "toolbar-floating",
3130
+ "toolbar-sticky",
3131
+ "readonly",
3132
+ "disabled",
3133
+ "theme",
3134
+ "placeholder",
3135
+ "autofocus",
3136
+ "autosave",
3137
+ "autosave-enabled",
3138
+ "autosave-interval-ms",
3139
+ "autosave-storage-key",
3140
+ "autosave-provider",
3141
+ "autosave-api-url",
3142
+ "accessibility",
3143
+ "accessibility-enable-aria",
3144
+ "accessibility-keyboard-navigation",
3145
+ "accessibility-checker",
3146
+ "performance",
3147
+ "performance-debounce-input-ms",
3148
+ "performance-viewport-only-scan",
3149
+ "language",
3150
+ "language-locale",
3151
+ "language-direction",
3152
+ "spellcheck",
3153
+ "spellcheck-enabled",
3154
+ "spellcheck-provider",
3155
+ "context-menu",
3156
+ "context-menu-enabled",
3157
+ "paste",
3158
+ "paste-clean",
3159
+ "paste-keep-formatting",
3160
+ "paste-convert-word",
3161
+ "security",
3162
+ "security-sanitize-on-paste",
3163
+ "security-sanitize-on-input",
3164
+ "statusbar"
3165
+ ];
3166
+ }
3167
+ /**
3168
+ * Called when element is added to DOM
3169
+ */
3170
+ connectedCallback() {
3171
+ this.config = this.resolveConfig(), this.waitForPluginLoader().then(() => {
3172
+ setTimeout(async () => {
3173
+ await this.initialize();
3174
+ }, 0);
3175
+ });
3176
+ }
3177
+ /**
3178
+ * Wait for the global plugin loader to be available
3179
+ */
3180
+ async waitForPluginLoader() {
3181
+ if (gt.__globalPluginLoader) {
3182
+ this.pluginLoader = gt.__globalPluginLoader;
3183
+ return;
3184
+ }
3185
+ return new Promise((t) => {
3186
+ const e = () => {
3187
+ gt.__globalPluginLoader ? (this.pluginLoader = gt.__globalPluginLoader, t()) : setTimeout(e, 0);
3188
+ };
3189
+ e();
3190
+ });
3191
+ }
3192
+ /**
3193
+ * Called when element is removed from DOM
3194
+ */
3195
+ disconnectedCallback() {
3196
+ this.destroy();
3197
+ }
3198
+ /**
3199
+ * Called when an observed attribute changes
3200
+ */
3201
+ attributeChangedCallback(t, e, o) {
3202
+ e !== o && (this.config = this.resolveConfig(), this.handleAttributeChange(t, o));
3203
+ }
3204
+ /**
3205
+ * Set configuration via JavaScript API
3206
+ */
3207
+ async setConfig(t) {
3208
+ this.jsConfig = t, this.config = this.resolveConfig(), this.isConnected && (this.destroy(), await this.waitForPluginLoader(), await this.initialize());
3209
+ }
3210
+ /**
3211
+ * Initialize the editor
3212
+ */
3213
+ async initialize() {
3214
+ var o;
3215
+ if (this.querySelector(".editora-toolbar") || this.isInitialized) return;
3216
+ this.setAttribute("data-editora-editor", "true"), ke.add(this), J || (J = this), di(), this.config.height && (this.style.height = typeof this.config.height == "number" ? `${this.config.height}px` : this.config.height), this.config.width && (this.style.width = typeof this.config.width == "number" ? `${this.config.width}px` : this.config.width), this.classList.add("editora-editor"), this.config.theme && this.classList.add(`editora-theme-${this.config.theme}`);
3217
+ const t = await this.loadPlugins();
3218
+ if (this.loadedPlugins = t, t.forEach((i) => {
3219
+ if (i.init && typeof i.init == "function")
3220
+ try {
3221
+ i.init({ editorElement: this });
3222
+ } catch (r) {
3223
+ console.error(`[RichTextEditor] Error initializing plugin ${i.name}:`, r);
3224
+ }
3225
+ }), !this.hasAttribute("data-initial-content") && !this.contentElement) {
3226
+ const i = this.innerHTML.trim();
3227
+ i && this.setAttribute("data-initial-content", i);
3228
+ }
3229
+ const e = this.sanitizeLoadedContent(
3230
+ (o = this.restoreAutosavedContent()) != null ? o : this.getAttribute("data-initial-content") || ""
3231
+ );
3232
+ this.engine = new cn({
3233
+ content: e,
3234
+ plugins: t,
3235
+ readonly: this.config.readonly
3236
+ }), this.createUI(t, e), this.setupEventListeners(), this.startAutosave(), this.isInitialized = !0, this.dispatchEvent(new CustomEvent("editor-ready", {
3237
+ detail: { api: this.getAPI() },
3238
+ bubbles: !0
3239
+ }));
3240
+ }
3241
+ /**
3242
+ * Get initial content from slot or attribute
3243
+ */
3244
+ getInitialContent() {
3245
+ if (this.config.content)
3246
+ return this.config.content;
3247
+ const t = this.querySelector("[slot]");
3248
+ return t ? t.innerHTML : this.hasChildNodes() ? Array.from(this.childNodes).map((o) => o.nodeType === Node.TEXT_NODE ? o.textContent : o.nodeType === Node.ELEMENT_NODE ? o.outerHTML : "").join("").trim() : "";
3249
+ }
3250
+ /**
3251
+ * Load plugins based on configuration
3252
+ */
3253
+ async loadPlugins() {
3254
+ this.pluginLoader || await this.waitForPluginLoader();
3255
+ const t = [], e = this.config.plugins && (typeof this.config.plugins == "string" && this.config.plugins.length > 0 || Array.isArray(this.config.plugins) && this.config.plugins.length > 0), i = this.getAccessibilityConfig().checker === !0;
3256
+ if (e) {
3257
+ if (typeof this.config.plugins == "string") {
3258
+ const r = this.config.plugins.split(/\s+/).filter(Boolean);
3259
+ i && !r.includes("a11yChecker") && r.push("a11yChecker");
3260
+ for (const l of r) {
3261
+ const c = await this.pluginLoader.load(l, this.getPluginLoadConfig(l));
3262
+ c && t.push(c);
3263
+ }
3264
+ } else if (Array.isArray(this.config.plugins)) {
3265
+ for (const r of this.config.plugins)
3266
+ if (typeof r == "string") {
3267
+ const l = await this.pluginLoader.load(r, this.getPluginLoadConfig(r));
3268
+ l && t.push(l);
3269
+ } else
3270
+ t.push(r);
3271
+ if (i && !t.some((r) => (r == null ? void 0 : r.name) === "a11yChecker")) {
3272
+ const r = await this.pluginLoader.load("a11yChecker", this.getPluginLoadConfig("a11yChecker"));
3273
+ r && t.push(r);
3274
+ }
3275
+ }
3276
+ } else {
3277
+ const r = this.pluginLoader.getRegisteredPluginNames();
3278
+ for (const l of r) {
3279
+ const c = await this.pluginLoader.load(l, this.getPluginLoadConfig(l));
3280
+ c && t.push(c);
3281
+ }
3282
+ }
3283
+ return t;
3284
+ }
3285
+ resolveToolbarItems() {
3286
+ const t = this.config.toolbarItems;
3287
+ if (typeof t == "string") return t;
3288
+ if (Array.isArray(t)) return t.join(" ");
3289
+ const e = this.config.toolbar;
3290
+ if (typeof e == "string") return e;
3291
+ if (!e || typeof e != "object") return;
3292
+ const o = e.items;
3293
+ if (typeof o == "string") return o;
3294
+ if (Array.isArray(o)) return o.join(" ");
3295
+ }
3296
+ isToolbarStickyEnabled() {
3297
+ const t = this.config.toolbar;
3298
+ return !t || typeof t != "object" ? !1 : !!t.sticky;
3299
+ }
3300
+ isToolbarFloatingEnabled() {
3301
+ const t = this.config.toolbar;
3302
+ return !t || typeof t != "object" ? !1 : !!t.floating;
3303
+ }
3304
+ isStatusbarEnabled() {
3305
+ const t = this.config.statusbar;
3306
+ return typeof t == "boolean" ? t : t && typeof t == "object" ? t.enabled !== !1 : !1;
3307
+ }
3308
+ getStatusbarPosition() {
3309
+ const t = this.config.statusbar;
3310
+ return t && typeof t == "object" && t.position === "top" ? "top" : "bottom";
3311
+ }
3312
+ getLanguageConfig() {
3313
+ const t = this.config.language;
3314
+ return typeof t == "string" ? { locale: t, direction: "ltr" } : t && typeof t == "object" ? {
3315
+ locale: t.locale || "en",
3316
+ direction: t.direction === "rtl" ? "rtl" : "ltr"
3317
+ } : { locale: "en", direction: "ltr" };
3318
+ }
3319
+ getAccessibilityConfig() {
3320
+ const t = this.config.accessibility;
3321
+ return typeof t == "boolean" ? {
3322
+ enableARIA: t,
3323
+ keyboardNavigation: t,
3324
+ checker: !1
3325
+ } : t && typeof t == "object" ? {
3326
+ enableARIA: t.enableARIA !== !1,
3327
+ keyboardNavigation: t.keyboardNavigation !== !1,
3328
+ checker: !!t.checker
3329
+ } : {
3330
+ enableARIA: !0,
3331
+ keyboardNavigation: !0,
3332
+ checker: !1
3333
+ };
3334
+ }
3335
+ getPerformanceConfig() {
3336
+ var e;
3337
+ const t = this.config.performance;
3338
+ if (typeof t == "boolean")
3339
+ return {
3340
+ debounceInputMs: 100,
3341
+ viewportOnlyScan: t
3342
+ };
3343
+ if (t && typeof t == "object") {
3344
+ const o = Number((e = t.debounceInputMs) != null ? e : 100);
3345
+ return {
3346
+ debounceInputMs: Number.isFinite(o) && o >= 0 ? o : 100,
3347
+ viewportOnlyScan: t.viewportOnlyScan !== !1
3348
+ };
3349
+ }
3350
+ return {
3351
+ debounceInputMs: 100,
3352
+ viewportOnlyScan: !0
3353
+ };
3354
+ }
3355
+ isEditorInViewport() {
3356
+ if (!this.contentElement || typeof window == "undefined") return !0;
3357
+ const t = this.contentElement.getBoundingClientRect();
3358
+ return t.bottom >= 0 && t.top <= window.innerHeight;
3359
+ }
3360
+ applyAccessibilitySettings() {
3361
+ if (!this.contentElement) return;
3362
+ const t = this.getAccessibilityConfig();
3363
+ if (t.enableARIA) {
3364
+ this.contentElement.setAttribute("role", "textbox"), this.contentElement.setAttribute("aria-multiline", "true"), this.contentElement.setAttribute("aria-disabled", this.config.readonly ? "true" : "false");
3365
+ const e = typeof this.config.placeholder == "string" ? this.config.placeholder.trim() : "";
3366
+ e ? this.contentElement.setAttribute("aria-label", e) : this.contentElement.removeAttribute("aria-label");
3367
+ } else
3368
+ this.contentElement.removeAttribute("role"), this.contentElement.removeAttribute("aria-multiline"), this.contentElement.removeAttribute("aria-disabled"), this.contentElement.removeAttribute("aria-label");
3369
+ this.contentElement.tabIndex = t.keyboardNavigation ? 0 : -1;
3370
+ }
3371
+ applyLanguageSettings() {
3372
+ if (!this.contentElement) return;
3373
+ const t = this.getLanguageConfig();
3374
+ this.contentElement.setAttribute("lang", t.locale), this.contentElement.setAttribute("dir", t.direction);
3375
+ }
3376
+ getSpellcheckConfig() {
3377
+ const t = this.config.spellcheck;
3378
+ if (typeof t == "boolean")
3379
+ return {
3380
+ enabled: t,
3381
+ provider: "browser"
3382
+ };
3383
+ if (t && typeof t == "object") {
3384
+ const e = t.provider || "browser";
3385
+ return {
3386
+ enabled: !!t.enabled,
3387
+ provider: e,
3388
+ mode: t.mode
3389
+ };
3390
+ }
3391
+ return { enabled: !1, provider: "browser" };
3392
+ }
3393
+ applySpellcheckSettings() {
3394
+ if (!this.contentElement) return;
3395
+ const t = this.getSpellcheckConfig(), e = t.enabled && t.provider === "browser";
3396
+ this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
3397
+ }
3398
+ executeCommand(t, ...e) {
3399
+ var r;
3400
+ typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
3401
+ const o = {
3402
+ editorElement: this,
3403
+ contentElement: this.contentElement,
3404
+ toolbarElement: this.toolbarElement
3405
+ }, i = this.loadedPlugins.find((l) => l.commands && l.commands[t]);
3406
+ if (i && i.commands) {
3407
+ const l = i.commands[t];
3408
+ if (typeof l == "function")
3409
+ try {
3410
+ return t === "toggleFullscreen" ? l(this, o) : l(...e, o), !0;
3411
+ } catch (c) {
3412
+ return console.error(`[RichTextEditor] Error executing native command ${t}:`, c), !1;
3413
+ }
3414
+ }
3415
+ return ((r = this.engine) == null ? void 0 : r.execCommand(t, ...e)) || !1;
3416
+ }
3417
+ getPluginLoadConfig(t) {
3418
+ const e = this.config.pluginConfig;
3419
+ if (e && typeof e == "object") {
3420
+ const r = e[t];
3421
+ if (r && typeof r == "object")
3422
+ return r;
3423
+ }
3424
+ const o = {
3425
+ spellCheck: ["spellcheck", "spellCheck"],
3426
+ trackChanges: ["trackchanges", "track-changes", "trackChanges"],
3427
+ versionDiff: ["versiondiff", "version-diff", "versionDiff"],
3428
+ "version-diff": ["versiondiff", "version-diff", "versionDiff"],
3429
+ conditionalContent: ["conditionalcontent", "conditional-content", "conditionalContent"],
3430
+ "conditional-content": ["conditionalcontent", "conditional-content", "conditionalContent"],
3431
+ dataBinding: ["databinding", "data-binding", "dataBinding"],
3432
+ "data-binding": ["databinding", "data-binding", "dataBinding"],
3433
+ contentRules: ["contentrules", "content-rules", "contentRules"],
3434
+ "content-rules": ["contentrules", "content-rules", "contentRules"],
3435
+ mentions: ["mention", "mentions"],
3436
+ mention: ["mention", "mentions"],
3437
+ slashCommands: ["slashcommands", "slash-commands", "slashCommands"],
3438
+ "slash-commands": ["slashcommands", "slash-commands", "slashCommands"],
3439
+ formatPainter: ["formatpainter", "format-painter", "formatPainter"],
3440
+ "format-painter": ["formatpainter", "format-painter", "formatPainter"]
3441
+ }, i = [
3442
+ t,
3443
+ t.toLowerCase(),
3444
+ ...o[t] || []
3445
+ ];
3446
+ for (const r of i) {
3447
+ const l = this.config[r];
3448
+ if (l && typeof l == "object" && !Array.isArray(l))
3449
+ return l;
3450
+ }
3451
+ }
3452
+ getContentSanitizeConfig() {
3453
+ const t = this.config.contentConfig;
3454
+ return t && typeof t == "object" ? t : { sanitize: !0 };
3455
+ }
3456
+ getSecurityConfig() {
3457
+ const t = this.config.security;
3458
+ return t && typeof t == "object" ? t : { sanitizeOnPaste: !0, sanitizeOnInput: !0 };
3459
+ }
3460
+ /**
3461
+ * HTML handed to the editor from outside (initial markup, restored autosave, setContent).
3462
+ * Same allowlist and opt-outs as typed input, applied before the markup is parsed into the
3463
+ * editable DOM: sanitizing only after the first edit leaves the page exposed until then.
3464
+ */
3465
+ sanitizeLoadedContent(t) {
3466
+ return vo(t, this.getContentSanitizeConfig(), this.getSecurityConfig());
3467
+ }
3468
+ getAutosaveConfig() {
3469
+ var e, o;
3470
+ const t = this.config.autosave;
3471
+ if (typeof t == "boolean")
3472
+ return {
3473
+ enabled: t,
3474
+ intervalMs: 3e4,
3475
+ storageKey: "rte-autosave",
3476
+ provider: "localStorage"
3477
+ };
3478
+ if (t && typeof t == "object") {
3479
+ const i = Number((o = (e = t.intervalMs) != null ? e : t.interval) != null ? o : 3e4);
3480
+ return {
3481
+ enabled: !!t.enabled,
3482
+ intervalMs: Number.isFinite(i) && i > 0 ? i : 3e4,
3483
+ storageKey: String(t.storageKey || "rte-autosave"),
3484
+ provider: t.provider || "localStorage",
3485
+ apiUrl: t.apiUrl
3486
+ };
3487
+ }
3488
+ return {
3489
+ enabled: !1,
3490
+ intervalMs: 3e4,
3491
+ storageKey: "rte-autosave",
3492
+ provider: "localStorage"
3493
+ };
3494
+ }
3495
+ persistAutosave(t) {
3496
+ const e = this.getAutosaveConfig();
3497
+ if (e.enabled && t !== this.lastAutosavedContent) {
3498
+ if (this.lastAutosavedContent = t, e.provider === "localStorage") {
3499
+ try {
3500
+ localStorage.setItem(e.storageKey, t), localStorage.setItem(`${e.storageKey}-timestamp`, Date.now().toString());
3501
+ } catch (o) {
3502
+ console.error("[RichTextEditor] Failed to save autosave content to localStorage:", o);
3503
+ }
3504
+ return;
3505
+ }
3506
+ e.provider === "api" && e.apiUrl && fetch(e.apiUrl, {
3507
+ method: "POST",
3508
+ headers: { "Content-Type": "application/json" },
3509
+ body: JSON.stringify({ content: t, timestamp: Date.now() })
3510
+ }).catch((o) => {
3511
+ console.error("[RichTextEditor] Failed to save autosave content to API:", o);
3512
+ });
3513
+ }
3514
+ }
3515
+ restoreAutosavedContent() {
3516
+ const t = this.getAutosaveConfig();
3517
+ if (!t.enabled || t.provider !== "localStorage") return null;
3518
+ try {
3519
+ const e = localStorage.getItem(t.storageKey);
3520
+ if (e)
3521
+ return this.lastAutosavedContent = e, e;
3522
+ } catch (e) {
3523
+ console.error("[RichTextEditor] Failed to restore autosaved content:", e);
3524
+ }
3525
+ return null;
3526
+ }
3527
+ stopAutosave() {
3528
+ this.autosaveTimer && (clearInterval(this.autosaveTimer), this.autosaveTimer = void 0);
3529
+ }
3530
+ startAutosave() {
3531
+ this.stopAutosave();
3532
+ const t = this.getAutosaveConfig();
3533
+ !t.enabled || !this.contentElement || (this.autosaveTimer = setInterval(() => {
3534
+ var e;
3535
+ this.persistAutosave(((e = this.contentElement) == null ? void 0 : e.innerHTML) || "");
3536
+ }, t.intervalMs));
3537
+ }
3538
+ insertHTMLAtSelection(t) {
3539
+ if (!this.contentElement) return;
3540
+ const e = window.getSelection();
3541
+ if (e && e.rangeCount > 0) {
3542
+ const o = e.getRangeAt(0);
3543
+ o.deleteContents();
3544
+ const i = document.createElement("div");
3545
+ i.innerHTML = t;
3546
+ const r = document.createDocumentFragment();
3547
+ for (; i.firstChild; )
3548
+ r.appendChild(i.firstChild);
3549
+ o.insertNode(r), o.collapse(!1), e.removeAllRanges(), e.addRange(o);
3550
+ } else
3551
+ this.contentElement.focus(), document.execCommand("insertHTML", !1, t);
3552
+ }
3553
+ /**
3554
+ * Create UI elements
3555
+ */
3556
+ createUI(t, e) {
3557
+ const o = this.querySelector('[slot="toolbar"]'), i = this.querySelector('[slot="statusbar"]');
3558
+ this.innerHTML = "", this.config.toolbar !== !1 && !o ? (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.appendChild(this.toolbarElement), this.toolbar = new dn(
3559
+ {
3560
+ items: this.resolveToolbarItems(),
3561
+ sticky: this.isToolbarStickyEnabled(),
3562
+ position: "top"
3563
+ },
3564
+ t,
3565
+ this.pluginLoader
3566
+ // Pass plugin loader to get all registered plugins
3567
+ ), this.toolbar.setCommandHandler((r, l) => {
3568
+ var c;
3569
+ if (this.contentElement) {
3570
+ this.contentElement.focus();
3571
+ const p = window.getSelection();
3572
+ if (!p || p.rangeCount === 0 || !this.contentElement.contains(p.anchorNode)) {
3573
+ const m = document.createRange(), E = this.contentElement.lastChild || this.contentElement;
3574
+ E.nodeType === Node.TEXT_NODE ? m.setStart(E, ((c = E.textContent) == null ? void 0 : c.length) || 0) : E.nodeType === Node.ELEMENT_NODE ? (m.selectNodeContents(E), m.collapse(!1)) : m.setStart(this.contentElement, 0), m.collapse(!0), p == null || p.removeAllRanges(), p == null || p.addRange(m);
3575
+ }
3576
+ }
3577
+ return this.executeCommand(r, l);
3578
+ }), this.toolbar.render(this.toolbarElement)) : o && this.appendChild(o), this.contentElement = document.createElement("div"), this.contentElement.className = "editora-content rte-content", this.contentElement.contentEditable = this.config.readonly ? "false" : "true", this.applyLanguageSettings(), this.applyAccessibilitySettings(), this.applySpellcheckSettings(), this.config.placeholder && this.contentElement.setAttribute("data-placeholder", this.config.placeholder);
3579
+ try {
3580
+ document.execCommand("defaultParagraphSeparator", !1, "p");
3581
+ } catch (r) {
3582
+ console.warn("defaultParagraphSeparator not supported:", r);
3583
+ }
3584
+ if (e) {
3585
+ const r = document.createElement("div");
3586
+ r.innerHTML = e.trim(), !Array.from(r.childNodes).some((c) => {
3587
+ if (c.nodeType === Node.ELEMENT_NODE) {
3588
+ const p = c.tagName;
3589
+ return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(p);
3590
+ }
3591
+ return !1;
3592
+ }) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
3593
+ } else
3594
+ this.config.placeholder ? this.contentElement.innerHTML = "" : this.contentElement.innerHTML = "<p><br></p>";
3595
+ this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new un({ enabled: !0 }), this.floatingToolbar.create(this)), i ? this.appendChild(i) : this.isStatusbarEnabled() && (this.statusBarElement = document.createElement("div"), this.statusBarElement.className = "editora-statusbar-container", this.appendChild(this.statusBarElement), this.statusBar = new fn({ position: this.getStatusbarPosition() }), this.statusBar.create(this.statusBarElement)), this.config.autofocus && setTimeout(() => {
3596
+ var r;
3597
+ return (r = this.contentElement) == null ? void 0 : r.focus();
3598
+ }, 0);
3599
+ }
3600
+ /**
3601
+ * Setup event listeners
3602
+ */
3603
+ setupEventListeners() {
3604
+ if (!this.contentElement || !this.engine) return;
3605
+ const t = this.keyboardShortcutManager;
3606
+ this.contentElement.addEventListener("beforeinput", (o) => {
3607
+ this.lastBeforeInputType = o.inputType || null;
3608
+ }), this.contentElement.addEventListener("input", (o) => {
3609
+ var C;
3610
+ if (!this.contentElement) return;
3611
+ let i = this.contentElement.innerHTML;
3612
+ const r = (C = o == null ? void 0 : o.detail) == null ? void 0 : C.allowedTags, l = this.getPerformanceConfig(), c = this.getContentSanitizeConfig(), p = this.getSecurityConfig(), m = this.lastBeforeInputType;
3613
+ if (this.lastBeforeInputType = null, p.sanitizeOnInput !== !1 && c.sanitize !== !1 && !m) {
3614
+ const w = vo(i, c, p, r);
3615
+ if (w !== i) {
3616
+ const v = window.getSelection(), K = v && v.rangeCount > 0 ? v.getRangeAt(0) : null;
3617
+ if (this.contentElement.innerHTML = w, K && v)
3618
+ try {
3619
+ v.removeAllRanges(), v.addRange(K);
3620
+ } catch (D) {
3621
+ }
3622
+ i = w;
3623
+ }
3624
+ }
3625
+ this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
3626
+ const A = () => {
3627
+ this.dispatchEvent(new CustomEvent("content-change", {
3628
+ detail: { html: i },
3629
+ bubbles: !0
3630
+ }));
3631
+ };
3632
+ l.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(A, l.debounceInputMs) : A(), this.updateStatusBar();
3633
+ }), this.contentElement.addEventListener("contextmenu", (o) => {
3634
+ const i = this.config.contextMenu;
3635
+ (i === !1 || typeof i == "object" && i !== null && i.enabled === !1) && o.preventDefault();
3636
+ }), this.contentElement.addEventListener("paste", (o) => {
3637
+ var E, A;
3638
+ if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
3639
+ return;
3640
+ o.preventDefault();
3641
+ const i = this.config.paste || {};
3642
+ let r = ((E = o.clipboardData) == null ? void 0 : E.getData("text/html")) || "";
3643
+ const l = ((A = o.clipboardData) == null ? void 0 : A.getData("text/plain")) || "", c = this.getContentSanitizeConfig(), p = this.getSecurityConfig(), m = !!r && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(r);
3644
+ if ((i.clean || !i.keepFormatting) && l) {
3645
+ document.execCommand("insertText", !1, l);
3646
+ return;
3647
+ }
3648
+ if (i.convertWord === !1 && m && l) {
3649
+ document.execCommand("insertText", !1, l);
3650
+ return;
3651
+ }
3652
+ if (r) {
3653
+ p.sanitizeOnPaste !== !1 && c.sanitize !== !1 && (r = ni(r, c, p)), this.insertHTMLAtSelection(r);
3654
+ return;
3655
+ }
3656
+ l && document.execCommand("insertText", !1, l);
3657
+ }), this.contentElement.addEventListener("focus", () => {
3658
+ J = this, this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
3659
+ }), this.contentElement.addEventListener("blur", () => {
3660
+ this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.dispatchEvent(new CustomEvent("content-change", {
3661
+ detail: { html: this.contentElement.innerHTML },
3662
+ bubbles: !0
3663
+ })), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
3664
+ }), this.contentElement.addEventListener("keydown", (o) => {
3665
+ this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (r, l) => {
3666
+ this.executeCommand(r, l);
3667
+ });
3668
+ });
3669
+ const e = () => {
3670
+ const o = this.getSelectionRangeInEditor(), i = document.activeElement, r = !!i && !!this.contentElement && (i === this.contentElement || this.contentElement.contains(i));
3671
+ this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !r || !o && !r || (this.updateFloatingToolbar(), this.updateStatusBar());
3672
+ };
3673
+ this.selectionChangeHandler = e, document.addEventListener("selectionchange", this.selectionChangeHandler);
3674
+ }
3675
+ getSelectionRangeInEditor() {
3676
+ if (!this.contentElement) return null;
3677
+ const t = window.getSelection();
3678
+ if (!t || t.rangeCount === 0)
3679
+ return null;
3680
+ const e = t.getRangeAt(0), o = e.commonAncestorContainer;
3681
+ return this.contentElement.contains(o) ? e : null;
3682
+ }
3683
+ isSelectionBackward(t) {
3684
+ if (!t.anchorNode || !t.focusNode) return !1;
3685
+ try {
3686
+ const e = document.createRange();
3687
+ return e.setStart(t.anchorNode, t.anchorOffset), e.setEnd(t.focusNode, t.focusOffset), e.collapsed;
3688
+ } catch (e) {
3689
+ return !1;
3690
+ }
3691
+ }
3692
+ getSelectionAnchorRect(t, e) {
3693
+ const o = Array.from(e.getClientRects()).filter((r) => r.width > 0 || r.height > 0);
3694
+ return o.length === 0 ? e.getBoundingClientRect() : this.isSelectionBackward(t) ? o[0] : o[o.length - 1];
3695
+ }
3696
+ /**
3697
+ * Update floating toolbar position
3698
+ */
3699
+ updateFloatingToolbar() {
3700
+ if (!this.floatingToolbar || !this.contentElement) return;
3701
+ if (this.config.readonly || this.contentElement.contentEditable === "false" || this.contentElement.getAttribute("data-readonly") === "true" || this.isReadonlyAttribute(this.getAttribute("readonly")) || this.getAttribute("data-readonly") === "true") {
3702
+ this.floatingToolbar.hide();
3703
+ return;
3704
+ }
3705
+ const e = this.getPerformanceConfig(), o = document.activeElement === this.contentElement || !!this.contentElement && this.contentElement.contains(document.activeElement);
3706
+ if (e.viewportOnlyScan && !this.isEditorInViewport() && !o) {
3707
+ this.floatingToolbar.hide();
3708
+ return;
3709
+ }
3710
+ const i = this.getSelectionRangeInEditor();
3711
+ if (!i) {
3712
+ this.floatingToolbar.hide();
3713
+ return;
3714
+ }
3715
+ if (i.collapsed) {
3716
+ this.floatingToolbar.hide();
3717
+ return;
3718
+ }
3719
+ const r = window.getSelection();
3720
+ if (!r) {
3721
+ this.floatingToolbar.hide();
3722
+ return;
3723
+ }
3724
+ const l = this.getSelectionAnchorRect(r, i);
3725
+ if (!l) {
3726
+ this.floatingToolbar.hide();
3727
+ return;
3728
+ }
3729
+ this.floatingToolbar.show(l.left, l.top - 40);
3730
+ }
3731
+ /**
3732
+ * Update status bar with selection and cursor information
3733
+ */
3734
+ /**
3735
+ * Update status bar with current content and cursor information
3736
+ */
3737
+ updateStatusBar() {
3738
+ if (!this.statusBar || !this.contentElement) return;
3739
+ const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
3740
+ if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
3741
+ return;
3742
+ const o = this.contentElement.textContent || "", { words: i, chars: r } = gn(o), l = mn(this.contentElement);
3743
+ let c, p;
3744
+ const m = this.getSelectionRangeInEditor();
3745
+ m && (c = pn(this.contentElement, m), m.collapsed || (p = bn(m, c), c = void 0)), this.statusBar.update({
3746
+ wordCount: i,
3747
+ charCount: r,
3748
+ lineCount: l,
3749
+ cursorPosition: c,
3750
+ selectionInfo: p
3751
+ });
3752
+ }
3753
+ /**
3754
+ * `<editora-editor readonly>` and `readonly="true"` both lock the editor; only
3755
+ * removing the attribute or `readonly="false"` unlocks it.
3756
+ */
3757
+ isReadonlyAttribute(t) {
3758
+ return t !== null && t !== "false";
3759
+ }
3760
+ /**
3761
+ * Handle attribute changes
3762
+ */
3763
+ handleAttributeChange(t, e) {
3764
+ switch (t) {
3765
+ case "readonly":
3766
+ this.contentElement && (this.contentElement.contentEditable = this.isReadonlyAttribute(e) ? "false" : "true", this.applyAccessibilitySettings()), this.engine && this.engine.setReadonly(this.isReadonlyAttribute(e));
3767
+ break;
3768
+ case "theme":
3769
+ this.classList.forEach((o) => {
3770
+ o.startsWith("editora-theme-") && this.classList.remove(o);
3771
+ }), e && this.classList.add(`editora-theme-${e}`);
3772
+ break;
3773
+ case "placeholder":
3774
+ this.contentElement && (this.contentElement.setAttribute("data-placeholder", e), this.applyAccessibilitySettings());
3775
+ break;
3776
+ case "accessibility":
3777
+ case "accessibility-enable-aria":
3778
+ case "accessibility-keyboard-navigation":
3779
+ case "accessibility-checker":
3780
+ this.applyAccessibilitySettings();
3781
+ break;
3782
+ case "performance":
3783
+ case "performance-debounce-input-ms":
3784
+ case "performance-viewport-only-scan":
3785
+ break;
3786
+ case "language":
3787
+ case "language-locale":
3788
+ case "language-direction":
3789
+ this.applyLanguageSettings();
3790
+ break;
3791
+ case "spellcheck":
3792
+ case "spellcheck-enabled":
3793
+ case "spellcheck-provider":
3794
+ this.applySpellcheckSettings();
3795
+ break;
3796
+ case "autosave":
3797
+ case "autosave-enabled":
3798
+ case "autosave-interval-ms":
3799
+ case "autosave-storage-key":
3800
+ case "autosave-provider":
3801
+ case "autosave-api-url":
3802
+ this.startAutosave();
3803
+ break;
3804
+ case "security":
3805
+ case "security-sanitize-on-paste":
3806
+ case "security-sanitize-on-input":
3807
+ case "paste":
3808
+ case "paste-clean":
3809
+ case "paste-keep-formatting":
3810
+ case "paste-convert-word":
3811
+ case "context-menu":
3812
+ case "context-menu-enabled":
3813
+ break;
3814
+ case "toolbar":
3815
+ case "toolbar-items":
3816
+ case "toolbar-floating":
3817
+ case "toolbar-sticky":
3818
+ case "plugins":
3819
+ case "statusbar":
3820
+ this.isConnected && (this.destroy(), this.waitForPluginLoader().then(() => {
3821
+ this.initialize().catch((o) => {
3822
+ console.error("[RichTextEditor] Error during attribute change re-initialization:", o);
3823
+ });
3824
+ }));
3825
+ break;
3826
+ }
3827
+ }
3828
+ /**
3829
+ * Resolve configuration from all sources
3830
+ */
3831
+ resolveConfig() {
3832
+ const t = {};
3833
+ for (let e = 0; e < this.attributes.length; e++) {
3834
+ const o = this.attributes[e];
3835
+ t[o.name] = o.value;
3836
+ }
3837
+ return Te.resolve({
3838
+ jsConfig: this.jsConfig,
3839
+ attributes: t
3840
+ });
3841
+ }
3842
+ /**
3843
+ * Get public API
3844
+ */
3845
+ getAPI() {
3846
+ return {
3847
+ getContent: () => {
3848
+ var t;
3849
+ return ((t = this.contentElement) == null ? void 0 : t.innerHTML) || "";
3850
+ },
3851
+ setContent: (t) => {
3852
+ this.contentElement && (this.contentElement.innerHTML = this.sanitizeLoadedContent(t));
3853
+ },
3854
+ execCommand: (t, e) => this.executeCommand(t, e),
3855
+ focus: () => {
3856
+ var t;
3857
+ (t = this.contentElement) == null || t.focus();
3858
+ },
3859
+ blur: () => {
3860
+ var t;
3861
+ (t = this.contentElement) == null || t.blur();
3862
+ },
3863
+ destroy: () => {
3864
+ this.destroy();
3865
+ },
3866
+ on: (t, e) => (this.addEventListener(t, e), () => this.removeEventListener(t, e)),
3867
+ getConfig: () => ({ ...this.config }),
3868
+ setReadonly: (t) => {
3869
+ this.setAttribute("readonly", t.toString());
3870
+ }
3871
+ };
3872
+ }
3873
+ /**
3874
+ * Destroy the editor
3875
+ */
3876
+ destroy() {
3877
+ var t, e, o, i;
3878
+ this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.persistAutosave(this.contentElement.innerHTML || ""), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (i = this.statusBar) == null || i.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, ke.delete(this), J === this && (J = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
3879
+ }
3880
+ // Public API methods
3881
+ getContent() {
3882
+ var t;
3883
+ return ((t = this.contentElement) == null ? void 0 : t.innerHTML) || "";
3884
+ }
3885
+ setContent(t) {
3886
+ this.contentElement && (this.contentElement.innerHTML = this.sanitizeLoadedContent(t));
3887
+ }
3888
+ execCommand(t, ...e) {
3889
+ return this.executeCommand(t, ...e);
3890
+ }
3891
+ focus() {
3892
+ var t;
3893
+ (t = this.contentElement) == null || t.focus();
3894
+ }
3895
+ blur() {
3896
+ var t;
3897
+ (t = this.contentElement) == null || t.blur();
3898
+ }
3899
+ }
3900
+ export {
3901
+ ln as C,
3902
+ Gt as E,
3903
+ un as F,
3904
+ sn as K,
3905
+ an as P,
3906
+ gt as R,
3907
+ rn as S,
3908
+ dn as T,
3909
+ cn as a,
3910
+ Te as b,
3911
+ ii as c,
3912
+ fn as d,
3913
+ gn as e,
3914
+ mn as f,
3915
+ pn as g,
3916
+ bn as h,
3917
+ hn as i,
3918
+ vo as j,
3919
+ ni as k,
3920
+ fi as l,
3921
+ oi as s
3922
+ };
3923
+ //# sourceMappingURL=index-XsYC_KdJ.mjs.map